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: [ubuntu-20.04, ubuntu-22.04, macos-11, macos-12, windows-2019, windows-2022]
17        config: [default]
18        # Then we include any extra configs we want to test for specific VMs.
19        # Valgrind slows things down quite a bit, so start them first.
20        include:
21          - { target: windows-2019, config: cygwin-release }
22          - { target: windows-2022, config: cygwin-release }
23          - { target: ubuntu-20.04, config: valgrind-1 }
24          - { target: ubuntu-20.04, config: valgrind-2 }
25          - { target: ubuntu-20.04, config: valgrind-3 }
26          - { target: ubuntu-20.04, config: valgrind-4 }
27          - { target: ubuntu-20.04, config: valgrind-5 }
28          - { target: ubuntu-20.04, config: valgrind-unit }
29          - { target: ubuntu-20.04, config: c89 }
30          - { target: ubuntu-20.04, config: clang-6.0 }
31          - { target: ubuntu-20.04, config: clang-8 }
32          - { target: ubuntu-20.04, config: clang-9 }
33          - { target: ubuntu-20.04, config: clang-10 }
34          - { target: ubuntu-20.04, config: clang-11 }
35          - { target: ubuntu-20.04, config: clang-12-Werror }
36          - { target: ubuntu-20.04, config: clang-sanitize-address }
37          - { target: ubuntu-20.04, config: clang-sanitize-undefined }
38          - { target: ubuntu-20.04, config: gcc-sanitize-address }
39          - { target: ubuntu-20.04, config: gcc-sanitize-undefined }
40          - { target: ubuntu-20.04, config: gcc-7 }
41          - { target: ubuntu-20.04, config: gcc-8 }
42          - { target: ubuntu-20.04, config: gcc-10 }
43          - { target: ubuntu-20.04, config: gcc-11-Werror }
44          - { target: ubuntu-20.04, config: pam }
45          - { target: ubuntu-20.04, config: kitchensink }
46          - { target: ubuntu-20.04, config: hardenedmalloc }
47          - { target: ubuntu-20.04, config: tcmalloc }
48          - { target: ubuntu-20.04, config: musl }
49          - { target: ubuntu-latest, config: libressl-master }
50          - { target: ubuntu-latest, config: libressl-2.2.9 }
51          - { target: ubuntu-latest, config: libressl-2.8.3 }
52          - { target: ubuntu-latest, config: libressl-3.0.2 }
53          - { target: ubuntu-latest, config: libressl-3.2.6 }
54          - { target: ubuntu-latest, config: libressl-3.3.6 }
55          - { target: ubuntu-latest, config: libressl-3.4.3 }
56          - { target: ubuntu-latest, config: libressl-3.5.3 }
57          - { target: ubuntu-latest, config: libressl-3.6.1 }
58          - { target: ubuntu-latest, config: libressl-3.7.0 }
59          - { target: ubuntu-latest, config: openssl-master }
60          - { target: ubuntu-latest, config: openssl-noec }
61          - { target: ubuntu-latest, config: openssl-1.0.1 }
62          - { target: ubuntu-latest, config: openssl-1.0.1u }
63          - { target: ubuntu-latest, config: openssl-1.0.2u }
64          - { target: ubuntu-latest, config: openssl-1.1.0h }
65          - { target: ubuntu-latest, config: openssl-1.1.1 }
66          - { target: ubuntu-latest, config: openssl-1.1.1k }
67          - { target: ubuntu-latest, config: openssl-1.1.1n }
68          - { target: ubuntu-latest, config: openssl-1.1.1q }
69          - { target: ubuntu-latest, config: openssl-1.1.1s }
70          - { target: ubuntu-latest, config: openssl-3.0.0 }
71          - { target: ubuntu-latest, config: openssl-3.0.5 }
72          - { target: ubuntu-latest, config: openssl-3.0.7 }
73          - { target: ubuntu-latest, config: openssl-1.1.1_stable }
74          - { target: ubuntu-latest, config: openssl-3.0 }  # stable branch
75          - { target: ubuntu-22.04, config: pam }
76          - { target: ubuntu-22.04, config: krb5 }
77          - { target: ubuntu-22.04, config: heimdal }
78          - { target: ubuntu-22.04, config: libedit }
79          - { target: ubuntu-22.04, config: sk }
80          - { target: ubuntu-22.04, config: selinux }
81          - { target: ubuntu-22.04, config: kitchensink }
82          - { target: ubuntu-22.04, config: without-openssl }
83          - { target: macos-11, config: pam }
84          - { target: macos-12, config: pam }
85    runs-on: ${{ matrix.target }}
86    steps:
87    - name: set cygwin git params
88      if: ${{ startsWith(matrix.target, 'windows') }}
89      run: git config --global core.autocrlf input
90    - name: install cygwin
91      if: ${{ startsWith(matrix.target, 'windows') }}
92      uses: cygwin/cygwin-install-action@master
93    - uses: actions/checkout@main
94    - name: setup CI system
95      run: sh ./.github/setup_ci.sh ${{ matrix.config }}
96    - name: autoreconf
97      run: sh -c autoreconf
98    - name: configure
99      run: sh ./.github/configure.sh ${{ matrix.config }}
100    - name: save config
101      uses: actions/upload-artifact@main
102      with:
103        name: ${{ matrix.target }}-${{ matrix.config }}-config
104        path: config.h
105    - name: make clean
106      run: make clean
107    - name: make
108      run: make -j2
109    - name: make tests
110      run: sh ./.github/run_test.sh ${{ matrix.config }}
111      env:
112        TEST_SSH_UNSAFE_PERMISSIONS: 1
113        TEST_SSH_HOSTBASED_AUTH: yes
114    - name: save logs
115      if: failure()
116      uses: actions/upload-artifact@main
117      with:
118        name: ${{ matrix.target }}-${{ matrix.config }}-logs
119        path: |
120          config.h
121          config.log
122          regress/*.log
123          regress/valgrind-out/
124          regress/asan.log.*
125          regress/msan.log.*
126