forked from canonical/rockcraft
-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (80 loc) · 2.72 KB
/
Copy pathspread.yaml
File metadata and controls
86 lines (80 loc) · 2.72 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: Spread tests for source
on:
pull_request:
push:
branches:
- main
schedule:
- cron: "0 0 */2 * *"
jobs:
snap-build:
runs-on: ubuntu-24.04
outputs:
source-files: ${{ steps.filter.outputs.source-files }}
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Check which files changed
id: filter
uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
with:
# Combine multiple negation checks into a union (¬A ∧ ¬B ∧ ¬C), because individual entries are checked independently (A ∨ B ∨ C).
# If we ever need to filter only for docs, glob 'docs/**/*' and '**/*.md'
filters: |
source-files:
- '!({docs/**,*.md,**/*.md,.readthedocs.yaml})'
- name: Build snap
id: rockcraft
uses: canonical/action-build@v1
if: ${{ steps.filter.outputs.source-files == 'true' || github.event_name == 'schedule' }}
- name: Upload snap artifact
uses: actions/upload-artifact@v7
if: ${{ steps.filter.outputs.source-files == 'true' || github.event_name == 'schedule' }}
with:
name: snap
path: ${{ steps.rockcraft.outputs.snap }}
source-spread-tests:
runs-on: [self-hosted, spread-installed]
needs: [snap-build]
if: ${{ needs.snap-build.outputs.source-files == 'true' || github.event_name == 'schedule' }}
steps:
- name: Cleanup job workspace
run: |
rm -rf "${{ github.workspace }}"
mkdir "${{ github.workspace }}"
- name: Checkout rockcraft
uses: actions/checkout@v6
with:
fetch-depth: 0
submodules: true
- name: Download snap artifact
uses: actions/download-artifact@v8
with:
name: snap
path: tests
- name: Run Ubuntu Pro spread tests
env:
UBUNTU_PRO_TOKEN: ${{ secrets.UBUNTU_PRO_TOKEN }}
run: |
if [ -z "$UBUNTU_PRO_TOKEN" ]; then
if [ "${{ github.event.pull_request.head.repo.full_name }}" == "canonical/rockcraft" ]; then
echo "Error: UBUNTU_PRO_TOKEN is not set."
exit 1
else
echo "Warning: UBUNTU_PRO_TOKEN is not set. Skipping Pro tests"
exit 0
fi
fi
spread google:tests/spread/pro/
- name: Run source spread tests
run: |
spread google:...tests...
- name: Discard spread workers
if: always()
run: |
shopt -s nullglob
for r in .spread-reuse.*.yaml; do
spread -discard -reuse-pid="$(echo "$r" | grep -o -E '[0-9]+')"
done