xref: /freebsd/crypto/openssh/.github/workflows/c-cpp.yml (revision 4db3872aabc33088cf180599c5eaa23b6f58e6d1)
1name: CI
2
3# For testing, you can set variables in your repo (Repo -> Settings ->
4# Security -> Actions -> Variables) to restrict the tests that are run.
5# The supported variables are:
6#
7# RUN_ONLY_TARGET_CONFIG: Run only the single matching target and config,
8#   separated by spaces, eg "ubuntu-latest default".  All other tests will
9#   fail immediately.
10#
11# LTESTS: Override the set of tests run.
12# TEST_SSH_TRACE: Set to yes for additional regress output.
13
14on:
15  push:
16    paths: [ '**.c', '**.h', '**.m4', '**.sh', '**/Makefile.in', 'configure.ac', '.github/configs', '.github/*.sh', '.github/workflows/c-cpp.yml' ]
17  pull_request:
18    paths: [ '**.c', '**.h', '**.m4', '**.sh', '**/Makefile.in', 'configure.ac', '.github/configs', '.github/*.sh', '.github/workflows/c-cpp.yml' ]
19
20jobs:
21  ci:
22    name: "${{ matrix.target }} ${{ matrix.config }}"
23    if: github.repository != 'openssh/openssh-portable-selfhosted'
24    strategy:
25      fail-fast: false
26      matrix:
27        # First we test all OSes in the default configuration.
28        target:
29          - ubuntu-22.04
30          - ubuntu-latest
31          - ubuntu-22.04-arm
32          - ubuntu-24.04-arm
33          - macos-14
34          - macos-15
35          - macos-15-intel
36          - windows-2022
37          - windows-2025
38        config: [default]
39        # Then we include any extra configs we want to test for specific VMs.
40        # Valgrind slows things down quite a bit, so start them first.
41        include:
42          - { target: windows-2022, config: cygwin-release }
43          - { target: windows-2025, config: cygwin-release }
44          - { target: ubuntu-22.04, config: c89 }
45          - { target: ubuntu-22.04, config: clang-11 }
46          - { target: ubuntu-22.04, config: clang-12-Werror }
47          - { target: ubuntu-22.04, config: clang-14 }
48          - { target: ubuntu-22.04, config: clang-sanitize-address }
49          - { target: ubuntu-22.04, config: clang-sanitize-undefined }
50          - { target: ubuntu-22.04, config: gcc-9 }
51          - { target: ubuntu-22.04, config: gcc-11-Werror }
52          - { target: ubuntu-22.04, config: gcc-12-Werror }
53          - { target: ubuntu-22.04, config: gcc-sanitize-address }
54          - { target: ubuntu-22.04, config: gcc-sanitize-undefined }
55          - { target: ubuntu-22.04, config: heimdal }
56          - { target: ubuntu-22.04, config: kitchensink }
57          - { target: ubuntu-22.04, config: krb5 }
58          - { target: ubuntu-22.04, config: libedit }
59          - { target: ubuntu-22.04, config: pam }
60          - { target: ubuntu-22.04, config: selinux }
61          - { target: ubuntu-22.04, config: sk }
62          - { target: ubuntu-22.04, config: valgrind-1 }
63          - { target: ubuntu-22.04, config: valgrind-2 }
64          - { target: ubuntu-22.04, config: valgrind-3 }
65          - { target: ubuntu-22.04, config: valgrind-4 }
66          # - { target: ubuntu-22.04, config: valgrind-pam-1 }
67          - { target: ubuntu-22.04, config: valgrind-unit }
68          - { target: ubuntu-22.04, config: without-openssl }
69          - { target: ubuntu-latest, config: gcc-14 }
70          - { target: ubuntu-latest, config: clang-15 }
71          - { target: ubuntu-latest, config: clang-19 }
72          - { target: ubuntu-latest, config: boringssl }
73          - { target: ubuntu-latest, config: aws-lc }
74          - { target: ubuntu-latest, config: hardenedmalloc }
75          - { target: ubuntu-latest, config: libressl-master }
76          - { target: ubuntu-latest, config: libressl-3.2.7 }
77          - { target: ubuntu-latest, config: libressl-3.3.6 }
78          - { target: ubuntu-latest, config: libressl-3.4.3 }
79          - { target: ubuntu-latest, config: libressl-3.5.4 }
80          - { target: ubuntu-latest, config: libressl-3.6.3 }
81          - { target: ubuntu-latest, config: libressl-3.7.3 }
82          - { target: ubuntu-latest, config: libressl-3.8.4 }
83          - { target: ubuntu-latest, config: libressl-3.9.2 }
84          - { target: ubuntu-latest, config: libressl-4.0.1 }
85          - { target: ubuntu-latest, config: libressl-4.1.1 }
86          - { target: ubuntu-latest, config: libressl-4.2.0 }
87          - { target: ubuntu-latest, config: libressl-4.3.2 }
88          - { target: ubuntu-latest, config: openssl-master }
89          - { target: ubuntu-latest, config: openssl-noec }
90          - { target: ubuntu-latest, config: openssl-1.1.1 }
91          - { target: ubuntu-latest, config: openssl-1.1.1t }
92          - { target: ubuntu-latest, config: openssl-1.1.1w }
93          - { target: ubuntu-latest, config: openssl-3.0.0 }
94          - { target: ubuntu-latest, config: openssl-3.0.18 }
95          - { target: ubuntu-latest, config: openssl-3.1.0 }
96          - { target: ubuntu-latest, config: openssl-3.1.8 }
97          - { target: ubuntu-latest, config: openssl-3.2.6 }
98          - { target: ubuntu-latest, config: openssl-3.3.7 }
99          - { target: ubuntu-latest, config: openssl-3.4.0 }
100          - { target: ubuntu-latest, config: openssl-3.4.5 }
101          - { target: ubuntu-latest, config: openssl-3.5.0 }
102          - { target: ubuntu-latest, config: openssl-3.5.3 }  # keep
103          - { target: ubuntu-latest, config: openssl-3.5.6 }
104          - { target: ubuntu-latest, config: openssl-3.6.2 }
105          - { target: ubuntu-latest, config: openssl-4.0.0 }
106          - { target: ubuntu-latest, config: openssl-1.1.1_stable }
107          - { target: ubuntu-latest, config: openssl-3.0 }  # stable branch
108          - { target: ubuntu-latest, config: openssl-3.1 }  # stable branch
109          - { target: ubuntu-latest, config: openssl-3.2 }  # stable branch
110          - { target: ubuntu-latest, config: openssl-3.3 }  # stable branch
111          - { target: ubuntu-latest, config: openssl-3.4 }  # stable branch
112          - { target: ubuntu-latest, config: openssl-3.5 }  # stable branch
113          - { target: ubuntu-latest, config: openssl-3.6 }  # stable branch
114          - { target: ubuntu-latest, config: openssl-4.0 }  # stable branch
115          - { target: ubuntu-latest, config: dropbear-versions }
116          - { target: ubuntu-latest, config: putty-versions }
117          - { target: ubuntu-latest, config: zlib-develop }
118          - { target: ubuntu-latest, config: tcmalloc }
119          - { target: ubuntu-latest, config: musl }
120          - { target: ubuntu-22.04-arm, config: kitchensink }
121          - { target: ubuntu-24.04-arm, config: kitchensink }
122          - { target: macos-14, config: pam }
123          - { target: macos-15, config: pam }
124    runs-on: ${{ matrix.target }}
125    env:
126      EPHEMERAL_VM: yes
127      CYGWIN: "winsymlinks:native"
128    steps:
129    - name: check RUN_ONLY_TARGET_CONFIG
130      if: vars.RUN_ONLY_TARGET_CONFIG != ''
131      run: sh -c 'if [ "${{ vars.RUN_ONLY_TARGET_CONFIG }}" != "${{ matrix.target }} ${{matrix.config }}" ]; then exit 1; else exit 0; fi'
132    - name: set cygwin git params
133      if: ${{ startsWith(matrix.target, 'windows') }}
134      run: git config --global core.autocrlf input
135    - name: install cygwin
136      id: cygwin_install
137      if: ${{ startsWith(matrix.target, 'windows') }}
138      uses: cygwin/cygwin-install-action@a3d72946b163026bbd0fa9a88379ccbda4bd86bb # master
139    - name: checkout openssh git repo
140      uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # main
141    - name: setup CI system
142      run: |
143        sh -c "timeout 1200 .github/setup_ci.sh ${{ matrix.config }} ${{ matrix.target }} || .github/setup_ci.sh ${{ matrix.config }} ${{ matrix.target }}"
144      env:
145        CYGWIN_SETUP: ${{ steps.cygwin_install.outputs.setup }}
146    - name: autoreconf
147      run: sh -c autoreconf
148    - name: configure
149      run: sh ./.github/configure.sh ${{ matrix.config }}
150    - name: save config
151      uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # main
152      with:
153        name: ${{ matrix.target }}-${{ matrix.config }}-config
154        path: config.h
155    - name: make clean
156      run: make clean
157    - name: make
158      run: make -j2
159    - name: make tests
160      run: sh ./.github/run_test.sh ${{ matrix.config }}
161      env:
162        TEST_SSH_UNSAFE_PERMISSIONS: 1
163        TEST_SSH_HOSTBASED_AUTH: yes
164        TEST_SSH_TRACE: ${{ vars.TEST_SSH_TRACE }}
165        LTESTS: ${{ vars.LTESTS }}
166    - name: test OpenSSL3 ABI compatibility
167      if: ${{ startsWith(matrix.config, 'openssl-3') }}
168      run: |
169       sh .github/install_libcrypto.sh -a ${{ matrix.config }} /opt/openssl
170       sh .github/run_test.sh ${{ matrix.config }}
171    - name: chown logs
172      if: failure()
173      run: sh -c 'SUDO="$(which sudo 2>/dev/null)"; $SUDO chown -R "${LOGNAME}" regress'
174    - name: show logs
175      if: failure()
176      run: sh -c "for i in regress/failed*.log; do echo ====; echo logfile $i; echo =====; cat $i; done"
177    - name: save logs
178      if: failure()
179      uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # main
180      with:
181        name: ${{ matrix.target }}-${{ matrix.config }}-logs
182        path: |
183          config.h
184          config.log
185          regress/
186