1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
# This is a basic workflow to help you get started with Actions
name: Rust Checks
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]
pull_request:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Make sure CI fails on all warnings, including Clippy lints
env:
RUSTFLAGS: "-Dwarnings"
jobs:
cargo_format:
name: cargo fmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
# Ensure rustfmt is installed and setup problem matcher
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: rustfmt
- name: Rustfmt Check
uses: actions-rust-lang/rustfmt@v1
clippy_check:
name: cargo clippy
container: fedora:latest
runs-on: ubuntu-latest
steps:
- name: Install system packages
run: |
microdnf -y install --nodocs --setopt=install_weak_deps=0 \
@development-tools @rpm-development-tools rpkg git nodejs rustup \
'dnf5-command(builddep)' 'dnf5-command(copr)'
# It is necessary to checkout into sub-directory, because of some weird ownership problems cause by using containers
- name: Check out sources
uses: actions/checkout@v5
with:
fetch-depth: 0
path: swayosd
- name: Copy spec into root dir
run: |
cd swayosd
cp ./build-scripts/swayosd-git.rpkg.spec ./
- name: Generate spec
run: |
cd swayosd
mkdir specs -p
rpkg spec --source --outdir specs
- name: Install build dependencies
run: |
cd swayosd
microdnf -y builddep ./specs/swayosd-git.rpkg.spec
rustup-init -y --default-toolchain nightly
- name: Run Clippy
run: |
cd swayosd
cargo clippy --all-targets --all-features
|