Continuous Integration #53
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
############################## | |
# # | |
# Copyright (c) xTekC. # | |
# Licensed under MPL-2.0. # | |
# See LICENSE for details. # | |
# # | |
############################## | |
name: Continuous Integration | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
- staging # for bors | |
- trying # for bors | |
schedule: | |
- cron: "0 0 * * 0" | |
jobs: | |
build: | |
name: Build on ${{ matrix.build.OS }} (${{ matrix.build.TARGET }}) | |
runs-on: ${{ matrix.build.OS }} | |
strategy: | |
fail-fast: false | |
matrix: | |
build: | |
# - { | |
# OS: ubuntu-latest, | |
# TOOLCHAIN: stable, | |
# TARGET: riscv64gc-unknown-linux-gnu, | |
# } | |
- { | |
OS: ubuntu-latest, | |
TOOLCHAIN: stable, | |
TARGET: aarch64-linux-android, | |
} | |
- { | |
OS: ubuntu-latest, | |
TOOLCHAIN: stable, | |
TARGET: aarch64-unknown-linux-gnu, | |
} | |
- { | |
OS: ubuntu-latest, | |
TOOLCHAIN: stable, | |
TARGET: aarch64-unknown-linux-musl, | |
} | |
- { | |
OS: ubuntu-latest, | |
TOOLCHAIN: stable, | |
TARGET: x86_64-unknown-linux-gnu, | |
} | |
- { | |
OS: ubuntu-latest, | |
TOOLCHAIN: stable, | |
TARGET: x86_64-unknown-linux-musl, | |
} | |
- { | |
OS: ubuntu-latest, | |
TOOLCHAIN: stable, | |
TARGET: x86_64-unknown-freebsd, | |
} | |
# - { | |
# OS: ubuntu-latest, | |
# TOOLCHAIN: stable, | |
# TARGET: x86_64-unknown-netbsd, | |
# } | |
- { | |
OS: macos-latest, | |
TOOLCHAIN: stable, | |
TARGET: aarch64-apple-darwin, | |
} | |
- { OS: macos-latest, | |
TOOLCHAIN: stable, | |
TARGET: x86_64-apple-darwin, | |
} | |
- { | |
OS: windows-latest, | |
TOOLCHAIN: stable, | |
TARGET: aarch64-pc-windows-msvc, | |
} | |
- { | |
OS: windows-latest, | |
TOOLCHAIN: stable, | |
TARGET: x86_64-pc-windows-gnu, | |
} | |
- { | |
OS: windows-latest, | |
TOOLCHAIN: stable, | |
TARGET: x86_64-pc-windows-msvc, | |
} | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v3 | |
- name: Set up Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: ${{ matrix.build.TOOLCHAIN }} | |
- name: Install target | |
run: rustup target add ${{ matrix.build.TARGET }} | |
- name: Build for ${{ matrix.build.TARGET }} | |
run: ./scripts/build_debug.sh ${{ matrix.build.TARGET }} | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v3 | |
- name: Set up Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Cache Cargo dependencies | |
uses: Swatinem/rust-cache@v2 | |
- name: Run tests | |
run: cargo test | |
lint: | |
name: Check | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the repository | |
if: github.event_name != 'pull_request' | |
uses: actions/checkout@v3 | |
- name: Checkout the repository | |
if: github.event_name == 'pull_request' | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Set up Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
components: rustfmt, clippy | |
- name: Cache Cargo dependencies | |
uses: Swatinem/rust-cache@v2 | |
- name: Run rustfmt | |
run: cargo fmt --all -- --check | |
- name: Run clippy | |
run: cargo clippy --tests -- -D warnings | |
- name: Run cargo-audit | |
run: | | |
cargo install cargo-audit | |
cargo audit | |
env: | |
CARGO_AUDIT_TOKEN: ${{ secrets.GITHUB_TOKEN }} |