Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: adjust generic workflow #66

Merged
merged 4 commits into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<!-- Include a summary of the change.
Please also include relevant motivation and context. -->

<!-- Link the issue which will be fixed (if any) here: -->
<!-- Fixes # -->
<!-- Link the issue which will be fixed (if any) here: -->
<!-- Fixes # -->

## Type of change

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/code_tests_and_checks.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: Code / Tests and Checks
name: Code / Tests & Checks

on: # yamllint disable-line rule:truthy
workflow_dispatch:
Expand Down
34 changes: 21 additions & 13 deletions .github/workflows/generic_code_executor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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 }}
2 changes: 1 addition & 1 deletion code/rust-toolchain.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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']