Update GitHub CI #32
This file contains 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
name: Test | |
on: [push] | |
jobs: | |
crosscompile-macos: | |
name: Build Xcode toolchain | |
runs-on: macos-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Swift Version | |
run: swift --version | |
- name: Generate Xcode toolchain | |
run: | | |
export SRC_ROOT=$GITHUB_WORKSPACE | |
./generate-xcode-toolchain.sh | |
- name: Cross compile Swift package | |
run: | | |
export SRC_ROOT=$GITHUB_WORKSPACE | |
./build-swift-hello.sh | |
- name: Archive swift-hello | |
uses: actions/upload-artifact@v3 | |
with: | |
name: swift-hello-crosscompile-macos | |
path: ./build/swift-hello/armv7-unknown-linux-gnueabihf/release/swift-hello | |
crosscompile-linux: | |
name: Crosscompile from Linux | |
runs-on: ubuntu-latest | |
container: colemancda/swift-armv7 | |
steps: | |
- name: Check out GitHub repo | |
uses: actions/checkout@v2 | |
- name: Swift Version | |
run: swift --version | |
- name: Download Swift runtime | |
run: | | |
export SRC_ROOT=$GITHUB_WORKSPACE | |
export DOWNLOAD_FILE=$SRC_ROOT/build/swift-armv7.tar.gz | |
export TAR_URL=https://github.com/colemancda/swift-armv7/releases/download/0.6.0/swift-armv7.tar.gz | |
mkdir -p $SRC_ROOT/build | |
mkdir -p $SRC_ROOT/build/swift-linux-armv7-install | |
wget -q $TAR_URL -O $DOWNLOAD_FILE | |
cd $SRC_ROOT/build/swift-linux-armv7-install | |
tar -xvf $DOWNLOAD_FILE | |
rm -rf $DOWNLOAD_FILE | |
- name: Cross compile Swift package | |
run: | | |
export SRC_ROOT=$GITHUB_WORKSPACE | |
./generate-swiftpm-toolchain.sh | |
./build-swift-hello.sh | |
- name: Archive swift-hello | |
uses: actions/upload-artifact@v3 | |
with: | |
name: swift-hello-crosscompile-linux | |
path: ./build/swift-hello/armv7-unknown-linux-gnueabihf/release/swift-hello | |
test-swift-hello-armv7: | |
name: Test Swift runtime | |
runs-on: [self-hosted, Linux, ARM] | |
strategy: | |
matrix: | |
os: [macos, linux] | |
container: colemancda/swift-armv7:latest-runtime | |
needs: [crosscompile-linux, crosscompile-macos] | |
steps: | |
- name: Download swift-hello | |
uses: actions/download-artifact@v3 | |
with: | |
name: swift-hello-crosscompile-${{ matrix.os }} | |
path: /tmp/ | |
- name: Test | |
run: | | |
chmod +x /tmp/swift-hello | |
/tmp/swift-hello |