xref: /freebsd/crypto/openssh/.github/workflows/c-cpp.yml (revision 4f8f43b06ed07e96a250855488cc531799d5b78f)
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-20.04, config: gcc-11-Werror }
51          - { target: ubuntu-20.04, config: pam }
52          - { target: ubuntu-20.04, config: kitchensink }
53          - { target: ubuntu-22.04, config: hardenedmalloc }
54          - { target: ubuntu-20.04, config: tcmalloc }
55          - { target: ubuntu-20.04, config: musl }
56          - { target: ubuntu-latest, config: boringssl }
57          - { target: ubuntu-latest, config: libressl-master }
58          - { target: ubuntu-latest, config: libressl-3.2.6 }
59          - { target: ubuntu-latest, config: libressl-3.3.6 }
60          - { target: ubuntu-latest, config: libressl-3.4.3 }
61          - { target: ubuntu-latest, config: libressl-3.5.3 }
62          - { target: ubuntu-latest, config: libressl-3.6.1 }
63          - { target: ubuntu-latest, config: libressl-3.7.2 }
64          - { target: ubuntu-latest, config: openssl-master }
65          - { target: ubuntu-latest, config: openssl-noec }
66          - { target: ubuntu-latest, config: openssl-1.1.1 }
67          - { target: ubuntu-latest, config: openssl-1.1.1k }
68          - { target: ubuntu-latest, config: openssl-1.1.1n }
69          - { target: ubuntu-latest, config: openssl-1.1.1q }
70          - { target: ubuntu-latest, config: openssl-1.1.1t }
71          - { target: ubuntu-latest, config: openssl-3.0.0 }
72          - { target: ubuntu-latest, config: openssl-3.0.7 }
73          - { target: ubuntu-latest, config: openssl-3.1.0 }
74          - { target: ubuntu-latest, config: openssl-1.1.1_stable }
75          - { target: ubuntu-latest, config: openssl-3.0 }  # stable branch
76          - { target: ubuntu-latest, config: zlib-develop }
77          - { target: ubuntu-22.04, config: pam }
78          - { target: ubuntu-22.04, config: krb5 }
79          - { target: ubuntu-22.04, config: heimdal }
80          - { target: ubuntu-22.04, config: libedit }
81          - { target: ubuntu-22.04, config: sk }
82          - { target: ubuntu-22.04, config: selinux }
83          - { target: ubuntu-22.04, config: kitchensink }
84          - { target: ubuntu-22.04, config: without-openssl }
85          - { target: macos-11, config: pam }
86          - { target: macos-12, config: pam }
87          - { target: macos-13, config: pam }
88    runs-on: ${{ matrix.target }}
89    steps:
90    - name: set cygwin git params
91      if: ${{ startsWith(matrix.target, 'windows') }}
92      run: git config --global core.autocrlf input
93    - name: install cygwin
94      if: ${{ startsWith(matrix.target, 'windows') }}
95      uses: cygwin/cygwin-install-action@master
96    - uses: actions/checkout@main
97    - name: setup CI system
98      run: sh ./.github/setup_ci.sh ${{ matrix.config }}
99    - name: autoreconf
100      run: sh -c autoreconf
101    - name: configure
102      run: sh ./.github/configure.sh ${{ matrix.config }}
103    - name: save config
104      uses: actions/upload-artifact@main
105      with:
106        name: ${{ matrix.target }}-${{ matrix.config }}-config
107        path: config.h
108    - name: make clean
109      run: make clean
110    - name: make
111      run: make -j2
112    - name: make tests
113      run: sh ./.github/run_test.sh ${{ matrix.config }}
114      env:
115        TEST_SSH_UNSAFE_PERMISSIONS: 1
116        TEST_SSH_HOSTBASED_AUTH: yes
117    - name: save logs
118      if: failure()
119      uses: actions/upload-artifact@main
120      with:
121        name: ${{ matrix.target }}-${{ matrix.config }}-logs
122        path: |
123          config.h
124          config.log
125          regress/*.log
126          regress/valgrind-out/
127          regress/asan.log.*
128          regress/msan.log.*
129          regress/log/*
130