|
32 | 32 | SETUP_BUILDKIT_IMAGE: moby/buildkit:latest |
33 | 33 |
|
34 | 34 | jobs: |
35 | | - unit-prepare: |
36 | | - runs-on: ubuntu-24.04 |
37 | | - timeout-minutes: 10 # guardrails timeout for the whole job |
38 | | - continue-on-error: ${{ github.event_name != 'pull_request' }} |
39 | | - outputs: |
40 | | - includes: ${{ steps.set.outputs.includes }} |
41 | | - steps: |
42 | | - - |
43 | | - name: Create matrix includes |
44 | | - id: set |
45 | | - uses: actions/github-script@v7 |
46 | | - with: |
47 | | - script: | |
48 | | - let includes = [ |
49 | | - { mode: '' }, |
50 | | - { mode: 'systemd' }, |
51 | | - ]; |
52 | | - if ("${{ inputs.storage }}" == "snapshotter") { |
53 | | - includes.push({ mode: 'firewalld' }); |
54 | | - } |
55 | | - await core.group(`Set matrix`, async () => { |
56 | | - core.info(`matrix: ${JSON.stringify(includes)}`); |
57 | | - core.setOutput('includes', JSON.stringify(includes)); |
58 | | - }); |
59 | | - - |
60 | | - name: Show matrix |
61 | | - run: | |
62 | | - echo ${{ steps.set.outputs.includes }} |
63 | | -
|
64 | | - unit: |
65 | | - runs-on: ubuntu-24.04 |
66 | | - timeout-minutes: 120 # guardrails timeout for the whole job |
67 | | - continue-on-error: ${{ github.event_name != 'pull_request' }} |
68 | | - needs: |
69 | | - - unit-prepare |
70 | | - strategy: |
71 | | - fail-fast: false |
72 | | - matrix: |
73 | | - include: ${{ fromJson(needs.unit-prepare.outputs.includes) }} |
74 | | - steps: |
75 | | - - |
76 | | - name: Checkout |
77 | | - uses: actions/checkout@v4 |
78 | | - - |
79 | | - name: Set up runner |
80 | | - uses: ./.github/actions/setup-runner |
81 | | - - |
82 | | - name: Prepare |
83 | | - run: | |
84 | | - CACHE_DEV_SCOPE=dev |
85 | | - if [[ "${{ matrix.mode }}" == *"firewalld"* ]]; then |
86 | | - echo "FIREWALLD=true" >> $GITHUB_ENV |
87 | | - CACHE_DEV_SCOPE="${CACHE_DEV_SCOPE}firewalld" |
88 | | - fi |
89 | | - if [[ "${{ matrix.mode }}" == *"systemd"* ]]; then |
90 | | - echo "SYSTEMD=true" >> $GITHUB_ENV |
91 | | - CACHE_DEV_SCOPE="${CACHE_DEV_SCOPE}systemd" |
92 | | - fi |
93 | | - echo "CACHE_DEV_SCOPE=${CACHE_DEV_SCOPE}" >> $GITHUB_ENV |
94 | | - - |
95 | | - name: Set up Docker Buildx |
96 | | - uses: docker/setup-buildx-action@v3 |
97 | | - with: |
98 | | - version: ${{ env.SETUP_BUILDX_VERSION }} |
99 | | - driver-opts: image=${{ env.SETUP_BUILDKIT_IMAGE }} |
100 | | - buildkitd-flags: --debug |
101 | | - - |
102 | | - name: Build dev image |
103 | | - uses: docker/bake-action@v6 |
104 | | - with: |
105 | | - targets: dev |
106 | | - set: | |
107 | | - dev.cache-from=type=gha,scope=dev |
108 | | - - |
109 | | - name: Test |
110 | | - run: | |
111 | | - make -o build test-unit |
112 | | - - |
113 | | - name: Prepare reports |
114 | | - if: always() |
115 | | - run: | |
116 | | - mkdir -p bundles /tmp/reports |
117 | | - find bundles -path '*/root/*overlay2' -prune -o -type f \( -name '*-report.json' -o -name '*.log' -o -name '*.out' -o -name '*.prof' -o -name '*-report.xml' \) -print | xargs sudo tar -czf /tmp/reports.tar.gz |
118 | | - tar -xzf /tmp/reports.tar.gz -C /tmp/reports |
119 | | - sudo chown -R $(id -u):$(id -g) /tmp/reports |
120 | | - tree -nh /tmp/reports |
121 | | - - |
122 | | - name: Send to Codecov |
123 | | - uses: codecov/codecov-action@v4 |
124 | | - with: |
125 | | - directory: ./bundles |
126 | | - env_vars: RUNNER_OS |
127 | | - flags: unit |
128 | | - token: ${{ secrets.CODECOV_TOKEN }} # used to upload coverage reports: https://github.com/moby/buildkit/pull/4660#issue-2142122533 |
129 | | - - |
130 | | - name: Upload reports |
131 | | - if: always() |
132 | | - uses: actions/upload-artifact@v4 |
133 | | - with: |
134 | | - name: test-reports-unit-${{ inputs.storage }}-${{ matrix.mode }} |
135 | | - path: /tmp/reports/* |
136 | | - retention-days: 1 |
137 | | - |
138 | | - unit-report: |
139 | | - runs-on: ubuntu-24.04 |
140 | | - timeout-minutes: 10 |
141 | | - continue-on-error: ${{ github.event_name != 'pull_request' }} |
142 | | - if: always() |
143 | | - needs: |
144 | | - - unit |
145 | | - steps: |
146 | | - - |
147 | | - name: Set up Go |
148 | | - uses: actions/setup-go@v5 |
149 | | - with: |
150 | | - go-version: ${{ env.GO_VERSION }} |
151 | | - cache-dependency-path: vendor.sum |
152 | | - - |
153 | | - name: Download reports |
154 | | - uses: actions/download-artifact@v4 |
155 | | - with: |
156 | | - pattern: test-reports-unit-${{ inputs.storage }}-* |
157 | | - path: /tmp/reports |
158 | | - - |
159 | | - name: Install teststat |
160 | | - run: | |
161 | | - go install github.com/vearutop/teststat@${{ env.TESTSTAT_VERSION }} |
162 | | - - |
163 | | - name: Create summary |
164 | | - run: | |
165 | | - find /tmp/reports -type f -name '*-go-test-report.json' -exec teststat -markdown {} \+ >> $GITHUB_STEP_SUMMARY |
166 | | -
|
167 | 35 | docker-py: |
168 | 36 | runs-on: ubuntu-24.04 |
169 | 37 | timeout-minutes: 120 # guardrails timeout for the whole job |
|
0 commit comments