summaryrefslogtreecommitdiffstats
path: root/.github/workflows/tests.yml
blob: 8dc12fb4fd72a0d34a8d41ece0e91aed83f8cbf9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: tests
on:
  schedule:
    - cron: "0 0 * * *"
  pull_request:
    paths:
      - '*.c'
      - '*.h'
jobs:
  upstream_tests:
     if: ${{ github.repository == 'md-raid-utilities/mdadm' }}
     runs-on: self-hosted
     timeout-minutes: 150
     name: upstream tests
     steps:
     - uses: actions/checkout@v4
       if: ${{ github.event_name == 'pull_request' }}
       with:
        ref: ${{ github.event.pull_request.head.sha }}
        fetch-depth: 0
     - uses: actions/checkout@v4
       if: ${{ github.event_name == 'schedule' }}
       with:
        ref: main
        fetch-depth: 0
     - name: 'Prepare machine'
       run: |
          cd ..
          vagrant halt
          vagrant status
          vagrant up
     - name: 'Run tests'
       run: |
          cd ..
          vagrant ssh -c "cd /home/vagrant/host/mdadm && .github/tools/run_mdadm_tests.sh"
     - name: 'Copy logs to host machine'
       run: |
          cd ..
          vagrant ssh -c "sudo mkdir -p /home/vagrant/host/logs && sudo mv /var/tmp/*.log /home/vagrant/host/logs"
     - name: "Save artifacts"
       uses: actions/upload-artifact@v4
       with:
         name: "Logs from failed tests"
         path: /home/ci/actions-runner/_work/mdadm/logs/*.log
     - name: "Clean logs"
       run: |
          cd ..
          sudo rm /home/ci/actions-runner/_work/mdadm/logs/*.log
  cleanup:
    runs-on: self-hosted
    needs: [upstream_tests]
    steps:
      - name: Restore clean VM
        run:  |
          cd ..
          vagrant up
          vagrant ssh -c "sudo mdadm -Ss"
          vagrant halt