1name: C/C++ CI
2
3on:
4  push:
5    paths: [ '**.c', '**.h', '**.m4', '**.sh', '.github/**', '**/Makefile.in', 'configure.ac' ]
6  pull_request:
7    paths: [ '**.c', '**.h', '**.m4', '**.sh', '.github/**', '**/Makefile.in', 'configure.ac' ]
8
9jobs:
10  ci:
11    if: github.repository != 'openssh/openssh-portable-selfhosted'
12    strategy:
13      fail-fast: false
14      matrix:
15        # First we test all OSes in the default configuration.
16        target:
17          - ubuntu-20.04
18          - ubuntu-22.04
19          - macos-11
20          - macos-12
21          - macos-13
22          - windows-2019
23          - windows-2022
24        config: [default]
25        # Then we include any extra configs we want to test for specific VMs.
26        # Valgrind slows things down quite a bit, so start them first.
27        include:
28          - { target: windows-2019, config: cygwin-release }
29          - { target: windows-2022, config: cygwin-release }
30          - { target: ubuntu-20.04, config: valgrind-1 }
31          - { target: ubuntu-20.04, config: valgrind-2 }
32          - { target: ubuntu-20.04, config: valgrind-3 }
33          - { target: ubuntu-20.04, config: valgrind-4 }
34          - { target: ubuntu-20.04, config: valgrind-5 }
35          - { target: ubuntu-20.04, config: valgrind-unit }
36          - { target: ubuntu-20.04, config: c89 }
37          - { target: ubuntu-20.04, config: clang-6.0 }
38          - { target: ubuntu-20.04, config: clang-8 }
39          - { target: ubuntu-20.04, config: clang-9 }
40          - { target: ubuntu-20.04, config: clang-10 }
41          - { target: ubuntu-20.04, config: clang-11 }
42          - { target: ubuntu-20.04, config: clang-12-Werror }
43          - { target: ubuntu-20.04, config: clang-sanitize-address }
44          - { target: ubuntu-20.04, config: clang-sanitize-undefined }
45          - { target: ubuntu-20.04, config: gcc-sanitize-address }
46          - { target: ubuntu-20.04, config: gcc-sanitize-undefined }
47          - { target: ubuntu-20.04, config: gcc-7 }
48          - { target: ubuntu-20.04, config: gcc-8 }
49          - { target: ubuntu-20.04, config: gcc-10 }
50          - { target: ubuntu-22.04, config: gcc-11-Werror }
51          - { target: ubuntu-22.04, config: gcc-12-Werror }
52          - { target: ubuntu-20.04, config: pam }
53          - { target: ubuntu-20.04, config: kitchensink }
54          - { target: ubuntu-22.04, config: hardenedmalloc }
55          - { target: ubuntu-20.04, config: tcmalloc }
56          - { target: ubuntu-20.04, config: musl }
57          - { target: ubuntu-latest, config: boringssl }
58          - { target: ubuntu-latest, config: libressl-master }
59          - { target: ubuntu-latest, config: libressl-3.2.6 }
60          - { target: ubuntu-latest, config: libressl-3.3.6 }
61          - { target: ubuntu-latest, config: libressl-3.4.3 }
62          - { target: ubuntu-latest, config: libressl-3.5.3 }
63          - { target: ubuntu-latest, config: libressl-3.6.1 }
64          - { target: ubuntu-latest, config: libressl-3.7.2 }
65          - { target: ubuntu-latest, config: libressl-3.8.3 }
66          - { target: ubuntu-latest, config: libressl-3.9.0 }
67          - { target: ubuntu-latest, config: openssl-master }
68          - { target: ubuntu-latest, config: openssl-noec }
69          - { target: ubuntu-latest, config: openssl-1.1.1 }
70          - { target: ubuntu-latest, config: openssl-1.1.1t }
71          - { target: ubuntu-latest, config: openssl-1.1.1w }
72          - { target: ubuntu-latest, config: openssl-3.0.0 }
73          - { target: ubuntu-latest, config: openssl-3.0.13 }
74          - { target: ubuntu-latest, config: openssl-3.1.0 }
75          - { target: ubuntu-latest, config: openssl-3.1.5 }
76          - { target: ubuntu-latest, config: openssl-3.2.1 }
77          - { target: ubuntu-latest, config: openssl-1.1.1_stable }
78          - { target: ubuntu-latest, config: openssl-3.0 }  # stable branch
79          - { target: ubuntu-latest, config: openssl-3.2 }  # stable branch
80          - { target: ubuntu-latest, config: putty-0.71 }
81          - { target: ubuntu-latest, config: putty-0.72 }
82          - { target: ubuntu-latest, config: putty-0.73 }
83          - { target: ubuntu-latest, config: putty-0.74 }
84          - { target: ubuntu-latest, config: putty-0.75 }
85          - { target: ubuntu-latest, config: putty-0.76 }
86          - { target: ubuntu-latest, config: putty-0.77 }
87          - { target: ubuntu-latest, config: putty-0.78 }
88          - { target: ubuntu-latest, config: putty-0.79 }
89          - { target: ubuntu-latest, config: putty-0.80 }
90          - { target: ubuntu-latest, config: putty-snapshot }
91          - { target: ubuntu-latest, config: zlib-develop }
92          - { target: ubuntu-22.04, config: pam }
93          - { target: ubuntu-22.04, config: krb5 }
94          - { target: ubuntu-22.04, config: heimdal }
95          - { target: ubuntu-22.04, config: libedit }
96          - { target: ubuntu-22.04, config: sk }
97          - { target: ubuntu-22.04, config: selinux }
98          - { target: ubuntu-22.04, config: kitchensink }
99          - { target: ubuntu-22.04, config: without-openssl }
100          - { target: macos-11, config: pam }
101          - { target: macos-12, config: pam }
102          - { target: macos-13, config: pam }
103    runs-on: ${{ matrix.target }}
104    steps:
105    - name: set cygwin git params
106      if: ${{ startsWith(matrix.target, 'windows') }}
107      run: git config --global core.autocrlf input
108    - name: install cygwin
109      if: ${{ startsWith(matrix.target, 'windows') }}
110      uses: cygwin/cygwin-install-action@master
111    - uses: actions/checkout@main
112    - name: setup CI system
113      run: sh ./.github/setup_ci.sh ${{ matrix.config }}
114    - name: autoreconf
115      run: sh -c autoreconf
116    - name: configure
117      run: sh ./.github/configure.sh ${{ matrix.config }}
118    - name: save config
119      uses: actions/upload-artifact@main
120      with:
121        name: ${{ matrix.target }}-${{ matrix.config }}-config
122        path: config.h
123    - name: make clean
124      run: make clean
125    - name: make
126      run: make
127    - name: make tests
128      run: sh ./.github/run_test.sh ${{ matrix.config }}
129      env:
130        TEST_SSH_UNSAFE_PERMISSIONS: 1
131        TEST_SSH_HOSTBASED_AUTH: yes
132    - name: save logs
133      if: failure()
134      uses: actions/upload-artifact@main
135      with:
136        name: ${{ matrix.target }}-${{ matrix.config }}-logs
137        path: |
138          config.h
139          config.log
140          regress/*.log
141          regress/valgrind-out/
142          regress/asan.log.*
143          regress/msan.log.*
144          regress/log/*
145