1name: checkstyle
2
3on:
4  push:
5  pull_request:
6
7jobs:
8  checkstyle:
9    runs-on: ubuntu-22.04
10    steps:
11    - uses: actions/checkout@v4
12      with:
13        ref: ${{ github.event.pull_request.head.sha }}
14    - name: Install dependencies
15      run: |
16        # https://github.com/orgs/community/discussions/47863
17        sudo apt-mark hold grub-efi-amd64-signed
18        sudo apt-get update --fix-missing
19        sudo apt-get upgrade
20        sudo xargs --arg-file=${{ github.workspace }}/.github/workflows/build-dependencies.txt apt-get install -qq
21        sudo xargs --arg-file=${{ github.workspace }}/.github/workflows/checkstyle-dependencies.txt apt-get install -qq
22        sudo python3 -m pip install --quiet flake8
23        sudo apt-get clean
24
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        ./autogen.sh
35        ./configure
36        make -j$(nproc) --no-print-directory --silent
37    - name: Checkstyle
38      run: |
39        make -j$(nproc) --no-print-directory --silent checkstyle
40    - name: Lint
41      run: |
42        make -j$(nproc) --no-print-directory --silent lint
43    - name: CheckABI
44      id: CheckABI
45      run: |
46        docker run -v $PWD:/source ghcr.io/openzfs/libabigail make -j$(nproc) --no-print-directory --silent checkabi
47    - name: StoreABI
48      if: failure() && steps.CheckABI.outcome == 'failure'
49      run: |
50        docker run -v $PWD:/source ghcr.io/openzfs/libabigail make -j$(nproc) --no-print-directory --silent storeabi
51    - name: Prepare artifacts
52      if: failure() && steps.CheckABI.outcome == 'failure'
53      run: |
54        find -name *.abi | tar -cf abi_files.tar -T -
55    - uses: actions/upload-artifact@v4
56      if: failure() && steps.CheckABI.outcome == 'failure'
57      with:
58        name: New ABI files (use only if you're sure about interface changes)
59        path: abi_files.tar
60