xref: /freebsd/crypto/openssh/.github/workflows/selfhosted.yml (revision f9bc005b8ef3b507a5ecbc2d7fe4411ef70eff38)
1name: CI self-hosted
2
3on:
4  push:
5    paths: [ '**.c', '**.h', '**.m4', '**.sh', '**/Makefile.in', 'configure.ac', '.github/configs', '.github/run_tests.sh', '.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      HOST: ${{ matrix.host }}
15      TARGET_HOST: ${{ matrix.target }}
16      TARGET_CONFIG: ${{ matrix.config }}
17      TARGET_DOMAIN: ${{ startsWith(matrix.host, 'libvirt') && format('{0}-{1}-{2}', matrix.target, matrix.config, github.run_id) || matrix.target }}
18      EPHEMERAL: ${{ startsWith(matrix.host, 'libvirt') }}
19      PERSISTENT: ${{ startsWith(matrix.host, 'persist') }}
20      REMOTE: ${{ startsWith(matrix.host, 'remote') }}
21      VM: ${{ startsWith(matrix.host, 'libvirt') || startsWith(matrix.host, 'persist') }}
22      SSHFS: ${{ startsWith(matrix.host, 'libvirt') || startsWith(matrix.host, 'persist') || startsWith(matrix.host, 'remote') }}
23      BIGENDIAN: ${{ matrix.target == 'aix51' || matrix.target == 'nbsd-arm64be' || matrix.target == 'openwrt-mips' }}
24    strategy:
25      fail-fast: false
26      # We use a matrix in two parts: firstly all of the VMs are tested with the
27      # default config.  "target" corresponds to a label associated with the
28      # worker.  The default is an ephemeral VM running under libvirt.
29      matrix:
30        target:
31          - alpine
32          - centos7
33          - debian-i386
34          - dfly30
35          - dfly48
36          - dfly60
37          - dfly62
38          - dfly64
39          - fbsd10
40          - fbsd12
41          - fbsd13
42          - fbsd14
43          - nbsd3
44          - nbsd4
45          - nbsd8
46          - nbsd9
47          - nbsd10
48          - obsd51
49          - obsd67
50          - obsd72
51          - obsd74
52          - obsd76
53          - obsd77
54          - obsd78
55          - obsdsnap
56          - obsdsnap-i386
57          - omnios
58          - openindiana
59          - ubuntu-2204
60        config:
61          - default
62        host:
63          - libvirt
64        include:
65          # Long-running/slow tests have access to high priority runners.
66          - { target: aix51, 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: obsdsnap-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          - { target: nbsd-arm64be, config: default, host: remote-nbsd-arm64be }
104    steps:
105    - name: shutdown VM if running
106      if: env.VM == 'true'
107      run: vmshutdown
108    - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # main
109    - name: autoreconf
110      run: autoreconf
111    - name: startup VM
112      if: env.VM == 'true'
113      run: vmstartup
114      working-directory: ${{ runner.temp }}
115    - name: copy and mount workspace
116      if: env.SSHFS == 'true'
117      run: sshfs_mount
118      working-directory: ${{ runner.temp }}
119    - name: configure
120      run: vmrun ./.github/configure.sh ${{ matrix.config }}
121#    - name: save config
122#      uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # main
123#      with:
124#        name: ${{ matrix.target }}-${{ matrix.config }}-config
125#        path: config.h
126    - name: make clean
127      run: vmrun make clean
128    - name: make
129      run: vmrun make
130    - name: make tests
131      run: vmrun ./.github/run_test.sh ${{ matrix.config }}
132      timeout-minutes: 600
133    - name: show logs
134      if: failure()
135      run: vmrun 'for i in regress/failed*.log; do echo ====; echo logfile $i; echo =====; cat $i; done'
136    - name: save logs
137      if: failure()
138      uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # main
139      with:
140        name: ${{ matrix.target }}-${{ matrix.config }}-logs
141        path: |
142          config.h
143          config.log
144          regress/*.log
145          regress/log/*
146          regress/valgrind-out/
147    - name: unmount workspace
148      if: always() && env.SSHFS == 'true'
149      run: fusermount -u ${GITHUB_WORKSPACE} || true
150      working-directory: ${{ runner.temp }}
151
152    - name: bigendian interop - mount regress
153      if: env.SSHFS == 'true' && env.BIGENDIAN == 'true'
154      run: |
155        set -x
156        vmrun sudo chown -R $LOGNAME ~/$(basename ${GITHUB_WORKSPACE}) || true
157        vmrun "cd $(basename ${GITHUB_WORKSPACE}/regress) && sudo make clean"
158        sshfs_mount regress
159        vmrun "sudo mkdir -p $(dirname ${GITHUB_WORKSPACE})"
160        vmrun "sudo ln -s ~/$(basename ${GITHUB_WORKSPACE}) ${GITHUB_WORKSPACE}"
161      working-directory: ${{ runner.temp }}
162
163    - name: bigendian interop - host build
164      if: env.SSHFS == 'true' && env.BIGENDIAN == 'true'
165      run: |
166        set -x
167        ./.github/configure.sh ${{ matrix.config }}
168        pwd
169        ls -ld regress || true
170        ls -l regress/check-perm || true
171        make clean
172        make
173
174    - name: bigendian interop - test
175      if: env.SSHFS == 'true' && env.BIGENDIAN == 'true'
176      env:
177        TEST_SSH_UNSAFE_PERMISSIONS: 1
178      run: |
179        set -x
180        echo "#!/bin/sh" >remote_sshd
181        echo "exec /usr/bin/ssh ${TARGET_DOMAIN} exec /home/builder/$(basename ${GITHUB_WORKSPACE})/sshd "'$@' >>remote_sshd
182        chmod 755 remote_sshd
183        make t-exec TEST_SSH_SSHD=`pwd`/remote_sshd LTESTS="try-ciphers kextype keytype"
184
185    - name: bigendian interop - save logs
186      if: failure() && env.BIGENDIAN == 'true'
187      uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # main
188      with:
189        name: ${{ matrix.target }}-${{ matrix.config }}-interop-logs
190        path: |
191          config.h
192          config.log
193          regress/*.log
194          regress/log/*
195
196    - name: bigendian interop - unmount regress
197      if: always() && env.SSHFS == 'true' && env.BIGENDIAN == 'true'
198      run: fusermount -z -u ${GITHUB_WORKSPACE}/regress || true
199      working-directory: ${{ runner.temp }}
200
201    - name: lazily unmount workspace
202      if: always() && env.SSHFS == 'true'
203      run: fusermount -z -u ${GITHUB_WORKSPACE} || true
204      working-directory: ${{ runner.temp }}
205    - name: shutdown VM
206      if: always() && env.VM == 'true'
207      run: vmshutdown
208