aboutsummaryrefslogtreecommitdiffstats
path: root/.github/workflows/coveralls.yml
blob: 34075a356608eb7bd734a453eb30b78fa42c5dc4 (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
122
123
124
125
126
127
128
129
# Copyright 2021-2026 The OpenSSL Project Authors. All Rights Reserved.
#
# Licensed under the Apache License 2.0 (the "License").  You may not use
# this file except in compliance with the License.  You can obtain a copy
# in the file LICENSE in the source distribution or at
# https://www.openssl.org/source/license.html

name: Coverage

on:
  schedule:
    - cron: '15 02 * * *'
  workflow_dispatch:
    inputs:
      branch:
        description: Branch to measure coverage
        required: true
        default: master
      extra_config:
        description: Extra options for configuration script
        default: ""

permissions:
  contents: read

jobs:
  define-matrix:
    runs-on: ubuntu-latest
    outputs:
      branches: ${{ steps.branches.outputs.branches }}
    steps:
      - name: Define branches
        id: branches
        env:
          GITHUB_EVENT_INPUTS_BRANCH: ${{ github.event.inputs.branch }}
          GITHUB_EVENT_INPUTS_EXTRA_CONFIG: ${{ github.event.inputs.extra_config }}
        run: |
          if [ "${{ github.event_name}}" = "workflow_dispatch" ]; then
          MATRIX=$(cat << EOF
          [{
            "branch": "${GITHUB_EVENT_INPUTS_BRANCH}",
            "extra_config": "${GITHUB_EVENT_INPUTS_EXTRA_CONFIG}"
          }]
          EOF
          )
          else
          MATRIX=$(cat << EOF
          [{
              "branch": "master",
              "extra_config": "enable-fips enable-tfo enable-lms enable-crypto-mdebug enable-unit-tests"
            }, {
              "branch": "openssl-4.0",
              "extra_config": "enable-fips enable-tfo enable-lms enable-crypto-mdebug"
            },{
              "branch": "openssl-3.6",
              "extra_config": "no-afalgeng enable-fips enable-tfo enable-lms"
            },{
              "branch": "openssl-3.5",
              "extra_config": "no-afalgeng enable-fips enable-tfo"
            },{
              "branch": "openssl-3.4",
              "extra_config": "no-afalgeng enable-fips enable-tfo"
            }, {
              "branch": "openssl-3.0",
              "extra_config": "no-afalgeng enable-fips"
          }]
          EOF
          )
          fi
          echo "branches<<EOF"$'\n'"$MATRIX"$'\n'EOF >> "$GITHUB_OUTPUT"

  coverage:
    if: github.repository == 'openssl/openssl'
    needs: define-matrix
    permissions:
      checks: write     # for coverallsapp/github-action to create new checks
      contents: read    # for actions/checkout to fetch code
    strategy:
      fail-fast: false
      matrix:
        branches: ${{ fromJSON(needs.define-matrix.outputs.branches) }}
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v6
      with:
        submodules: recursive
        ref: ${{ matrix.branches.branch }}
        persist-credentials: false
    - name: cache commit id
      run: |
        echo "githubid=`/usr/bin/git log -1 --format='%H'`" >>$GITHUB_ENV
    - name: package installs
      run: |
        sudo apt-get update
        sudo apt-get -yq install lcov
        sudo apt-get -yq install bison gettext keyutils ldap-utils libcmocka-dev libldap2-dev libkeyutils-dev python3 python3-paste python3-pyrad slapd tcsh python3-virtualenv virtualenv python3-kdcproxy
    - name: install Test2::V0 for gost_engine testing
      uses: perl-actions/install-with-cpanm@10d60f00b4073f484fc29d45bfbe2f776397ab3d #v1.7
      with:
        install: Test2::V0
    - name: setup hostname workaround
      run: sudo hostname localhost
    - name: config
      run: CC=gcc ./config --debug --coverage ${{ matrix.branches.extra_config }} no-asm enable-rc5 enable-md2 enable-nextprotoneg enable-weak-ssl-ciphers enable-zlib enable-ec_nistp_64_gcc_128 enable-buildtest-c++ enable-ssl-trace enable-trace
    - name: config dump
      run: ./configdata.pm --dump
    - name: make
      run: make -s -j4
    - name: get cpu info
      run: |
        cat /proc/cpuinfo
        ./util/opensslwrap.sh version -c
    - name: make test
      run: make test TESTS='-test_external_krb5' EVP_TEST_EXTENDED=1
    - name: generate coverage info
      run: lcov -d . -c
             --exclude "${PWD}/test/*"
             --exclude "${PWD}/fuzz/*"
             --exclude "/usr/include/*"
             --ignore-errors mismatch
             --branch-coverage
              -o ./lcov.info
    - name: Coveralls upload
      uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b #v2.3.6
      with:
        github-token: ${{ secrets.github_token }}
        git-branch: ${{ matrix.branches.branch }}
        git-commit: ${{ env.githubid }}
        path-to-lcov: ./lcov.info