code #227
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: code | |
on: | |
push: | |
schedule: | |
- cron: '0 20 * * 0' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref || github.run_id }} | |
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} | |
defaults: | |
run: | |
shell: bash | |
env: | |
CARGO_INCREMENTAL: "0" | |
RUSTDOCFLAGS: "-D warnings" | |
jobs: | |
plan: | |
name: Plan the execution | |
runs-on: ubuntu-20.04 | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Compute matrix | |
uses: ./.github/actions/plan | |
id: set-matrix | |
with: | |
plan-name: code | |
- name: Dump matrix context | |
env: | |
MATRIX_CONTEXT: ${{ toJson(steps.set-matrix.outputs.matrix) }} | |
run: echo "$MATRIX_CONTEXT" | |
test: | |
needs: | |
- plan | |
strategy: | |
matrix: ${{ fromJson(needs.plan.outputs.matrix) }} | |
fail-fast: false | |
name: ${{ matrix.plan.platform.name }} / ${{ matrix.plan.mode.name }} | |
runs-on: ${{ matrix.plan.platform.os }} | |
env: ${{ matrix.plan.platform.env }} | |
timeout-minutes: 50 | |
permissions: | |
contents: read | |
steps: | |
- name: Job config | |
run: printf "%s\n" "$MATRIX_CONTEXT" | |
env: | |
MATRIX_CONTEXT: ${{ toJson(matrix) }} | |
- name: Checkout | |
uses: actions/checkout@v3 | |
timeout-minutes: 5 | |
- name: Install rust toolchain | |
run: rustup show | |
timeout-minutes: 10 | |
- name: Install additional rust toolchains | |
run: rustup target add ${{ join(matrix.plan.platform.extraTargetsToInstall, ' ') }} | |
if: ${{ join(matrix.plan.platform.extraTargetsToInstall, ' ') != '' }} | |
timeout-minutes: 10 | |
- name: Prepare the build environment | |
run: ${{ matrix.plan.platform.buildEnvScript }} | |
- name: Set up Vistual Studio Command Prompt (Windows only) | |
uses: ilammy/msvc-dev-cmd@v1 | |
if: runner.os == 'Windows' | |
- name: Print build environment info | |
run: | | |
set -x | |
cargo --version | |
cargo clippy --version | |
env | |
- name: Run cargo ${{ matrix.plan.mode.cargoCommand }} | |
uses: actions-rs/cargo@v1 | |
with: | |
command: ${{ matrix.plan.mode.cargoCommand }} | |
args: ${{ matrix.plan.mode.cargoArgs }} | |
cargo-deny: | |
name: cargo deny | |
runs-on: ubuntu-20.04 | |
timeout-minutes: 20 | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
timeout-minutes: 5 | |
- name: Install rust toolchain | |
run: rustup show | |
timeout-minutes: 10 | |
- name: Cache | |
uses: Swatinem/rust-cache@v2 | |
timeout-minutes: 10 | |
- name: Install cargo-deny | |
run: > | |
curl -sSL "https://github.com/EmbarkStudios/cargo-deny/releases/download/0.13.7/cargo-deny-0.13.7-x86_64-unknown-linux-musl.tar.gz" | | |
sudo tar -xzvf - -C /usr/local/bin --strip-components=1 | |
timeout-minutes: 10 | |
- run: cargo deny check |