Skip to content

Commit 0f7a4f8

Browse files
author
sw-dev
committed
Add GitHub action to build the examples
This is intended to provide a starting point to continuously build the examples using the latest development snapshot toolchain. As a proof-of-concept, the `pico-blink` example is build.
1 parent 22f2c98 commit 0f7a4f8

File tree

2 files changed

+62
-0
lines changed

2 files changed

+62
-0
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
##===----------------------------------------------------------------------===##
2+
##
3+
## This source file is part of the Swift.org open source project
4+
##
5+
## Copyright (c) 2024 Apple Inc. and the Swift project authors
6+
## Licensed under Apache License v2.0 with Runtime Library Exception
7+
##
8+
## See https://swift.org/LICENSE.txt for license information
9+
## See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+
##
11+
##===----------------------------------------------------------------------===##
12+
13+
name: Build embedded Swift examples
14+
15+
on:
16+
# Run at 9 AM UTC
17+
schedule:
18+
- cron: '0 9 * * *'
19+
# Allow for starting this workflow from the GitHub web UI, API and CLI
20+
workflow_dispatch:
21+
22+
jobs:
23+
build:
24+
runs-on: macos-latest
25+
26+
steps:
27+
- uses: actions/checkout@v4
28+
- name: Download development snapshot toolchain
29+
run: |
30+
for (( i=0; i < 30; i++ ))
31+
do
32+
# try to find latest toolchain
33+
TOOLCHAIN_DATE=$(date -v-${i}d +"%Y-%m-%d")
34+
TOOLCHAIN_FILE="swift-DEVELOPMENT-SNAPSHOT-$TOOLCHAIN_DATE-a-osx.pkg"
35+
TOOLCHAIN_URL="https://download.swift.org/development/xcode/swift-DEVELOPMENT-SNAPSHOT-2024-09-11-a/$TOOLCHAIN_FILE"
36+
if wget --spider $TOOLCHAIN_URL 2>/dev/null; then
37+
break # toolchain found
38+
fi
39+
done
40+
echo +++ Downloading $TOOLCHAIN_URL
41+
wget --quiet $TOOLCHAIN_URL
42+
sudo installer -pkg ./$TOOLCHAIN_FILE -target /
43+
TOOLCHAINS=$(plutil -extract CFBundleIdentifier raw /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-*-a.xctoolchain/Info.plist)
44+
echo +++ Using TOOLCHAINS=$TOOLCHAINS
45+
TOOLCHAINS=$TOOLCHAINS swift --version
46+
echo "TOOLCHAINS=$TOOLCHAINS" >> $GITHUB_ENV
47+
- name: Install Python dependencies
48+
run: |
49+
python3 -m venv .venv
50+
source .venv/bin/activate
51+
python3 -m pip install -r Tools/requirements.txt
52+
- name: Build pico-blink
53+
run: |
54+
echo +++ Using TOOLCHAINS=$TOOLCHAINS
55+
python3 -m venv .venv
56+
source .venv/bin/activate
57+
echo +++ Building pico-blink
58+
cd pico-blink
59+
./build.sh
60+
61+

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@
66
*/sdkconfig.old
77
*/managed_components
88
*/dependencies.lock
9+
/.venv

0 commit comments

Comments
 (0)