fork/eza
git clone https://git.julia.blue/fork/eza
1d94be11
main
1# SPDX-FileCopyrightText: 2024 Christina Sørensen 2# SPDX-License-Identifier: EUPL-1.2 3name : Unit tests 4on : 5push : 6branches : [ main ] 7pull_request : 8branches : [ main ] 9workflow_dispatch : 10concurrency : 11group : ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} 12cancel-in-progress : true 13env : 14CARGO_TERM_COLOR : always 15RUSTFLAGS : --deny warnings 16msrv : 1.78 17jobs : 18security_audit : 19runs-on : ubuntu-latest 20steps : 21- uses : actions/checkout@v4 22- uses : taiki-e/install-action@cargo-deny 23- name : Scan for vulnerabilities 24run : cargo deny check 25check_if_pr : 26runs-on : ubuntu-latest 27outputs : 28is_pr : ${{ steps.check.outputs.is_pr }} 29steps : 30- name : Check if it's a PR 31id : check 32run : | 33if [ "${{ github.event_name }}" == "pull_request" ]; then 34echo "is_pr=true" >> $GITHUB_OUTPUT 35else 36echo "is_pr=false" >> $GITHUB_OUTPUT 37fi 38no-merge-commits : 39needs : check_if_pr 40if : needs.check_if_pr.outputs.is_pr == 'true' 41runs-on : ubuntu-latest 42steps : 43- name : Checkout 44uses : actions/checkout@v4 45- name : Run test 46uses : NexusPHP/no-merge-commits@v2.2.1 47with : 48token : ${{ secrets.GITHUB_TOKEN }} 49conventional : 50needs : [ check_if_pr , no-merge-commits ] 51name : Conventional Commits 52runs-on : ubuntu-latest 53steps : 54- uses : actions/checkout@v4 55- uses : webiny/action-conventional-commits@v1.3.0 56unit-tests : 57needs : conventional 58runs-on : ${{ matrix.os }} 59continue-on-error : ${{ matrix.rust == 'nightly' }} 60strategy : 61matrix : 62os : [ ubuntu-latest , macos-latest , windows-latest ] 63rust : [ msrv , stable , beta , nightly ] 64steps : 65- name : Checkout repository 66uses : actions/checkout@v4 67- run : rustup toolchain install ${{ matrix.rust == 'msrv' && env.msrv || matrix.rust }} --profile minimal 68- uses : Swatinem/rust-cache@v2 69- name : Install cargo-hack 70uses : nick-fields/retry@v3 71with : 72timeout_minutes : 5 73max_attempts : 5 74command : cargo install cargo-hack 75- name : Run rustfmt checks 76run : cargo fmt --check 77- name : Run clippy lints 78if : ${{ matrix.os != 'windows-latest' }} 79run : cargo clippy -- -D warnings 80- name : Run unit tests 81run : cargo hack test 82unit-tests-freebsd : 83needs : conventional 84runs-on : ubuntu-22.04 85timeout-minutes : 20 86continue-on-error : ${{ matrix.rust == 'nightly' }} 87strategy : 88matrix : 89rust : [ msrv , stable , beta , nightly ] 90steps : 91- uses : actions/checkout@v4 92with : 93submodules : recursive 94- name : Compile 95uses : vmactions/freebsd-vm@v1 96with : 97release : '14.3' 98usesh : true 99prepare : | 100pkg install -y curl git 101curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain ${{ matrix.rust == 'msrv' && env.msrv || matrix.rust }} --profile minimal -y 102. ~/.cargo/env 103cargo install cargo-hack 104git config --global --add safe.directory /home/runner/work/eza/eza 105run : | 106set -e 107. ~/.cargo/env 108export CARGO_TERM_COLOR="always" 109export RUSTFLAGS="--deny warnings" 110cargo fmt --check 111cargo clippy -- -D warnings 112cargo hack test 113unit-tests-netbsd : 114needs : conventional 115runs-on : ubuntu-22.04 116timeout-minutes : 20 117continue-on-error : ${{ matrix.rust == 'nightly' }} 118strategy : 119matrix : 120rust : [ msrv , stable , beta , nightly ] 121steps : 122- uses : actions/checkout@v4 123with : 124submodules : recursive 125- name : Compile 126uses : vmactions/netbsd-vm@v1 127with : 128release : '10.1' 129usesh : true 130prepare : | 131PATH="/root/.cargo/bin:/usr/pkg/sbin:/usr/pkg/bin:$PATH" 132PKG_PATH="https://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/amd64/10.1/All/" 133export PATH PKG_PATH 134/usr/sbin/pkg_add curl git 135curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain ${{ matrix.rust == 'msrv' && env.msrv || matrix.rust }} --profile minimal -y 136. ~/.cargo/env 137cargo install cargo-hack 138git config --global --add safe.directory /home/runner/work/eza/eza 139run : | 140set -e 141. ~/.cargo/env 142export CARGO_TERM_COLOR="always" 143export RUSTFLAGS="--deny warnings" 144cargo fmt --check 145cargo clippy -- -D warnings 146cargo hack test 147unit-tests-openbsd : 148needs : conventional 149runs-on : ubuntu-22.04 150timeout-minutes : 20 151steps : 152- uses : actions/checkout@v4 153with : 154submodules : recursive 155- name : Compile 156uses : vmactions/openbsd-vm@v1 157with : 158release : '7.7' 159usesh : true 160prepare : | 161pkg_add rust rust-rustfmt rust-clippy git 162cargo install cargo-hack 163git config --global --add safe.directory /home/runner/work/eza/eza 164run : | 165set -e 166export CARGO_TERM_COLOR="always" 167export RUSTFLAGS="--deny warnings" 168cargo fmt --check 169cargo clippy -- -D warnings 170cargo hack test 171flake-check : 172needs : conventional 173name : Check Nix Flake 174runs-on : ubuntu-latest 175strategy : 176matrix : 177checks : [ build , formatting , lint , pre-commit-check , test , trycmd ] 178target : [ x86_64-linux ] 179steps : 180- uses : actions/checkout@v4 181- name : Install Nix 182uses : DeterminateSystems/nix-installer-action@v17 183- name : Nix Flake Check 184run : nix build .#checks.${{ matrix.target }}.${{ matrix.checks }} -L 185flake-build : 186needs : conventional 187name : Build Nix package 188# if cross compilation is desired add 'aarch64-linux', 'x86_64-darwin' and 'aarch64-darwin' and fix the flake to support cross compilation. 189strategy : 190matrix : 191target : [ x86_64-linux ] 192runs-on : ubuntu-latest 193steps : 194- uses : actions/checkout@v4 195- name : Install Nix 196uses : DeterminateSystems/nix-installer-action@v17 197- name : Nix Build 198run : nix build .#packages.${{ matrix.target }}.default -L