-
Notifications
You must be signed in to change notification settings - Fork 0
142 lines (132 loc) · 4.98 KB
/
context-tests.yml
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# This workflow examines the changed files
# and runs tests depending on what files have changed.
name: "Checks"
on:
push:
branches: [3.*, 4.*, main]
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
workflow_dispatch:
permissions:
contents: read
jobs:
changed-files:
name: "Collate changed files"
runs-on: ubuntu-latest
outputs:
check-build: ${{ steps.filter-files.outputs.check-build }}
check-client: ${{ steps.filter-files.outputs.check-client }}
check-migrate: ${{ steps.filter-files.outputs.check-migrate }}
check-upgrade: ${{ steps.filter-files.outputs.check-upgrade }}
check-terraform: ${{ steps.filter-files.outputs.check-terraform }}
check-snap: ${{ steps.filter-files.outputs.check-snap }}
check-generate: ${{ steps.filter-files.outputs.check-generate }}
steps:
- name: Filter Files
id: filter-files
uses: dorny/paths-filter@v3
with:
filters: |
check-build:
- '**.go'
- 'go.mod'
- '.github/workflows/build.yml'
- 'scripts/dqlite/**'
- 'Makefile'
- 'make_functions.sh'
check-client:
- '**.go'
- 'go.mod'
- '.github/workflows/client-tests.yml'
- 'scripts/dqlite/**'
- 'Makefile'
- 'make_functions.sh'
check-migrate:
- '**.go'
- 'go.mod'
- 'snap/**'
- '.github/workflows/migrate.yml'
- 'scripts/dqlite/**'
- 'Makefile'
- 'make_functions.sh'
check-upgrade:
- '**.go'
- 'go.mod'
- 'snap/**'
- '.github/workflows/upgrade.yml'
- '.github/setup-lxd/**'
- 'scripts/dqlite/**'
- 'Makefile'
- 'make_functions.sh'
check-snap:
- '**.go'
- 'go.mod'
- 'snap/**'
- '.github/workflows/snap.yml'
- 'scripts/dqlite/**'
- 'Makefile'
- 'make_functions.sh'
check-terraform:
- '**.go'
- 'go.mod'
- '.github/workflows/terraform-smoke.yml'
check-generate:
- '**.go'
- 'go.mod'
- '.github/workflows/gen.yml'
build:
needs: [changed-files]
name: Build
if: github.event.pull_request.draft == false && needs.changed-files.outputs.check-build == 'true'
uses: ./.github/workflows/build.yml
snap:
needs: [changed-files]
name: Snap
if: github.event.pull_request.draft == false && needs.changed-files.outputs.check-snap == 'true'
uses: ./.github/workflows/snap.yml
generate:
needs: [changed-files]
name: Generate
if: github.event.pull_request.draft == false && needs.changed-files.outputs.check-generate == 'true'
uses: ./.github/workflows/gen.yml
client:
needs: [changed-files]
name: Client Tests
if: github.event.pull_request.draft == false && needs.changed-files.outputs.check-client == 'true'
uses: ./.github/workflows/client-tests.yml
terraform:
needs: [changed-files]
name: Terraform Smoke
# TODO - always skip terraform tests until they are made reliable on 3.x branches.
if: false && github.event.pull_request.draft == false && github.base_ref != 'main' && needs.changed-files.outputs.check-terraform == 'true'
uses: ./.github/workflows/terraform-smoke.yml
migrate:
needs: [changed-files]
name: Migrate
if: github.event.pull_request.draft == false && needs.changed-files.outputs.check-migrate == 'true'
uses: ./.github/workflows/migrate.yml
upgrade:
needs: [changed-files]
name: Upgrade
if: github.event.pull_request.draft == false && github.base_ref != 'main' && needs.changed-files.outputs.check-upgrade == 'true'
uses: ./.github/workflows/upgrade.yml
result-check:
needs: [build,snap,generate,client,terraform,migrate,upgrade]
runs-on: ubuntu-latest
name: Check Tests Passed
if: always() && !cancelled()
steps:
- name: Check Results
shell: bash
run: |
# TODO - add terraform once ready.
if ${{ needs.build.result == 'success' || needs.build.result == 'skipped' }} \
&& ${{ needs.snap.result == 'success' || needs.snap.result == 'skipped' }} \
&& ${{ needs.generate.result == 'success' || needs.generate.result == 'skipped' }} \
&& ${{ needs.client.result == 'success' || needs.client.result == 'skipped' }} \
&& ${{ needs.terraform.result != 'fix me' || needs.terraform.result == 'skipped' }} \
&& ${{ needs.migrate.result == 'success' || needs.migrate.result == 'skipped' }} \
&& ${{ needs.upgrade.result == 'success' || needs.upgrade.result == 'skipped' }}; then
exit 0
fi
exit 1