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@v3
12      with:
13        ref: ${{ github.event.pull_request.head.sha }}
14    - name: Install dependencies
15      run: |
16        sudo apt-get update
17        sudo apt-get -qq upgrade
18        sudo xargs --arg-file=${{ github.workspace }}/.github/workflows/build-dependencies.txt apt-get install -qq
19        sudo xargs --arg-file=${{ github.workspace }}/.github/workflows/checkstyle-dependencies.txt apt-get install -qq
20        sudo python3 -m pip install --quiet flake8
21        sudo apt-get clean
22
23        # confirm that the tools are installed
24        # the build system doesn't fail when they are not
25        checkbashisms --version
26        cppcheck --version
27        flake8 --version
28        scanelf --version
29        shellcheck --version
30    - name: Prepare
31      run: |
32        ./autogen.sh
33        ./configure
34        make -j$(nproc) --no-print-directory --silent
35    - name: Checkstyle
36      run: |
37        make -j$(nproc) --no-print-directory --silent checkstyle
38    - name: Lint
39      run: |
40        make -j$(nproc) --no-print-directory --silent lint
41    - name: CheckABI
42      id: CheckABI
43      run: |
44        docker run -v $PWD:/source ghcr.io/openzfs/libabigail make -j$(nproc) --no-print-directory --silent checkabi
45    - name: StoreABI
46      if: failure() && steps.CheckABI.outcome == 'failure'
47      run: |
48        docker run -v $PWD:/source ghcr.io/openzfs/libabigail make -j$(nproc) --no-print-directory --silent storeabi
49    - name: Prepare artifacts
50      if: failure() && steps.CheckABI.outcome == 'failure'
51      run: |
52        find -name *.abi | tar -cf abi_files.tar -T -
53    - uses: actions/upload-artifact@v3
54      if: failure() && steps.CheckABI.outcome == 'failure'
55      with:
56        name: New ABI files (use only if you're sure about interface changes)
57        path: abi_files.tar
58