xref: /freebsd/crypto/openssh/.github/workflows/c-cpp.yml (revision d0b2dbfa0ecf2bbc9709efc5e20baf8e4b44bbbf)
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-22.04, config: pam }
77          - { target: ubuntu-22.04, config: krb5 }
78          - { target: ubuntu-22.04, config: heimdal }
79          - { target: ubuntu-22.04, config: libedit }
80          - { target: ubuntu-22.04, config: sk }
81          - { target: ubuntu-22.04, config: selinux }
82          - { target: ubuntu-22.04, config: kitchensink }
83          - { target: ubuntu-22.04, config: without-openssl }
84          - { target: macos-11, config: pam }
85          - { target: macos-12, config: pam }
86          - { target: macos-13, config: pam }
87    runs-on: ${{ matrix.target }}
88    steps:
89    - name: set cygwin git params
90      if: ${{ startsWith(matrix.target, 'windows') }}
91      run: git config --global core.autocrlf input
92    - name: install cygwin
93      if: ${{ startsWith(matrix.target, 'windows') }}
94      uses: cygwin/cygwin-install-action@master
95    - uses: actions/checkout@main
96    - name: setup CI system
97      run: sh ./.github/setup_ci.sh ${{ matrix.config }}
98    - name: autoreconf
99      run: sh -c autoreconf
100    - name: configure
101      run: sh ./.github/configure.sh ${{ matrix.config }}
102    - name: save config
103      uses: actions/upload-artifact@main
104      with:
105        name: ${{ matrix.target }}-${{ matrix.config }}-config
106        path: config.h
107    - name: make clean
108      run: make clean
109    - name: make
110      run: make -j2
111    - name: make tests
112      run: sh ./.github/run_test.sh ${{ matrix.config }}
113      env:
114        TEST_SSH_UNSAFE_PERMISSIONS: 1
115        TEST_SSH_HOSTBASED_AUTH: yes
116    - name: save logs
117      if: failure()
118      uses: actions/upload-artifact@main
119      with:
120        name: ${{ matrix.target }}-${{ matrix.config }}-logs
121        path: |
122          config.h
123          config.log
124          regress/*.log
125          regress/valgrind-out/
126          regress/asan.log.*
127          regress/msan.log.*
128          regress/log/*
129