CI: Run tests on all platforms and verify build #52
Workflow file for this run
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: Lint and Test | |
on: | |
push: | |
branches: main | |
pull_request: | |
jobs: | |
lint-and-test: | |
strategy: | |
matrix: | |
runner: | |
- macos-11 | |
- macos-12 | |
- macos-13 | |
- macos-14 | |
- ubuntu-latest | |
- windows-latest | |
rust-version: | |
- "1.72" | |
runs-on: "${{matrix.runner}}" | |
steps: | |
# TODO: Consider adding caching. | |
- name: Setup Rust | |
run: | | |
rustup default "${{matrix.rust-version}}" | |
rustup component add rustfmt clippy | |
- name: Check out sources | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Check formatting | |
run: cargo fmt --check | |
- name: Run linter | |
run: cargo clippy --all-targets --all-features -- -Dwarnings | |
- name: Run tests | |
run: cargo test | |
- name: Build Swift package (macOS/x86_64 only) | |
if: runner.os == 'macOS' && runner.arch == 'X64' | |
run: | | |
make swift-bindings lib-darwin-x86_64 # produces './generated/bindings' and './target/x86_64-apple-darwin/release/libconcordium_wallet_crypto_uniffi.a' | |
xcodebuild -create-xcframework \ | |
-library ./target/x86_64-apple-darwin/release/libconcordium_wallet_crypto_uniffi.a -headers ./generated/bindings \ | |
-output ./generated/ConcordiumWalletCryptoUniffi.xcframework | |
- name: Build Swift package (macOS/arm64 only) | |
if: runner.os == 'macOS' && runner.arch == 'ARM64' | |
run: | | |
make swift-bindings lib-darwin-aarch64 # produces './generated/bindings' and './target/aarch64-apple-darwin/release/libconcordium_wallet_crypto_uniffi.a' | |
xcodebuild -create-xcframework \ | |
-library ./target/aarch64-apple-darwin/release/libconcordium_wallet_crypto_uniffi.a -headers ./generated/bindings \ | |
-output ./generated/ConcordiumWalletCryptoUniffi.xcframework | |
- name: Verify that library builds (macOS only) | |
if: runner.os == 'macOS' | |
run: swift build | |
env: | |
# Use the local framework built in previous step. | |
CONCORDIUM_WALLET_CRYPTO_FRAMEWORK_PATH: ./generated/ConcordiumWalletCryptoUniffi.xcframework |