Skip to content

Continuous Integration #825

Continuous Integration

Continuous Integration #825

Workflow file for this run

name: Continuous Integration
on:
pull_request:
push:
branches:
- main
- staging # for bors
- trying # for bors
schedule:
- cron: "0 0 * * 0"
jobs:
build:
name: Build (${{ matrix.TARGET }})
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
TOOLCHAIN: [nightly]
TARGET:
- x86_64-unknown-linux-gnu
- x86_64-unknown-linux-musl
- i686-unknown-linux-gnu
- i686-unknown-linux-musl
- aarch64-unknown-linux-gnu
- aarch64-unknown-linux-musl
- armv5te-unknown-linux-gnueabi
- armv7-unknown-linux-gnueabihf
- arm-unknown-linux-gnueabi
- arm-unknown-linux-gnueabihf
- riscv64gc-unknown-linux-gnu
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.TOOLCHAIN }}
targets: ${{ matrix.TARGET }}
- name: Cache Cargo dependencies
uses: Swatinem/rust-cache@v2
- name: Build
uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --locked --target ${{ matrix.TARGET }} --no-default-features
test:
name: Test
runs-on: ubuntu-22.04
steps:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
--no-install-recommends \
--allow-unauthenticated \
linux-doc \
libxcb-shape0-dev \
libxcb-xfixes0-dev \
libxkbcommon-dev
- name: Checkout the repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache Cargo dependencies
uses: Swatinem/rust-cache@v2
- name: Setup cargo-tarpaulin
uses: taiki-e/install-action@cargo-tarpaulin
- name: Run tests [default]
run: |
NO_COLOR=1 cargo tarpaulin \
--no-default-features \
--out xml --verbose
mv cobertura.xml test-output.xml
- name: Run tests [live]
run: |
cp .github/fixtures/sysctl.conf systeroid/
sudo env "PATH=$PATH" "HOME=$HOME" NO_COLOR=1 \
cargo tarpaulin \
--no-default-features \
--features live-tests \
--out xml --verbose \
-- "test_systeroid"
./.github/fixtures/check_vars.sh systeroid/sysctl.conf
mv cobertura.xml live-test-output.xml
- name: Upload reports to codecov
uses: codecov/codecov-action@v3
with:
name: code-coverage-report
files: test-output.xml,live-test-output.xml
flags: unit-tests
fail_ci_if_error: true
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}
lint:
name: Lint
runs-on: ubuntu-22.04
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Run shellcheck
uses: ludeeus/action-shellcheck@master
with:
scandir: "./scripts"
env:
SHELLCHECK_OPTS: -e SC2086
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Check formatting
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
- name: Run clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --tests -- -D warnings
- name: Run cargo-deny
uses: EmbarkStudios/cargo-deny-action@v1
with:
command: check licenses sources
- name: Run cargo-msrv
shell: bash
run: |
curl -s 'https://api.github.com/repos/foresterre/cargo-msrv/releases' | \
jq -r "[.[] | select(.prerelease == false)][0].assets[] | select(.name | ascii_downcase | test(\"linux.*x86_64|x86_64.*linux\")).browser_download_url" | \
wget -qi -
tar -xvf cargo-msrv*.tar* -C ~/.cargo/bin/ cargo-msrv
for package in $(cargo metadata --format-version 1 | jq -r ".workspace_members[]" | awk '{print $1}'); do
printf "Checking MSRV for $package..."
cargo msrv --output-format json --path "$package" verify | tail -n 1 | jq --exit-status '.success'
done
- name: Run cargo-audit
uses: actions-rs/audit-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Run lychee
uses: lycheeverse/lychee-action@v1
with:
args: --exclude "repology.org|patreon.com" -v *.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}