on: [push, pull_request]
name: CI
jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
command: check
args: --all
test:
name: Test Suite
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
toolchain: [stable, nightly]
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.toolchain }}
override: true
- name: Cache cargo build
uses: Swatinem/rust-cache@v1
- name: Install zig
run: pip3 install ziglang
- uses: actions-rs/cargo@v1
with:
command: build
- name: Linux - Test x86_64 build
if: matrix.os == 'ubuntu-latest'
run: |
cargo run zigbuild --target x86_64-unknown-linux-gnu
- name: Linux - Test x86_64 glibc build
if: ${{ matrix.os == 'ubuntu-latest' && matrix.toolchain == 'nightly' }}
run: |
cargo run zigbuild --target x86_64-unknown-linux-gnu.2.17
- name: Linux - Test glibc build
run: |
rustup target add aarch64-unknown-linux-gnu
cargo run zigbuild --target aarch64-unknown-linux-gnu
cargo run zigbuild --target aarch64-unknown-linux-gnu.2.17
# Test building shared library
cargo run zigbuild --target aarch64-unknown-linux-gnu --manifest-path tests/libhello/Cargo.toml
- name: Linux - Test musl libc build
run: |
rustup target add aarch64-unknown-linux-musl
cargo run zigbuild --target aarch64-unknown-linux-musl
- name: macOS - Test build
run: |
rustup target add aarch64-apple-darwin
cargo run zigbuild --target aarch64-apple-darwin
cargo run zigbuild --target aarch64-apple-darwin --release
- name: Windows - Test gnu build
run: |
rustup target add x86_64-pc-windows-gnu
cargo run zigbuild --target x86_64-pc-windows-gnu
cargo run zigbuild --target x86_64-pc-windows-gnu --manifest-path tests/hello-windows/Cargo.toml
- name: Windows - Test run
if: matrix.os == 'windows-latest'
run: |
./target/x86_64-pc-windows-gnu/debug/cargo-zigbuild.exe zigbuild --help
./tests/hello-windows/target/x86_64-pc-windows-gnu/debug/hello-windows.exe
fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: rustfmt
override: true
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
clippy_check:
name: Clippy Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: clippy
override: true
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features
spellcheck:
name: spellcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: codespell-project/actions-codespell@master