From 8e87dbbfd4d9108ad6eb2ccd149665290f037b7b Mon Sep 17 00:00:00 2001 From: Georg Lauterbach <44545919+georglauterbach@users.noreply.github.com> Date: Fri, 19 Jan 2024 19:20:26 +0100 Subject: [PATCH] ci: adjust generic workflow (#66) --- .github/pull_request_template.md | 4 +-- .github/workflows/code_tests_and_checks.yml | 2 +- .github/workflows/generic_code_executor.yml | 34 +++++++++++++-------- code/rust-toolchain.toml | 2 +- 4 files changed, 25 insertions(+), 17 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 8ddd129..c4c66d1 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -3,8 +3,8 @@ - - + + ## Type of change diff --git a/.github/workflows/code_tests_and_checks.yml b/.github/workflows/code_tests_and_checks.yml index 3971aaf..c058cc1 100644 --- a/.github/workflows/code_tests_and_checks.yml +++ b/.github/workflows/code_tests_and_checks.yml @@ -1,5 +1,5 @@ --- -name: Code / Tests and Checks +name: Code / Tests & Checks on: # yamllint disable-line rule:truthy workflow_dispatch: diff --git a/.github/workflows/generic_code_executor.yml b/.github/workflows/generic_code_executor.yml index 90819e4..dccab40 100644 --- a/.github/workflows/generic_code_executor.yml +++ b/.github/workflows/generic_code_executor.yml @@ -3,18 +3,25 @@ name: Generic Executor on: workflow_call: inputs: + # Set to true if you need `qemu`. install-qemu: required: false type: boolean default: false + + # Set to true if you need `sccache`. install-sccache: required: false type: boolean default: false + + # Set to true if you need `cargo-audit`. install-cargo-audit: required: false type: boolean default: false + + # Provide a command that is run in the end. command: required: true type: string @@ -29,14 +36,20 @@ defaults: jobs: generic-execute: - name: 'Execute' + name: Run runs-on: ubuntu-22.04 steps: - name: Checkout code uses: actions/checkout@v4 - - name: Install Rust - run: sudo ../misc/scripts/install_rust_and_mold.sh + - name: Install Rust and mold + run: | + sudo ../misc/scripts/install_rust_and_mold.sh + + source "${HOME}/.cargo/env" + cargo --version + rustc --version + mold --version - name: Install QEMU if: inputs.install-qemu @@ -52,29 +65,24 @@ jobs: - name: Setup sccache if: inputs.install-sccache run: | - sccache --version echo 'SCCACHE_GHA_ENABLED=true' >>"${GITHUB_ENV}" echo 'RUSTC_WRAPPER=sccache' >>"${GITHUB_ENV}" + sccache --version - - name: Print version information of build tools - run: | - cargo --version - rustc --version - mold --version - - - name: Install `cargo audit` + - name: Install cargo-audit if: inputs.install-cargo-audit run: | cargo install cargo-audit cargo-audit --version - - name: Run command + - name: Run command (with `sccache`) if: inputs.install-sccache env: SCCACHE_GHA_ENABLED: 'true' RUSTC_WRAPPER: sccache run: ${{ inputs.command }} - - name: Run command + - name: Run command (without `sccache`) + # we need the `${{ }}` here because `!` is reserved in YAML if: ${{ ! inputs.install-sccache }} run: ${{ inputs.command }} diff --git a/code/rust-toolchain.toml b/code/rust-toolchain.toml index 4702661..5abf879 100644 --- a/code/rust-toolchain.toml +++ b/code/rust-toolchain.toml @@ -11,6 +11,6 @@ # General information about the keys below can be found under # https://rust-lang.github.io/rustup/concepts/index.html [toolchain] -channel = 'nightly-2024-01-13' +channel = 'nightly-2024-01-19' components = [ 'cargo', 'rustc', 'rust-std', 'clippy', 'rustfmt' ] targets = ['riscv64gc-unknown-none-elf']