2021-05-13 02:53:27 +03:00
|
|
|
name: Continuous Integration
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
2021-05-30 14:25:13 +03:00
|
|
|
- main
|
2021-05-13 02:53:27 +03:00
|
|
|
pull_request:
|
|
|
|
branches:
|
2021-05-30 14:25:13 +03:00
|
|
|
- main
|
2021-10-15 21:25:15 +03:00
|
|
|
schedule:
|
|
|
|
- cron: "0 0 * * 0"
|
2021-05-13 02:53:27 +03:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
check:
|
|
|
|
name: Check
|
2023-04-04 22:42:06 +03:00
|
|
|
runs-on: ubuntu-22.04
|
2021-05-13 02:53:27 +03:00
|
|
|
steps:
|
|
|
|
- name: Install toolchain
|
2023-04-07 21:29:42 +03:00
|
|
|
uses: dtolnay/rust-toolchain@stable
|
2021-05-13 02:53:27 +03:00
|
|
|
- name: Checkout
|
2022-12-22 15:56:03 +03:00
|
|
|
uses: actions/checkout@v3
|
2021-05-13 02:53:27 +03:00
|
|
|
- name: Check
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: check
|
|
|
|
args: --locked --verbose
|
|
|
|
|
|
|
|
test:
|
|
|
|
name: Test suite
|
2023-04-04 22:42:06 +03:00
|
|
|
runs-on: ubuntu-22.04
|
2021-05-13 02:53:27 +03:00
|
|
|
steps:
|
|
|
|
- name: Install toolchain
|
2023-04-07 21:29:42 +03:00
|
|
|
uses: dtolnay/rust-toolchain@nightly
|
2021-05-13 02:53:27 +03:00
|
|
|
- name: Checkout
|
2022-02-20 17:26:11 +03:00
|
|
|
if: github.event_name != 'pull_request'
|
2022-12-22 15:56:03 +03:00
|
|
|
uses: actions/checkout@v3
|
2021-05-15 03:01:12 +03:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2022-02-20 17:26:11 +03:00
|
|
|
- name: Checkout
|
|
|
|
if: github.event_name == 'pull_request'
|
2022-12-22 15:56:03 +03:00
|
|
|
uses: actions/checkout@v3
|
2022-02-20 17:26:11 +03:00
|
|
|
with:
|
|
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
|
|
|
fetch-depth: 0
|
2022-09-24 22:19:46 +03:00
|
|
|
- name: Setup cargo-tarpaulin
|
2021-05-24 18:33:24 +03:00
|
|
|
run: |
|
2022-09-24 22:19:46 +03:00
|
|
|
curl -s https://api.github.com/repos/xd009642/tarpaulin/releases/latest | \
|
2023-01-25 18:14:02 +03:00
|
|
|
grep "browser_download_url.*x86_64-unknown-linux-musl.tar.gz" | cut -d : -f 2,3 | tr -d \" | wget -qi -
|
2022-09-24 22:19:46 +03:00
|
|
|
tar -xzf cargo-tarpaulin-*.tar.gz
|
|
|
|
mv cargo-tarpaulin ~/.cargo/bin/
|
|
|
|
- name: Run tests
|
|
|
|
run: cargo tarpaulin --out Xml --verbose
|
|
|
|
- name: Upload reports to codecov
|
|
|
|
uses: codecov/codecov-action@v3
|
|
|
|
with:
|
|
|
|
name: code-coverage-report
|
|
|
|
file: cobertura.xml
|
|
|
|
flags: unit-tests
|
|
|
|
fail_ci_if_error: true
|
|
|
|
verbose: true
|
2021-05-24 18:43:42 +03:00
|
|
|
|
2021-05-13 02:53:27 +03:00
|
|
|
clippy:
|
|
|
|
name: Lints
|
2023-04-04 22:42:06 +03:00
|
|
|
runs-on: ubuntu-22.04
|
2021-05-13 02:53:27 +03:00
|
|
|
steps:
|
|
|
|
- name: Install toolchain
|
2023-04-07 21:29:42 +03:00
|
|
|
uses: dtolnay/rust-toolchain@nightly
|
2021-05-13 02:53:27 +03:00
|
|
|
with:
|
|
|
|
components: clippy
|
|
|
|
- name: Checkout
|
2022-12-22 15:56:03 +03:00
|
|
|
uses: actions/checkout@v3
|
2021-05-13 02:53:27 +03:00
|
|
|
- name: Check the lints
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: clippy
|
2022-08-12 12:51:38 +03:00
|
|
|
args: --tests --verbose -- -D warnings
|
2021-05-13 02:53:27 +03:00
|
|
|
|
|
|
|
rustfmt:
|
|
|
|
name: Formatting
|
2023-04-04 22:42:06 +03:00
|
|
|
runs-on: ubuntu-22.04
|
2021-05-13 02:53:27 +03:00
|
|
|
steps:
|
|
|
|
- name: Install toolchain
|
2023-04-07 21:29:42 +03:00
|
|
|
uses: dtolnay/rust-toolchain@nightly
|
2021-05-13 02:53:27 +03:00
|
|
|
with:
|
|
|
|
components: rustfmt
|
|
|
|
- name: Checkout
|
2022-12-22 15:56:03 +03:00
|
|
|
uses: actions/checkout@v3
|
2021-05-13 02:53:27 +03:00
|
|
|
- name: Check the formatting
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: fmt
|
2021-05-13 21:28:42 +03:00
|
|
|
args: --all -- --check --verbose
|
2021-05-13 02:53:27 +03:00
|
|
|
|
|
|
|
lychee:
|
|
|
|
name: Links
|
2023-04-04 22:42:06 +03:00
|
|
|
runs-on: ubuntu-22.04
|
2021-05-13 02:53:27 +03:00
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2022-12-22 15:56:03 +03:00
|
|
|
uses: actions/checkout@v3
|
2021-05-13 02:53:27 +03:00
|
|
|
- name: Check the links
|
|
|
|
uses: lycheeverse/lychee-action@v1
|
2021-06-29 02:11:30 +03:00
|
|
|
with:
|
2023-04-09 18:08:59 +03:00
|
|
|
args: >
|
|
|
|
--exclude "%7Busername%7D|file:///|https://datatracker.ietf.org|protonmail"
|
2023-04-09 18:16:31 +03:00
|
|
|
-v *.md website/docs/* website/blog/*
|
2021-05-13 02:53:27 +03:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2022-02-12 22:02:26 +03:00
|
|
|
|
|
|
|
audit:
|
|
|
|
name: Audit check
|
2023-04-04 22:42:06 +03:00
|
|
|
runs-on: ubuntu-22.04
|
2022-02-12 22:02:26 +03:00
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2022-12-22 15:56:03 +03:00
|
|
|
uses: actions/checkout@v3
|
2022-02-12 22:02:26 +03:00
|
|
|
- name: Run cargo-audit
|
|
|
|
uses: actions-rs/audit-check@v1
|
|
|
|
with:
|
|
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
2023-04-28 14:27:35 +03:00
|
|
|
|
|
|
|
msrv:
|
|
|
|
name: Check Rust version
|
|
|
|
runs-on: ubuntu-22.04
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
- 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
|