summaryrefslogtreecommitdiffstats
path: root/.github/workflows/compiler-zoo.yml
blob: 4b500b12f7799ac63ac4a398d8b910119edcd528 (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
130
131
132
133
134
135
136
137
138
139
# Copyright 2021-2023 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: Compiler Zoo CI

on: [push]

permissions:
  contents: read

jobs:
  compiler:
    strategy:
      fail-fast: false
      matrix:
        zoo: [
          {
            cc: gcc-7,
            distro: ubuntu-20.04
          }, {
            cc: gcc-8,
            distro: ubuntu-20.04
          }, {
            cc: gcc-9,
            distro: ubuntu-20.04
          }, {
            cc: gcc-10,
            distro: ubuntu-20.04
          }, {
            cc: gcc-11,
            distro: ubuntu-22.04
          }, {
            cc: gcc-12,
            distro: ubuntu-22.04
          }, {
            cc: gcc-13,
            distro: ubuntu-22.04,
            gcc-ppa-name: ubuntu-toolchain-r/test
          }, {
            cc: clang-6.0,
            distro: ubuntu-20.04
          }, {
            cc: clang-7,
            distro: ubuntu-20.04
          }, {
            cc: clang-8,
            distro: ubuntu-20.04
          }, {
            cc: clang-9,
            distro: ubuntu-20.04
          }, {
            cc: clang-10,
            distro: ubuntu-20.04
          }, {
            cc: clang-11,
            distro: ubuntu-20.04
          }, {
            cc: clang-12,
            distro: ubuntu-20.04
          }, {
            cc: clang-13,
            distro: ubuntu-22.04
          }, {
            cc: clang-14,
            distro: ubuntu-22.04
          }, {
            cc: clang-15,
            distro: ubuntu-22.04,
            llvm-ppa-name: jammy
          }, {
            cc: clang-16,
            distro: ubuntu-22.04,
            llvm-ppa-name: jammy
          }, {
            cc: clang-17,
            distro: ubuntu-22.04,
            llvm-ppa-name: jammy
          }
        ]
    # We set per-compiler now to allow testing with both older and newer sets
    # Often, the full range of oldest->newest compilers we want aren't available
    # in a single version of Ubuntu.
    runs-on: ${{ matrix.zoo.distro }}
    steps:
    - name: install packages
      run: |
        gcc_ppa_name="${{ matrix.zoo.gcc-ppa-name }}"
        llvm_ppa_name="${{ matrix.zoo.llvm-ppa-name }}"

        # In the Matrix above:
        # - we set gcc-ppc-name if the GCC version isn't part of the Ubuntu version we're using (see https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test).
        # - we set llvm-ppa-name if an LLVM version isn't part of the Ubuntu version we're using (see https://apt.llvm.org/).
        # This is especially needed because even new Ubuntu LTSes aren't available
        # until a while after release on Github Actions.
        if [[ -n ${gcc_ppa_name} ]] ; then
          sudo add-apt-repository ppa:ubuntu-toolchain-r/test
          sudo apt-get update
        elif [[ -n ${llvm_ppa_name} ]] ; then
            wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key |\
                gpg --dearmor |\
                sudo tee /usr/share/keyrings/llvm-snapshot.gpg.key > /dev/null

            clang_version="${{ matrix.zoo.cc }}"
            clang_version="${clang_version/clang-}"

            echo "deb [signed-by=/usr/share/keyrings/llvm-snapshot.gpg.key] http://apt.llvm.org/${{ matrix.zoo.llvm-ppa-name }}/ llvm-toolchain-${{ matrix.zoo.llvm-ppa-name }}-${clang_version} main" \
                | sudo tee /etc/apt/sources.list.d/llvm.list
            echo "deb-src [signed-by=/usr/share/keyrings/llvm-snapshot.gpg.key] http://apt.llvm.org/${{ matrix.zoo.llvm-ppa-name }}/ llvm-toolchain-${{ matrix.zoo.llvm-ppa-name }}-${clang_version} main" \
                | sudo tee -a /etc/apt/sources.list.d/llvm.list

            cat /etc/apt/sources.list.d/llvm.list
        fi

        sudo apt-get update
        sudo apt-get -y install ${{ matrix.zoo.cc }}

    - uses: actions/checkout@v4
    - name: checkout fuzz/corpora submodule
      run: git submodule update --init --depth 1 fuzz/corpora

    - name: config
      run: |
        CC=${{ matrix.zoo.cc }} ./config --banner=Configured no-shared \
            -Wall -Werror enable-fips --strict-warnings

    - 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 HARNESS_JOBS=${HARNESS_JOBS:-4}