xref: /freebsd/crypto/openssh/.github/workflows/selfhosted.yml (revision 6296500a85c8474e3ff3fe2f8e4a9d56dd0acd64)
1name: C/C++ CI self-hosted
2
3on:
4  push:
5    paths: [ '**.c', '**.h', '**.m4', '**.sh', '**/Makefile.in', 'configure.ac', '.github/configs', '.github/workflows/selfhosted.yml' ]
6
7jobs:
8  selfhosted:
9    name: "${{ matrix.target }} ${{ matrix.config }}"
10    if: github.repository == 'openssh/openssh-portable-selfhosted'
11    runs-on: ${{ matrix.host }}
12    timeout-minutes: 600
13    env:
14      DEBUG_ACTIONS: false
15      HOST: ${{ matrix.host }}
16      TARGET_HOST: ${{ matrix.target }}
17      TARGET_CONFIG: ${{ matrix.config }}
18      TARGET_DOMAIN: ${{ startsWith(matrix.host, 'libvirt') && format('{0}-{1}-{2}', matrix.target, matrix.config, github.run_id) || matrix.target }}
19      EPHEMERAL: ${{ startsWith(matrix.host, 'libvirt') }}
20      PERSISTENT: ${{ startsWith(matrix.host, 'persist') }}
21      REMOTE: ${{ startsWith(matrix.host, 'remote') }}
22      VM: ${{ startsWith(matrix.host, 'libvirt') || startsWith(matrix.host, 'persist') }}
23      SSHFS: ${{ startsWith(matrix.host, 'libvirt') || startsWith(matrix.host, 'persist') || startsWith(matrix.host, 'remote') }}
24      BIGENDIAN: ${{ matrix.target == 'aix51' || matrix.target == 'fbsd14-ppc64' || matrix.target == 'openwrt-mips' }}
25    strategy:
26      fail-fast: false
27      # We use a matrix in two parts: firstly all of the VMs are tested with the
28      # default config.  "target" corresponds to a label associated with the
29      # worker.  The default is an ephemeral VM running under libvirt.
30      matrix:
31        target:
32          - alpine
33          - centos7
34          - debian-i386
35          - dfly30
36          - dfly48
37          - dfly60
38          - dfly62
39          - dfly64
40          - fbsd10
41          - fbsd12
42          - fbsd13
43          - fbsd14
44          - nbsd3
45          - nbsd4
46          - nbsd8
47          - nbsd9
48          - nbsd10
49          - obsd51
50          - obsd67
51          - obsd72
52          - obsd73
53          - obsd74
54          - obsdsnap
55          - obsdsnap-i386
56          - omnios
57          - openindiana
58          - ubuntu-2204
59        config:
60          - default
61        host:
62          - libvirt
63        include:
64          # Long-running/slow tests have access to high priority runners.
65          - { target: aix51, config: default, host: libvirt-hipri }
66          - { target: fbsd14-ppc64, config: default, host: libvirt-hipri }
67          - { target: openindiana, config: pam, host: libvirt-hipri }
68          - { target: sol10,  config: default, host: libvirt-hipri }
69          - { target: sol10,  config: pam, host: libvirt-hipri }
70          - { target: sol11,  config: default, host: libvirt-hipri }
71          - { target: sol11,  config: pam-krb5, host: libvirt-hipri }
72          - { target: sol11,  config: sol64, host: libvirt-hipri }
73          # Then we include extra libvirt test configs.
74          - { target: centos7, config: pam, host: libvirt }
75          - { target: debian-i386, config: pam, host: libvirt }
76          - { target: dfly30, config: without-openssl, host: libvirt}
77          - { target: dfly48, config: pam ,host: libvirt }
78          - { target: dfly58, config: pam, host: libvirt }
79          - { target: dfly60, config: pam, host: libvirt }
80          - { target: dfly62, config: pam, host: libvirt }
81          - { target: dfly64, config: pam, host: libvirt }
82          - { target: fbsd10, config: pam, host: libvirt }
83          - { target: fbsd12, config: pam, host: libvirt }
84          - { target: fbsd13, config: pam, host: libvirt }
85          - { target: fbsd14, config: pam, host: libvirt }
86          - { target: nbsd8,  config: pam, host: libvirt }
87          - { target: nbsd9,  config: pam, host: libvirt }
88          - { target: nbsd10, config: pam, host: libvirt }
89          - { target: omnios, config: pam, host: libvirt }
90          # ARM64 VMs
91          - { target: obsd-arm64, config: default, host: libvirt-arm64 }
92          # VMs with persistent disks that have their own runner.
93          - { target: win10, config: default,        host: persist-win10 }
94          - { target: win10, config: cygwin-release, host: persist-win10 }
95          # Physical hosts with native runners.
96          - { target: ARM, config: default, host: ARM }
97          - { target: ARM64, config: default, host: ARM64 }
98          - { target: ARM64, config: pam, host: ARM64 }
99          # Physical hosts with remote runners.
100          - { target: debian-riscv64, config: default, host: remote-debian-riscv64 }
101          - { target: openwrt-mips, config: default, host: remote-openwrt-mips }
102          - { target: openwrt-mipsel, config: default, host: remote-openwrt-mipsel }
103    steps:
104    - name: shutdown VM if running
105      if: env.VM == 'true'
106      run: vmshutdown
107    - uses: actions/checkout@main
108    - name: autoreconf
109      run: autoreconf
110    - name: startup VM
111      if: env.VM == 'true'
112      run: vmstartup
113      working-directory: ${{ runner.temp }}
114    - name: copy and mount workspace
115      if: env.SSHFS == 'true'
116      run: sshfs_mount
117      working-directory: ${{ runner.temp }}
118    - name: configure
119      run: vmrun ./.github/configure.sh ${{ matrix.config }}
120#    - name: save config
121#      uses: actions/upload-artifact@main
122#      with:
123#        name: ${{ matrix.target }}-${{ matrix.config }}-config
124#        path: config.h
125    - name: make clean
126      run: vmrun make clean
127    - name: make
128      run: vmrun make
129    - name: make tests
130      run: vmrun ./.github/run_test.sh ${{ matrix.config }}
131      timeout-minutes: 600
132    - name: save logs
133      if: failure()
134      uses: actions/upload-artifact@main
135      with:
136        name: ${{ matrix.target }}-${{ matrix.config }}-logs
137        path: |
138          config.h
139          config.log
140          regress/*.log
141          regress/log/*
142          regress/valgrind-out/
143    - name: unmount workspace
144      if: always() && env.SSHFS == 'true'
145      run: fusermount -u ${GITHUB_WORKSPACE} || true
146      working-directory: ${{ runner.temp }}
147
148    - name: bigendian interop - mount regress
149      if: env.SSHFS == 'true' && env.BIGENDIAN == 'true'
150      run: |
151        set -x
152        vmrun sudo chown -R $LOGNAME ~/$(basename ${GITHUB_WORKSPACE}) || true
153        vmrun "cd $(basename ${GITHUB_WORKSPACE}/regress) && sudo make clean"
154        sshfs_mount regress
155        vmrun "sudo mkdir -p $(dirname ${GITHUB_WORKSPACE})"
156        vmrun "sudo ln -s ~/$(basename ${GITHUB_WORKSPACE}) ${GITHUB_WORKSPACE}"
157      working-directory: ${{ runner.temp }}
158
159    - name: bigendian interop - host build
160      if: env.SSHFS == 'true' && env.BIGENDIAN == 'true'
161      run: |
162        set -x
163        ./.github/configure.sh ${{ matrix.config }}
164        pwd
165        ls -ld regress || true
166        ls -l regress/check-perm || true
167        make clean
168        make
169
170    - name: bigendian interop - test
171      if: env.SSHFS == 'true' && env.BIGENDIAN == 'true'
172      env:
173        TEST_SSH_UNSAFE_PERMISSIONS: 1
174      run: |
175        set -x
176        echo "#!/bin/sh" >remote_sshd
177        echo "exec /usr/bin/ssh ${TARGET_DOMAIN} exec /home/builder/$(basename ${GITHUB_WORKSPACE})/sshd "'$@' >>remote_sshd
178        chmod 755 remote_sshd
179        make t-exec TEST_SSH_SSHD=`pwd`/remote_sshd LTESTS="try-ciphers kextype keytype"
180
181    - name: bigendian interop - save logs
182      if: failure() && env.BIGENDIAN == 'true'
183      uses: actions/upload-artifact@main
184      with:
185        name: ${{ matrix.target }}-${{ matrix.config }}-interop-logs
186        path: |
187          config.h
188          config.log
189          regress/*.log
190          regress/log/*
191
192    - name: bigendian interop - unmount regress
193      if: always() && env.SSHFS == 'true' && env.BIGENDIAN == 'true'
194      run: fusermount -z -u ${GITHUB_WORKSPACE}/regress || true
195      working-directory: ${{ runner.temp }}
196
197    - name: lazily unmount workspace
198      if: always() && env.SSHFS == 'true'
199      run: fusermount -z -u ${GITHUB_WORKSPACE} || true
200      working-directory: ${{ runner.temp }}
201    - name: shutdown VM
202      if: always() && env.VM == 'true'
203      run: vmshutdown
204