Continuous Integration #537
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 | |
pull_request: | |
branches: | |
- master | |
schedule: | |
- cron: "0 0 * * 0" | |
jobs: | |
test: | |
name: Test | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
build: [linux-gnu, linux-musl, win-gnu, win-msvc, win32-msvc, macos] | |
include: | |
- build: linux-gnu | |
os: ubuntu-20.04 | |
target: x86_64-unknown-linux-gnu | |
- build: linux-musl | |
os: ubuntu-20.04 | |
target: x86_64-unknown-linux-musl | |
- build: win-gnu | |
os: windows-2019 | |
target: x86_64-pc-windows-gnu | |
- build: win-msvc | |
os: windows-2019 | |
target: x86_64-pc-windows-msvc | |
- build: win32-msvc | |
os: windows-2019 | |
target: i686-pc-windows-msvc | |
- build: macos | |
os: macos-10.15 | |
target: x86_64-apple-darwin | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@master | |
- name: Install dependencies (linux) | |
if: matrix.os == 'ubuntu-20.04' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y --no-install-recommends \ | |
--allow-unauthenticated xvfb libx11-dev libxrandr-dev | |
- name: Install Rust toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
target: ${{ matrix.target }} | |
override: true | |
- name: Cache Cargo dependencies | |
uses: Swatinem/rust-cache@v1 | |
- name: Check the project files | |
uses: actions-rs/cargo@v1 | |
with: | |
command: check | |
args: --locked | |
- name: Check the lints | |
uses: actions-rs/cargo@v1 | |
with: | |
command: clippy | |
args: --tests --verbose -- -D warnings | |
- name: Run tests (macos/windows) | |
if: matrix.os == 'macos-10.15' || matrix.os == 'windows-2019' | |
run: | | |
cargo test --verbose --features test-ws | |
- name: Install cargo-tarpaulin (linux) | |
if: matrix.os == 'ubuntu-20.04' | |
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 (linux) | |
if: matrix.os == 'ubuntu-20.04' | |
run: | | |
xvfb-run --server-args="-screen 0 1920x1080x24" \ | |
cargo tarpaulin -o Xml -v --features test-ws -- --test-threads 1 | |
- name: Upload reports to Codecov (linux) | |
if: matrix.build == 'linux-gnu' | |
uses: codecov/[email protected] | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: cobertura.xml | |
flags: unit-tests | |
name: code-coverage-report | |
fail_ci_if_error: true | |
rustfmt: | |
name: Format | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@master | |
- name: Install Rust toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
profile: minimal | |
components: rustfmt | |
- name: Check the formatting | |
uses: actions-rs/cargo@v1 | |
with: | |
command: fmt | |
args: -- --check --verbose | |
lychee: | |
name: Check the links | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@master | |
- name: Link Checker | |
uses: lycheeverse/lychee-action@v1 | |
with: | |
args: --exclude "twitter.com|crates.io|aur.archlinux.org/(.+?).git|patreon.com|mailto:+|%7Busername%7D" -v *.md | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |