-
Notifications
You must be signed in to change notification settings - Fork 53
77 lines (67 loc) · 2.15 KB
/
spread.yaml
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
name: Spread
run-name: Spread for ${{ github.ref }}
on:
workflow_call:
jobs:
spread-tests:
strategy:
matrix:
runner:
- name: X64
runs-on: ubuntu-latest
- name: ARM64
runs-on: [noble, ARM64, large]
name: Run Spread tests | ${{ matrix.runner.name }}
runs-on: ${{ matrix.runner.runs-on }}
steps:
- uses: actions/checkout@v4
- name: Check changed paths
id: changed-slices
uses: dorny/paths-filter@v3
with:
filters: |
slices:
- added|modified: 'slices/**/*.yaml'
list-files: shell
- name: Check changed test directories
uses: tj-actions/changed-files@v45
id: changed-tests
with:
separator: " "
dir_names: "true"
files: |
tests/spread/integration/**
- uses: actions/checkout@v4
with:
repository: snapcore/spread
path: _spread
- uses: actions/setup-go@v3
with:
go-version: '>=1.17.0'
- name: Install LXD
uses: canonical/[email protected]
with:
channel: 5.21/stable
- name: Prepare Spread suites
id: spread-suites
env:
integration-tests: "tests/spread/integration"
backend: "lxd"
run: |
set -ex
spread_tasks=""
for file in ${{ steps.changed-slices.outputs.slices_files }} ${{ steps.changed-tests.outputs.all_changed_files }}
do
pkg_name=$(basename $file | sed 's/\.yaml//g')
pkg_tests="${{ env.integration-tests }}/${pkg_name}"
if [ -f "${pkg_tests}/task.yaml" ] && [[ $spread_tasks != *"${pkg_tests}"* ]]
then
spread_tasks="${spread_tasks} ${{ env.backend }}:${pkg_tests}"
fi
done
echo "run-tasks=$(echo ${spread_tasks} | awk '{$1=$1};1')" >> $GITHUB_OUTPUT
- name: Build and run spread
if: ${{ steps.spread-suites.outputs.run-tasks }}
run: |
(cd _spread/cmd/spread && go build)
_spread/cmd/spread/spread -v ${{ steps.spread-suites.outputs.run-tasks }}