summaryrefslogtreecommitdiff
path: root/.github/workflows/codecov.yml
blob: 6f4317a29824930498939d3e75d522056ec86971 (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
112
113
114
115
116
117
118
119
120
121
name: "Code coverage"

on:
  pull_request:
  push:

jobs:
  skip_duplicates:
    continue-on-error: true
    runs-on: ubuntu-latest
    outputs:
      should_skip: ${{ steps.skip_check.outputs.should_skip }}
    steps:
      - id: skip_check
        # pin to unreleased SHA so we can use 'same_content_newer'
        # see https://github.com/fkirc/skip-duplicate-actions/pull/112
        uses: fkirc/skip-duplicate-actions@98d1dc89f43a47f8e4fba8e1c1fb8d6c5fc515ee
        with:
          concurrent_skipping: 'same_content_newer'
          skip_after_successful_duplicate: 'true'
          paths_ignore: '["doc/**", "**/*.md", "AUTHORS", "NEWS", "THANKS"]'
          do_not_skip: '["workflow_dispatch", "schedule"]'

  O0-Buildflags:
    needs: skip_duplicates
    if: ${{ needs.skip_duplicates.outputs.should_skip != 'true' }}

    runs-on: ubuntu-latest

    strategy:
      fail-fast: false
      matrix:
        compiler: [gcc, clang]
        config_opts:
          - "--enable-obsolete-api --enable-hashes=all --enable-failure-tokens"
          - "--enable-obsolete-api --enable-obsolete-api-enosys --enable-hashes=all --enable-failure-tokens"
          - "--disable-obsolete-api --enable-hashes=all --enable-failure-tokens"
          # --enable-hashes=strong can only be used with --disable-obsolete-api
          - "--disable-obsolete-api --enable-failure-tokens --enable-hashes=strong"
          # failure tokens only affect the generic code so there's no point
          # testing with all of the hashes; use descrypt only, to get coverage
          # of the --enable-obsolete-api code in this mode, and to get coverage
          # of an "only one hash enabled" configuration.
          - "--enable-obsolete-api --disable-failure-tokens --enable-hashes=descrypt"

    env:
      CC: ${{ matrix.compiler }}
      CONFIG_OPTS: ${{ matrix.config_opts }}
      CFLAGS: "-O0 -g -fprofile-arcs -ftest-coverage"
      CXXFLAGS: "-O0 -g -fprofile-arcs -ftest-coverage"
      LDFLAGS: "--coverage"
      VERBOSE: 1

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

    - name: Install packages
      run: |
        packages="lcov"
        if [ "$CC" = clang ]; then
          # need 'llvm' for llvm-cov, as well as clang
          packages="$packages clang llvm"
        fi
        sudo apt-get install $packages

    - name: Versions of build tools
      id: build-tools
      run: ./build-aux/ci-log-dependency-versions

    - name: Cache bootstrap
      id: cache
      uses: actions/cache@v2
      with:
        path: |
          INSTALL
          Makefile.in
          aclocal.m4
          config.h.in
          configure
          autom4te.cache/**
          build-aux/compile
          build-aux/config.guess
          build-aux/config.sub
          build-aux/depcomp
          build-aux/install-sh
          build-aux/libtool.m4
          build-aux/ltmain.sh
          build-aux/ltoptions.m4
          build-aux/ltsugar.m4
          build-aux/ltversion.m4
          build-aux/lt~obsolete.m4
          build-aux/missing
          build-aux/test-driver
        key: autoreconf-${{ steps.build-tools.outputs.autotools-ver }}-${{ hashFiles('autogen.sh', 'configure.ac', 'Makefile.am', 'build-aux/*.m4') }}

    - name: Bootstrap
      if: steps.cache.outputs.cache-hit != 'true'
      run: ./autogen.sh

    - name: Configure
      run: ./configure $CONFIG_OPTS

    - name: Build
      run: make all test-programs

    - name: Test
      run: make check

    - name: Summarize coverage data
      run: ./build-aux/summarize-coverage coverage.info

    - name: Upload coverage data to Codecov
      uses: codecov/codecov-action@v2
      with:
        fail_ci_if_error: true
        files: coverage.info

    - name: Detailed error logs
      if: failure()
      run: ./build-aux/ci-log-logfiles