| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- # SPDX-FileCopyrightText: 2024 Christina Sørensen
- # SPDX-License-Identifier: EUPL-1.2
- name: Unit tests
- on:
- push:
- branches: [main]
- pull_request:
- branches: [main]
- workflow_dispatch:
- concurrency:
- group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
- cancel-in-progress: true
- env:
- CARGO_TERM_COLOR: always
- RUSTFLAGS: --deny warnings
- jobs:
- no-merge-commits:
- runs-on: ubuntu-latest
- steps:
- - name: Checkout
- uses: actions/checkout@v4
- - name: Run test
- uses: NexusPHP/no-merge-commits@v2.1.0
- with:
- token: ${{ secrets.GITHUB_TOKEN }}
- conventional:
- needs: no-merge-commits
- name: Conventional Commits
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v4
- - uses: webiny/action-conventional-commits@v1.3.0
- unit-tests:
- needs: conventional
- runs-on: ${{ matrix.os }}
- continue-on-error: ${{ matrix.rust == 'nightly' }}
- strategy:
- matrix:
- os: [ubuntu-latest, macos-latest, windows-latest]
- rust: [1.70.0, stable, beta, nightly]
- steps:
- - name: Checkout repository
- uses: actions/checkout@v4
- - run: rustup toolchain install ${{ matrix.rust }} --profile minimal
- - uses: Swatinem/rust-cache@v2
- - name: Install cargo-hack
- uses: nick-fields/retry@v3
- with:
- timeout_minutes: 5
- max_attempts: 5
- command: cargo install cargo-hack
- - name: Run rustfmt checks
- run: cargo fmt --check
- - name: Run clippy lints
- if: ${{ matrix.os != 'windows-latest' }}
- run: cargo clippy -- -D warnings
- - name: Run unit tests
- run: cargo hack test
- flake-check:
- needs: conventional
- name: Check Nix Flake
- runs-on: ubuntu-latest
- strategy:
- matrix:
- checks: [build, formatting, lint, pre-commit-check, test, trycmd]
- target: [x86_64-linux]
- steps:
- - uses: actions/checkout@v4
- - name: Install Nix
- uses: DeterminateSystems/nix-installer-action@v16
- - name: Setup Nix cache
- uses: DeterminateSystems/magic-nix-cache-action@main
- - name: Nix Flake Check
- run: nix build .#checks.${{ matrix.target }}.${{ matrix.checks }} -L
- flake-build:
- needs: conventional
- name: Build Nix package
- # if cross compilation is desired add 'aarch64-linux', 'x86_64-darwin' and 'aarch64-darwin' and fix the flake to support cross compilation.
- strategy:
- matrix:
- target: [x86_64-linux]
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v4
- - name: Install Nix
- uses: DeterminateSystems/nix-installer-action@v16
- - name: Setup Nix cache
- uses: DeterminateSystems/magic-nix-cache-action@main
- - name: Nix Build
- run: nix build .#packages.${{ matrix.target }}.default -L
|