xref: /freebsd/sys/contrib/openzfs/.github/workflows/checkstyle.yaml (revision b64c5a0ace59af62eff52bfe110a521dc73c937b)
1name: checkstyle
2
3on:
4  push:
5  pull_request:
6
7concurrency:
8  group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
9  cancel-in-progress: true
10
11jobs:
12  checkstyle:
13    runs-on: ubuntu-22.04
14    steps:
15    - uses: actions/checkout@v4
16      with:
17        ref: ${{ github.event.pull_request.head.sha }}
18    - name: Install dependencies
19      run: |
20        # for x in lxd core20 snapd; do sudo snap remove $x; done
21        sudo apt-get purge -y snapd google-chrome-stable firefox
22        ONLY_DEPS=1 .github/workflows/scripts/qemu-3-deps.sh ubuntu22
23        sudo apt-get install -y cppcheck devscripts mandoc pax-utils shellcheck
24        sudo python -m pipx install --quiet flake8
25        # confirm that the tools are installed
26        # the build system doesn't fail when they are not
27        checkbashisms --version
28        cppcheck --version
29        flake8 --version
30        scanelf --version
31        shellcheck --version
32    - name: Prepare
33      run: |
34        sed -i '/DEBUG_CFLAGS="-Werror"/s/^/#/' config/zfs-build.m4
35        ./autogen.sh
36    - name: Configure
37      run: |
38        ./configure
39    - name: Make
40      run: |
41        make -j$(nproc) --no-print-directory --silent
42    - name: Checkstyle
43      run: |
44        make -j$(nproc) --no-print-directory --silent checkstyle
45    - name: Lint
46      run: |
47        make -j$(nproc) --no-print-directory --silent lint
48    - name: CheckABI
49      id: CheckABI
50      run: |
51        docker run -v $PWD:/source ghcr.io/openzfs/libabigail make -j$(nproc) --no-print-directory --silent checkabi
52    - name: StoreABI
53      if: failure() && steps.CheckABI.outcome == 'failure'
54      run: |
55        docker run -v $PWD:/source ghcr.io/openzfs/libabigail make -j$(nproc) --no-print-directory --silent storeabi
56    - name: Prepare artifacts
57      if: failure() && steps.CheckABI.outcome == 'failure'
58      run: |
59        find -name *.abi | tar -cf abi_files.tar -T -
60    - uses: actions/upload-artifact@v4
61      if: failure() && steps.CheckABI.outcome == 'failure'
62      with:
63        name: New ABI files (use only if you're sure about interface changes)
64        path: abi_files.tar
65