Update GitHub actions for Rust #2392
Workflow file for this run
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: "CI: Lint" | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
# branches: ["main"] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.number }} | |
cancel-in-progress: true | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
container: | |
image: ghcr.io/elementary/docker:stable | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: | | |
apt-get update && apt-get install -y curl xvfb | |
- name: Install stable rust | |
run: | | |
curl https://sh.rustup.rs -sSf | sh -s -- -y | |
echo "$HOME/.cargo/bin" >> $GITHUB_PATH | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
./builddir | |
key: rust-${{ runner.os }}-${{ hashFiles('Cargo.lock') }} | |
restore-keys: | | |
rust-${{ runner.os }} | |
- name: Build | |
run: | | |
meson setup builddir | |
meson compile -C builddir | |
- name: Run tests | |
run: xvfb-run --auto-servernum meson test --print-errorlogs -C builddir | |
format: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install stable rust | |
run: | | |
rustup default stable | |
rustup set profile default | |
rustup update | |
- name: Touch empty config file | |
run: | | |
echo "" >> src/config.rs | |
- name: Run cargo fmt | |
run: | | |
cargo fmt --all -- --check | |
clippy: | |
runs-on: ubuntu-latest | |
container: | |
image: ghcr.io/elementary/docker:stable | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: | | |
apt-get update && apt-get install -y curl | |
- name: Install stable rust | |
run: | | |
curl https://sh.rustup.rs -sSf | sh -s -- -y | |
echo "$HOME/.cargo/bin" >> $GITHUB_PATH | |
- name: Generate config.rs | |
run: | | |
meson setup builddir | |
- name: Run cargo clippy | |
run: | | |
cargo clippy -- -D warnings |