xref: /freebsd/crypto/openssh/.github/workflows/upstream.yml (revision 8e28d84935f2f0ee081d44f9803f3052b960e50b)
1name: Upstream self-hosted
2
3on:
4  push:
5    branches: [ master ]
6    paths: [ '**.c', '**.h', '**.sh', '.github/configs', '.github/workflows/upstream.yml' ]
7
8jobs:
9  selfhosted:
10    name: "upstream ${{ matrix.target }} ${{ matrix.config }}"
11    if: github.repository == 'openssh/openssh-portable-selfhosted'
12    runs-on: ${{ matrix.host }}
13    env:
14      DEBUG_ACTIONS: true
15      EPHEMERAL: true
16      HOST:  ${{ matrix.host }}
17      TARGET_HOST: ${{ matrix.target }}
18      TARGET_CONFIG: ${{ matrix.config }}
19      TARGET_DOMAIN: ${{ format('{0}-{1}-{2}', matrix.target, matrix.config, github.run_id) || matrix.target }}
20    strategy:
21      fail-fast: false
22      matrix:
23        host:
24          - libvirt
25        target: [ obsdsnap, obsdsnap-i386 ]
26        config: [ default, without-openssl, ubsan ]
27        include:
28          - { host: libvirt-arm64, target: obsdsnap-arm64, config: default }
29          - { host: libvirt-arm64, target: obsdsnap-arm64, config: without-openssl }
30          - { host: libvirt-arm64, target: obsdsnap-arm64, config: ubsan }
31    steps:
32    - name: unmount stale workspace
33      run: fusermount -u ${GITHUB_WORKSPACE} || true
34      working-directory: ${{ runner.temp }}
35    - name: shutdown VM if running
36      run: vmshutdown
37      working-directory: ${{ runner.temp }}
38    - uses: actions/checkout@main
39    - name: startup VM
40      run: vmstartup
41      working-directory: ${{ runner.temp }}
42    - name: copy and mount workspace
43      run: sshfs_mount
44      working-directory: ${{ runner.temp }}
45    - name: update source
46      run: vmrun "cd /usr/src && cvs up -dPA usr.bin/ssh regress/usr.bin/ssh"
47    - name: make clean
48      run: vmrun "cd /usr/src/usr.bin/ssh && make obj && make clean && cd /usr/src/regress/usr.bin/ssh && make obj && make clean && sudo chmod -R g-w /usr/src /usr/obj"
49    - name: make
50      run: vmrun "cd /usr/src/usr.bin/ssh && case ${{ matrix.config }} in without-openssl) make OPENSSL=no;; ubsan) make DEBUG='-fsanitize-minimal-runtime -fsanitize=undefined';; *) make; esac"
51    - name: make install
52      run: vmrun "cd /usr/src/usr.bin/ssh && sudo make install && sudo /etc/rc.d/sshd -f restart"
53    - name: make tests`
54      run: vmrun "cd /usr/src/regress/usr.bin/ssh && case ${{ matrix.config }} in without-openssl) make OPENSSL=no;; ubsan) make DEBUG='-fsanitize-minimal-runtime -fsanitize=undefined';; *) make; esac"
55      env:
56        SUDO: sudo
57      timeout-minutes: 300
58    - name: show logs
59      if: failure()
60      run: vmrun 'for i in /usr/src/regress/usr.bin/ssh/obj/*.log; do echo ====; echo logfile $i; echo =====; cat $i; done'
61    - name: save logs
62      if: failure()
63      uses: actions/upload-artifact@main
64      with:
65        name: ${{ matrix.target }}-${{ matrix.config }}-logs
66        path: |
67          /usr/src/regress/usr.bin/ssh/obj/*.log
68          /usr/src/regress/usr.bin/ssh/obj/log/*
69    - name: unmount workspace
70      if: always()
71      run: |
72        fusermount -u ${GITHUB_WORKSPACE} || true
73        fusermount -z -u ${GITHUB_WORKSPACE} || true
74      working-directory: ${{ runner.temp }}
75    - name: shutdown VM
76      if: always()
77      run: vmshutdown
78      working-directory: ${{ runner.temp }}
79