Skip to content

Benchmark: Add MMIOMacros.wasm to the benchmark suite #434

Benchmark: Add MMIOMacros.wasm to the benchmark suite

Benchmark: Add MMIOMacros.wasm to the benchmark suite #434

Workflow file for this run

name: Build and test
on:
pull_request:
push:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
build-macos:
strategy:
matrix:
include:
# Swift 5.8.1
- os: macos-13
xcode: Xcode_14.3.1
development-toolchain-tag: swift-DEVELOPMENT-SNAPSHOT-2024-10-08-a
wasi-swift-sdk-download: "https://github.com/swiftwasm/swift/releases/download/swift-wasm-DEVELOPMENT-SNAPSHOT-2024-10-15-a/swift-wasm-DEVELOPMENT-SNAPSHOT-2024-10-15-a-wasm32-unknown-wasi.artifactbundle.zip"
wasi-swift-sdk-id: DEVELOPMENT-SNAPSHOT-2024-10-15-a-wasm32-unknown-wasi
wasi-swift-sdk-checksum: "229cd9d3b0ed582c7ef7c3064888ad78764e4743b5a770df92554a94513f53fb"
test-args: ""
# Swift 5.9.0
- os: macos-13
xcode: Xcode_15.0.1
development-toolchain-tag: swift-DEVELOPMENT-SNAPSHOT-2024-10-08-a
wasi-swift-sdk-download: "https://github.com/swiftwasm/swift/releases/download/swift-wasm-DEVELOPMENT-SNAPSHOT-2024-10-15-a/swift-wasm-DEVELOPMENT-SNAPSHOT-2024-10-15-a-wasm32-unknown-wasi.artifactbundle.zip"
wasi-swift-sdk-id: DEVELOPMENT-SNAPSHOT-2024-10-15-a-wasm32-unknown-wasi
wasi-swift-sdk-checksum: "229cd9d3b0ed582c7ef7c3064888ad78764e4743b5a770df92554a94513f53fb"
test-args: "--sanitize address"
runs-on: ${{ matrix.os }}
name: "build-macos (${{ matrix.xcode }})"
steps:
- uses: actions/checkout@v4
- id: setup-development
run: |
toolchain_path="/Library/Developer/Toolchains/${{ matrix.development-toolchain-tag }}.xctoolchain"
pkg="$(mktemp -d)/InstallMe.pkg"
development_toolchain_download="https://download.swift.org/development/xcode/${{ matrix.development-toolchain-tag }}/${{ matrix.development-toolchain-tag }}-osx.pkg"
curl -L "$development_toolchain_download" -o $pkg
sudo installer -pkg $pkg -target /
echo "toolchain-path=$toolchain_path" >> $GITHUB_OUTPUT
"$toolchain_path/usr/bin/swift" sdk install "${{ matrix.wasi-swift-sdk-download }}" --checksum "${{ matrix.wasi-swift-sdk-checksum }}"
wasi_sdk_path=$("$toolchain_path/usr/bin/swift" sdk configure --show-configuration "${{ matrix.wasi-swift-sdk-id }}" wasm32-unknown-wasi | grep sdkRootPath: | cut -d: -f2)
echo "wasi-swift-sdk-path=$(dirname $wasi_sdk_path)" >> $GITHUB_OUTPUT
- name: Select Xcode version
run: sudo xcode-select -switch /Applications/${{ matrix.xcode }}.app
- name: Configure Tests/default.json
run: |
cat <<EOS > Tests/default.json
{
"swiftExecutablePath": "${{ steps.setup-development.outputs.toolchain-path }}/usr/bin/swift",
"wasiSwiftSDKPath": "${{ steps.setup-development.outputs.wasi-swift-sdk-path }}",
"hostSwiftExecutablePath": "$(xcrun --find swift)",
"hostSdkRootPath": "$(xcrun --show-sdk-path --sdk macosx)"
}
EOS
- run: ./Vendor/checkout-dependency
- run: swift test ${{ matrix.test-args }}
build-xcode:
runs-on: macos-15
steps:
- uses: actions/checkout@v4
- run: xcrun xcodebuild -skipMacroValidation -skipPackagePluginValidation build -scheme WasmKit-Package -destination generic/platform=macOS
- run: xcrun xcodebuild -skipMacroValidation -skipPackagePluginValidation build -scheme WasmKit-Package -destination generic/platform=iOS
- run: xcrun xcodebuild -skipMacroValidation -skipPackagePluginValidation build -scheme WasmKit-Package -destination generic/platform=watchOS
- run: xcrun xcodebuild -skipMacroValidation -skipPackagePluginValidation build -scheme WasmKit-Package -destination generic/platform=tvOS
- run: xcrun xcodebuild -skipMacroValidation -skipPackagePluginValidation build -scheme WasmKit-Package -destination generic/platform=visionOS
build-linux:
strategy:
matrix:
include:
- swift: "swift:5.8-focal"
development-toolchain-download: "https://download.swift.org/development/ubuntu2004/swift-DEVELOPMENT-SNAPSHOT-2024-10-08-a/swift-DEVELOPMENT-SNAPSHOT-2024-10-08-a-ubuntu20.04.tar.gz"
wasi-swift-sdk-download: "https://github.com/swiftwasm/swift/releases/download/swift-wasm-DEVELOPMENT-SNAPSHOT-2024-10-15-a/swift-wasm-DEVELOPMENT-SNAPSHOT-2024-10-15-a-wasm32-unknown-wasi.artifactbundle.zip"
wasi-swift-sdk-id: DEVELOPMENT-SNAPSHOT-2024-10-15-a-wasm32-unknown-wasi
wasi-swift-sdk-checksum: "229cd9d3b0ed582c7ef7c3064888ad78764e4743b5a770df92554a94513f53fb"
- swift: "swift:5.9-focal"
development-toolchain-download: "https://download.swift.org/development/ubuntu2004/swift-DEVELOPMENT-SNAPSHOT-2024-10-08-a/swift-DEVELOPMENT-SNAPSHOT-2024-10-08-a-ubuntu20.04.tar.gz"
wasi-swift-sdk-download: "https://github.com/swiftwasm/swift/releases/download/swift-wasm-DEVELOPMENT-SNAPSHOT-2024-10-15-a/swift-wasm-DEVELOPMENT-SNAPSHOT-2024-10-15-a-wasm32-unknown-wasi.artifactbundle.zip"
wasi-swift-sdk-id: DEVELOPMENT-SNAPSHOT-2024-10-15-a-wasm32-unknown-wasi
wasi-swift-sdk-checksum: "229cd9d3b0ed582c7ef7c3064888ad78764e4743b5a770df92554a94513f53fb"
- swift: "swift:5.9-amazonlinux2"
development-toolchain-download: "https://download.swift.org/development/amazonlinux2/swift-DEVELOPMENT-SNAPSHOT-2024-10-08-a/swift-DEVELOPMENT-SNAPSHOT-2024-10-08-a-amazonlinux2.tar.gz"
wasi-swift-sdk-download: "https://github.com/swiftwasm/swift/releases/download/swift-wasm-DEVELOPMENT-SNAPSHOT-2024-10-15-a/swift-wasm-DEVELOPMENT-SNAPSHOT-2024-10-15-a-wasm32-unknown-wasi.artifactbundle.zip"
wasi-swift-sdk-id: DEVELOPMENT-SNAPSHOT-2024-10-15-a-wasm32-unknown-wasi
wasi-swift-sdk-checksum: "229cd9d3b0ed582c7ef7c3064888ad78764e4743b5a770df92554a94513f53fb"
- swift: "swift:6.0-focal"
development-toolchain-download: "https://download.swift.org/development/ubuntu2004/swift-DEVELOPMENT-SNAPSHOT-2024-10-08-a/swift-DEVELOPMENT-SNAPSHOT-2024-10-08-a-ubuntu20.04.tar.gz"
wasi-swift-sdk-download: "https://github.com/swiftwasm/swift/releases/download/swift-wasm-DEVELOPMENT-SNAPSHOT-2024-10-15-a/swift-wasm-DEVELOPMENT-SNAPSHOT-2024-10-15-a-wasm32-unknown-wasi.artifactbundle.zip"
wasi-swift-sdk-id: DEVELOPMENT-SNAPSHOT-2024-10-15-a-wasm32-unknown-wasi
wasi-swift-sdk-checksum: "229cd9d3b0ed582c7ef7c3064888ad78764e4743b5a770df92554a94513f53fb"
test-args: "--enable-code-coverage"
build-dev-dashboard: true
- swift: "swiftlang/swift:nightly-main-jammy"
development-toolchain-download: "https://download.swift.org/development/ubuntu2204/swift-DEVELOPMENT-SNAPSHOT-2024-10-08-a/swift-DEVELOPMENT-SNAPSHOT-2024-10-08-a-ubuntu22.04.tar.gz"
wasi-swift-sdk-download: "https://github.com/swiftwasm/swift/releases/download/swift-wasm-DEVELOPMENT-SNAPSHOT-2024-10-15-a/swift-wasm-DEVELOPMENT-SNAPSHOT-2024-10-15-a-wasm32-unknown-wasi.artifactbundle.zip"
wasi-swift-sdk-id: DEVELOPMENT-SNAPSHOT-2024-10-15-a-wasm32-unknown-wasi
wasi-swift-sdk-checksum: "229cd9d3b0ed582c7ef7c3064888ad78764e4743b5a770df92554a94513f53fb"
runs-on: ubuntu-20.04
name: "build-linux (${{ matrix.swift }})"
steps:
- uses: actions/checkout@v4
- name: Configure container
run: |
docker run -dit --name build-container -v $PWD:/workspace -w /workspace ${{ matrix.swift }}
echo 'docker exec -i build-container "$@"' > ./build-exec
chmod +x ./build-exec
- name: Install Development toolchain
id: setup-development
run: |
toolchain_path="/opt/swiftwasm"
./build-exec mkdir -p "$toolchain_path"
curl -L ${{ matrix.development-toolchain-download }} | ./build-exec tar xz --strip-component 1 -C "$toolchain_path"
echo "toolchain-path=$toolchain_path" >> $GITHUB_OUTPUT
./build-exec "$toolchain_path/usr/bin/swift" sdk install "${{ matrix.wasi-swift-sdk-download }}" --checksum "${{ matrix.wasi-swift-sdk-checksum }}"
wasi_sdk_path=$(./build-exec "$toolchain_path/usr/bin/swift" sdk configure --show-configuration "${{ matrix.wasi-swift-sdk-id }}" wasm32-unknown-wasi | grep sdkRootPath: | cut -d: -f2)
echo "wasi-swift-sdk-path=$(dirname $wasi_sdk_path)" >> $GITHUB_OUTPUT
- name: Configure Tests/default.json
run: |
cat <<EOS > Tests/default.json
{
"swiftExecutablePath": "${{ steps.setup-development.outputs.toolchain-path }}/usr/bin/swift",
"wasiSwiftSDKPath": "${{ steps.setup-development.outputs.wasi-swift-sdk-path }}",
"hostSwiftExecutablePath": "/usr/bin/swift"
}
EOS
- run: ./build-exec ./CI/install-wabt.sh
- run: ./Vendor/checkout-dependency
- run: ./build-exec swift test ${{ matrix.test-args }}
- if: matrix.build-dev-dashboard
run: ./build-exec ./CI/build-dev-dashboard.sh
- if: matrix.build-dev-dashboard
name: Relax artifact permissions
run: sudo chown -R $USER .build/html
- if: matrix.build-dev-dashboard
id: deployment
uses: actions/upload-pages-artifact@v3
with:
path: .build/html
deploy-dev-dashboard:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
needs: build-linux
permissions:
id-token: write
pages: write
steps:
- id: deployment
uses: actions/deploy-pages@v4
build-musl:
runs-on: ubuntu-22.04
strategy:
matrix:
include:
- swift: 6.0.1-jammy
musl-swift-sdk-download: "https://download.swift.org/swift-6.0.1-release/static-sdk/swift-6.0.1-RELEASE/swift-6.0.1-RELEASE_static-linux-0.0.1.artifactbundle.tar.gz"
musl-swift-sdk-checksum: "d4f46ba40e11e697387468e18987ee622908bc350310d8af54eb5e17c2ff5481"
steps:
- uses: actions/checkout@v4
- name: Configure container
run: |
docker run -dit --name build-container -v $PWD:/workspace -w /workspace swift:${{ matrix.swift }}
echo 'docker exec -i build-container "$@"' > ./build-exec
chmod +x ./build-exec
- name: Install Static Linux SDK
run: ./build-exec swift sdk install "${{ matrix.musl-swift-sdk-download }}" --checksum "${{ matrix.musl-swift-sdk-checksum }}"
- name: Build (x86_64-swift-linux-musl)
run: ./build-exec swift build --swift-sdk x86_64-swift-linux-musl
- name: Build (aarch64-swift-linux-musl)
run: ./build-exec swift build --swift-sdk aarch64-swift-linux-musl
build-windows:
runs-on: windows-latest
steps:
- uses: compnerd/gha-setup-swift@main
with:
branch: swift-5.10.1-release
tag: 5.10.1-RELEASE
- uses: actions/checkout@v4
- run: python3 ./Vendor/checkout-dependency
# FIXME: CMake build is failing on CI due to "link: extra operand '/OUT:lib\\libXXXX.a'" error
# # Check Windows build with CMake
# - uses: Cyberboss/install-winget@v1
# - run: winget install Ninja-build.Ninja Kitware.CMake --disable-interactivity --accept-source-agreements
# - run: |
# echo "$env:LOCALAPPDATA\Microsoft\WinGet\Links" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
# echo "$env:ProgramFiles\CMake\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
# - run: cmake -G Ninja -B .build/cmake
# - run: cmake --build .build/cmake
# Run tests with SwiftPM
- run: swift test
build-cmake:
runs-on: ubuntu-20.04
container:
image: swift:5.8-focal
steps:
- uses: actions/checkout@v4
- name: Install Ninja
run: apt-get update && apt-get install -y ninja-build
- name: Install CMake
run: |
apt-get install -y curl
curl -L https://github.com/Kitware/CMake/releases/download/v3.29.2/cmake-3.29.2-linux-x86_64.tar.gz | tar xz --strip-component 1 -C /usr/local/
- run: cmake -G Ninja -B ./build
- run: cmake --build ./build
- run: ./build/bin/wasmkit-cli --version