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.2 }
66          - { target: ubuntu-latest, config: openssl-master }
67          - { target: ubuntu-latest, config: openssl-noec }
68          - { target: ubuntu-latest, config: openssl-1.1.1 }
69          - { target: ubuntu-latest, config: openssl-1.1.1t }
70          - { target: ubuntu-latest, config: openssl-1.1.1w }
71          - { target: ubuntu-latest, config: openssl-3.0.0 }
72          - { target: ubuntu-latest, config: openssl-3.0.12 }
73          - { target: ubuntu-latest, config: openssl-3.1.0 }
74          - { target: ubuntu-latest, config: openssl-3.1.4 }
75          - { target: ubuntu-latest, config: openssl-3.2.0 }
76          - { target: ubuntu-latest, config: openssl-1.1.1_stable }
77          - { target: ubuntu-latest, config: openssl-3.0 }  # stable branch
78          - { target: ubuntu-latest, config: openssl-3.2 }  # stable branch
79          - { target: ubuntu-latest, config: zlib-develop }
80          - { target: ubuntu-22.04, config: pam }
81          - { target: ubuntu-22.04, config: krb5 }
82          - { target: ubuntu-22.04, config: heimdal }
83          - { target: ubuntu-22.04, config: libedit }
84          - { target: ubuntu-22.04, config: sk }
85          - { target: ubuntu-22.04, config: selinux }
86          - { target: ubuntu-22.04, config: kitchensink }
87          - { target: ubuntu-22.04, config: without-openssl }
88          - { target: macos-11, config: pam }
89          - { target: macos-12, config: pam }
90          - { target: macos-13, config: pam }
91    runs-on: ${{ matrix.target }}
92    steps:
93    - name: set cygwin git params
94      if: ${{ startsWith(matrix.target, 'windows') }}
95      run: git config --global core.autocrlf input
96    - name: install cygwin
97      if: ${{ startsWith(matrix.target, 'windows') }}
98      uses: cygwin/cygwin-install-action@master
99    - uses: actions/checkout@main
100    - name: setup CI system
101      run: sh ./.github/setup_ci.sh ${{ matrix.config }}
102    - name: autoreconf
103      run: sh -c autoreconf
104    - name: configure
105      run: sh ./.github/configure.sh ${{ matrix.config }}
106    - name: save config
107      uses: actions/upload-artifact@main
108      with:
109        name: ${{ matrix.target }}-${{ matrix.config }}-config
110        path: config.h
111    - name: make clean
112      run: make clean
113    - name: make
114      run: make
115    - name: make tests
116      run: sh ./.github/run_test.sh ${{ matrix.config }}
117      env:
118        TEST_SSH_UNSAFE_PERMISSIONS: 1
119        TEST_SSH_HOSTBASED_AUTH: yes
120    - name: save logs
121      if: failure()
122      uses: actions/upload-artifact@main
123      with:
124        name: ${{ matrix.target }}-${{ matrix.config }}-logs
125        path: |
126          config.h
127          config.log
128          regress/*.log
129          regress/valgrind-out/
130          regress/asan.log.*
131          regress/msan.log.*
132          regress/log/*
133