Continuous Integration #676
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: Continuous Integration | |
on: | |
push: | |
branches: | |
- master | |
- staging # for bors | |
- trying # for bors | |
pull_request: | |
branches: | |
- master | |
schedule: | |
- cron: "0 0 * * 0" | |
jobs: | |
build: | |
name: Build for ${{ matrix.TARGET }} using Rust ${{ matrix.TOOLCHAIN }} (on ${{ matrix.OS }}) | |
runs-on: ${{ matrix.OS }} | |
strategy: | |
fail-fast: false | |
matrix: | |
OS: [ ubuntu-22.04 ] | |
TOOLCHAIN: [ stable, nightly ] | |
TARGET: | |
- x86_64-unknown-linux-gnu | |
- x86_64-unknown-linux-musl | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install --allow-unauthenticated -y -qq \ | |
libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev musl-tools | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ matrix.TOOLCHAIN }} | |
target: ${{ matrix.TARGET }} | |
override: true | |
components: rustfmt, clippy | |
- name: Build | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --target ${{ matrix.TARGET }} | |
- name: Check formatting | |
uses: actions-rs/cargo@v1 | |
with: | |
command: fmt | |
args: --all -- --check | |
- name: Check lints | |
if: matrix.TOOLCHAIN == 'stable' | |
uses: actions-rs/cargo@v1 | |
with: | |
command: clippy | |
args: -- -D warnings | |
- name: Setup cargo-tarpaulin | |
if: matrix.TARGET == 'x86_64-unknown-linux-gnu' | |
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 | |
if: matrix.TARGET == 'x86_64-unknown-linux-gnu' | |
run: cargo tarpaulin --out Xml --verbose --target ${{ matrix.TARGET }} | |
- name: Upload reports to codecov.io | |
if: github.event_name != 'pull_request' && matrix.TOOLCHAIN == 'stable' && matrix.TARGET == 'x86_64-unknown-linux-gnu' | |
uses: codecov/codecov-action@v3.1.4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: cobertura.xml | |
flags: unittests | |
name: code-coverage-report | |
fail_ci_if_error: true |