mirror of
https://github.com/orhun/systeroid
synced 2024-10-04 14:39:06 +00:00
19f4344f7a
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
173 lines
5 KiB
YAML
173 lines
5 KiB
YAML
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
|
|
shell: bash
|
|
run: |
|
|
curl -s https://api.github.com/repos/xd009642/tarpaulin/releases/latest | \
|
|
grep "browser_download_url.*x86_64-unknown-linux-musl.tar.gz" | cut -d : -f 2,3 | tr -d \" | wget -qi -
|
|
tar -xzf cargo-tarpaulin-*.tar.gz
|
|
mv cargo-tarpaulin ~/.cargo/bin/
|
|
|
|
- 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 }}
|