summaryrefslogtreecommitdiff
path: root/.github/workflows/pigz.yml
blob: 8260c82fb7663b080e3b2718d3759c1e2794d1e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
name: CI Pigz
on: [push, pull_request]
jobs:
  ci-cmake:
    name: ${{ matrix.name }}
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        include:
          - name: Ubuntu GCC
            os: ubuntu-latest
            compiler: gcc
            codecov: ubuntu_gcc_pigz

          - name: Ubuntu Clang
            os: ubuntu-latest
            compiler: clang
            packages: llvm-11-tools
            gcov-exec: llvm-cov-11 gcov
            codecov: ubuntu_clang_pigz

          - name: Ubuntu Clang No Optim
            os: ubuntu-latest
            compiler: clang
            packages: llvm-11-tools
            gcov-exec: llvm-cov-11 gcov
            codecov: ubuntu_clang_pigz_no_optim
            cmake-args: -DWITH_OPTIM=OFF

          - name: Ubuntu Clang No Threads
            os: ubuntu-latest
            compiler: clang
            packages: llvm-11-tools
            gcov-exec: llvm-cov-11 gcov
            codecov: ubuntu_clang_pigz_no_threads
            cmake-args: -DWITH_THREADS=OFF

          - name: Ubuntu GCC AARCH64
            os: ubuntu-latest
            compiler: aarch64-linux-gnu-gcc
            cmake-args: -DCMAKE_TOOLCHAIN_FILE=../../cmake/toolchain-aarch64.cmake
            packages: qemu qemu-user gcc-aarch64-linux-gnu libc-dev-arm64-cross
            qemu-run: qemu-aarch64
            codecov: ubuntu_gcc_pigz_aarch64

    steps:
    - name: Checkout repository
      uses: actions/checkout@v2

    - name: Checkout test corpora
      uses: actions/checkout@v2
      with:
        repository: zlib-ng/corpora
        path: test/data/corpora

    - name: Install packages (Ubuntu)
      if: runner.os == 'Linux' && matrix.packages
      run: |
        sudo apt-get update
        sudo apt-get install -y ${{ matrix.packages }}

    - name: Install codecov.io tools
      if: matrix.codecov
      run: |
        python -u -m pip install codecov

    - name: Generate project files
      run: |
        cd test/pigz
        cmake ${{ matrix.cmake-args }} -DCMAKE_BUILD_TYPE=${{ matrix.build-config || 'Release' }} -DBUILD_SHARED_LIBS=OFF -DZLIB_ROOT=../.. -DWITH_CODE_COVERAGE=ON -DWITH_MAINTAINER_WARNINGS=ON
      env:
        CC: ${{ matrix.compiler }}
        CFLAGS: ${{ matrix.cflags }}
        LDFLAGS: ${{ matrix.ldflags }}
        CI: true

    - name: Compile source code
      run: |
        cd test/pigz
        cmake --build . --config ${{ matrix.build-config || 'Release' }}

    - name: Run test cases
      run: |
        cd test/pigz
        ctest --verbose -C Release --output-on-failure --max-width 120 -j ${{ matrix.parallels-jobs || '2' }}

    - name: Upload coverage report
      if: matrix.codecov && ( env.CODECOV_TOKEN_SECRET != '' || github.repository == 'zlib-ng/zlib-ng' )
      shell: bash
      run: |
        bash tools/codecov-upload.sh
      env:
        # Codecov does not yet support GitHub Actions
        CODECOV_TOKEN_SECRET: "${{secrets.CODECOV_TOKEN}}"
        CODECOV_TOKEN: "${{ secrets.CODECOV_TOKEN || 'e4fdf847-f541-4ab1-9d50-3d27e5913906' }}"
        CODECOV_FLAGS: "${{ matrix.codecov }}"
        CODECOV_NAME:  "${{ matrix.name }}"
        CODECOV_EXEC:  "${{ matrix.gcov-exec || 'gcov' }}"
        CODECOV_DIR:   "."

    - name: Upload build errors
      uses: actions/upload-artifact@v2
      if: failure()
      with:
        name: ${{ matrix.name }} (cmake)
        path: |
          **/CMakeFiles/CMakeOutput.log
          **/CMakeFiles/CMakeError.log
          **/Testing/Temporary/*
        retention-days: 30