fork/eza

git clone https://git.julia.blue/fork/eza

Yonas Yanfachore: Upgrade FreeBSD to 14.3-RELEASE in unit tests workflow1d94be11

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