ci: add swift build & test #70
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: CI | |
on: | |
pull_request: | |
merge_group: | |
push: | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build_and_test_rust: | |
runs-on: ${{ matrix.runner }} | |
timeout-minutes: 30 | |
name: Rust - Build and test | |
strategy: | |
fail-fast: false | |
matrix: | |
name: [ubuntu-latest, macOS-arm-latest, windows-latest] | |
rust: [stable] | |
include: | |
- name: ubuntu-latest | |
os: ubuntu-latest | |
release-os: linux | |
release-arch: amd64 | |
runner: [linux, X64] | |
- name: macOS-arm-latest | |
os: macOS-latest | |
release-os: darwin | |
release-arch: aarch64 | |
runner: [macOS, ARM64] | |
- name: windows-latest | |
os: windows | |
runner: [windows-latest] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@master | |
with: | |
submodules: recursive | |
- name: Install ${{ matrix.rust }} | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.rust }} | |
- name: cargo test | |
run: cargo test | |
check_fmt_and_docs: | |
timeout-minutes: 30 | |
name: Checking fmt and docs | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
components: rustfmt | |
- name: fmt | |
run: cargo fmt -- --check | |
- name: Docs | |
run: cargo doc --all-features --no-deps --document-private-items | |
clippy_check: | |
timeout-minutes: 30 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
components: clippy | |
- name: clippy check | |
run: cargo clippy --all-targets --bins --tests --benches | |
build_and_test_go: | |
name: Go - Build and test | |
timeout-minutes: 30 | |
runs-on: [linux, x64] | |
steps: | |
- uses: actions/checkout@master | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: 'stable' | |
env: | |
XDG_CACHE_HOME: /root/.cache | |
HOME: /root #added based on https://github.com/actions/setup-go/issues/116 | |
- name: Build rust | |
run: cargo build | |
- name: Go test | |
env: | |
XDG_CACHE_HOME: /root/.cache | |
HOME: /root #added based on https://github.com/actions/setup-go/issues/116 | |
run: | | |
cd ./go && \ | |
LD_LIBRARY_PATH="${LD_LIBRARY_PATH:-}:/root/actions-runner/_work/iroh-ffi/iroh-ffi/target/debug/" \ | |
CGO_LDFLAGS="-liroh -L /root/actions-runner/_work/iroh-ffi/iroh-ffi/target/debug" \ | |
go test ./... | |
build_and_test_swift: | |
name: Swift - Build and test | |
timeout-minutes: 30 | |
runs-on: [self-hosted, macOS, ARM64] | |
steps: | |
- uses: actions/checkout@master | |
- name: Ensure Xcode CLI tools are installed | |
run: | | |
if ! [ -x "$(command -v xcode-select)" ]; then | |
xcode-select --install | |
fi | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: aarch64-apple-ios,aarch64-apple-ios-sim,x86_64-apple-ios | |
- uses: sushichop/gha-swift-env@v1 | |
with: | |
swift-version: '5.6' | |
- name: Show Swift version | |
run: | | |
swift --version | |
- name: Build rust | |
run: cargo build --release | |
- name: Build swift library | |
run: ./make_swift.sh | |