Build embedded Swift examples #229
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##===----------------------------------------------------------------------===## | |
## | |
## This source file is part of the Swift.org open source project | |
## | |
## Copyright (c) 2024 Apple Inc. and the Swift project authors | |
## Licensed under Apache License v2.0 with Runtime Library Exception | |
## | |
## See https://swift.org/LICENSE.txt for license information | |
## See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors | |
## | |
##===----------------------------------------------------------------------===## | |
name: Build embedded Swift examples | |
on: | |
# Run at 9 AM UTC | |
schedule: | |
- cron: '0 9 * * *' | |
# Allow for starting this workflow from the GitHub web UI, API and CLI | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
repository: apple/swift-embedded-examples | |
- name: Download development snapshot toolchain | |
run: | | |
for (( i=0; i < 90; i++ )) | |
do | |
# try to find latest toolchain | |
TOOLCHAIN_DATE=$(date -v-${i}d +"%Y-%m-%d") | |
TOOLCHAIN_FILE="swift-DEVELOPMENT-SNAPSHOT-$TOOLCHAIN_DATE-a-osx.pkg" | |
TOOLCHAIN_URL="https://download.swift.org/development/xcode/swift-DEVELOPMENT-SNAPSHOT-$TOOLCHAIN_DATE-a/$TOOLCHAIN_FILE" | |
if wget --spider $TOOLCHAIN_URL 2>/dev/null; then | |
break # toolchain found | |
fi | |
done | |
echo +++ Downloading $TOOLCHAIN_URL | |
wget --quiet $TOOLCHAIN_URL | |
sudo installer -pkg ./$TOOLCHAIN_FILE -target / | |
TOOLCHAINS=$(plutil -extract CFBundleIdentifier raw /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-*-a.xctoolchain/Info.plist) | |
echo +++ Using TOOLCHAINS=$TOOLCHAINS | |
TOOLCHAINS=$TOOLCHAINS swift --version | |
echo "TOOLCHAINS=$TOOLCHAINS" >> $GITHUB_ENV | |
- name: Install Python dependencies | |
run: | | |
python3 -m venv .venv | |
source .venv/bin/activate | |
python3 -m pip install -r Tools/requirements.txt | |
- name: Build pico-blink | |
run: | | |
echo +++ Using TOOLCHAINS=$TOOLCHAINS | |
python3 -m venv .venv | |
source .venv/bin/activate | |
echo +++ Building pico-blink | |
cd pico-blink | |
./build.sh | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: pico-blink-blinky.uf2 | |
path: /Users/runner/work/swift-embedded-examples/swift-embedded-examples/pico-blink/.build/armv6m-apple-none-macho/release/blinky.uf2 | |
- name: Build pico2-neopixel | |
run: | | |
echo +++ Using TOOLCHAINS=$TOOLCHAINS | |
python3 -m venv .venv | |
source .venv/bin/activate | |
echo +++ Building pico2-neopixel | |
cd pico2-neopixel | |
make | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: pico2-neopixel-Application.uf2 | |
path: pico2-neopixel/.build/release/Application.uf2 | |
- name: Build stm32-neopixel | |
run: | | |
echo +++ Using TOOLCHAINS=$TOOLCHAINS | |
python3 -m venv .venv | |
source .venv/bin/activate | |
echo +++ Building stm32-neopixel | |
cd stm32-neopixel | |
make | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: stm32-neopixel-Application.bin | |
path: stm32-neopixel/.build/release/Application.bin | |
- name: Build stm32-uart-echo | |
run: | | |
echo +++ Using TOOLCHAINS=$TOOLCHAINS | |
python3 -m venv .venv | |
source .venv/bin/activate | |
echo +++ Building stm32-uart-echo | |
cd stm32-uart-echo | |
make | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: stm32-uart-echo-Application.bin | |
path: stm32-uart-echo/.build/release/Application.bin |