Skip to content

Some general improvements #1123

Some general improvements

Some general improvements #1123

Workflow file for this run

name: Build
on:
pull_request:
push:
branches:
- master
jobs:
lints:
name: Lints
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
# Cache dependencies
- uses: Swatinem/rust-cache@v2
with:
key: lint-ci
- name: Install dependencies
run: |
sudo apt update && sudo apt install -y libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev
shell: bash
- name: Run cargo fmt
run: cargo fmt --all -- --check
- name: Run cargo clippy
run: cargo clippy -- -D warnings
test:
name: Build debug artifacts
strategy:
matrix:
build: [x86_64-linux, aarch64-linux, x86_64-macos, x86_64-win-gnu]
include:
- build: x86_64-linux
os: ubuntu-20.04
target: x86_64-unknown-linux-gnu
- build: aarch64-linux
os: ubuntu-20.04
target: aarch64-unknown-linux-gnu
- build: x86_64-macos
os: macos-latest
target: x86_64-apple-darwin
- build: x86_64-win-gnu
os: windows-2019
target: x86_64-pc-windows-gnu
runs-on: ${{ matrix.os }}
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
with:
target: ${{ matrix.target }}
# Cache dependencies
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Install cross for arm64 compilation
if: matrix.build == 'aarch64-linux'
run: cargo install cross --git https://github.com/cross-rs/cross
- name: Install Dependencies for Linux x86_64
if: matrix.build == 'x86_64-linux'
run: sudo apt update && sudo apt install -y libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev
- name: Run tests (arm64)
if: matrix.build == 'aarch64-linux'
run: cross test --locked --target ${{ matrix.target }}
- name: Build debug binary (arm64)
if: matrix.build == 'aarch64-linux'
run: cross build --locked --target ${{ matrix.target }}
- name: Run tests (x86_64)
if: matrix.build != 'aarch64-linux'
run: cargo test
- name: Build debug binary (x86_64)
if: matrix.build != 'aarch64-linux'
run: cargo build
- uses: actions/[email protected]
with:
name: bins-${{ matrix.build }}
# Two paths, the first for x86_64 jobs, the second for aarch64.
# No need to dispatch, if the path is not found we continue normally
path: |
target/debug/cotp*
target/aarch64-unknown-linux-gnu/debug/cotp*
if-no-files-found: error