-
Notifications
You must be signed in to change notification settings - Fork 0
209 lines (193 loc) · 5.8 KB
/
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# SPDX-FileCopyrightText: 2022 Weston Schmidt <[email protected]>
# SPDX-License-Identifier: Apache-2.0
---
name: 'Program in cmd dir CI Test'
on:
push:
branches:
- 'main'
paths:
- '.github/workflows/tests.yml'
- '.github/workflows/ci.yml'
- '.reuse/*'
- 'command/**'
- 'command/cmd/foo/**'
- 'library/**'
- 'program/**'
- 'README.md'
tags:
- 'v1.*'
pull_request:
workflow_dispatch:
jobs:
command:
# Normally don't use a workflow without the @{ref}. In this case, we want
# to run the workflow specified by the branch instead of what is associated
# with a reference so we can test that the change works.
uses: ./.github/workflows/ci.yml
if: |
startsWith(github.ref, 'refs/tags/') == false
with:
license-skip: true
release-skip-publish: --skip-publish
working-directory: command
release-main-package: ./cmd/foo
release-type: program
release-docker: true
release-docker-file: ./cmd/foo/Dockerfile
upload-skip: true
secrets: inherit
command-tag:
uses: ./.github/workflows/ci.yml
if: |
startsWith(github.ref, 'refs/tags/')
with:
copyright-skip: true
build-skip: true
lint-skip: true
license-skip: true
style-skip: true
#tests-skip: true
release-skip-publish: --skip-publish
working-directory: command
release-main-package: ./cmd/foo
release-binary-name: foo
release-type: program
release-docker: true
release-docker-file: ./cmd/foo/Dockerfile
release-docker-latest: true
release-docker-major: true
release-docker-minor: true
upload-skip: true
secrets: inherit
program:
uses: ./.github/workflows/ci.yml
if: |
startsWith(github.ref, 'refs/tags/') == false
with:
license-skip: true
release-skip-publish: --skip-publish
working-directory: program
release-type: program
release-docker: true
release-docker-extras: |
main.go
upload-skip: true
secrets: inherit
program-tag:
uses: ./.github/workflows/ci.yml
if: |
startsWith(github.ref, 'refs/tags/')
with:
copyright-skip: true
build-skip: true
lint-skip: true
license-skip: true
style-skip: true
#tests-skip: true
release-skip-publish: --skip-publish
release-binary-name: programtest
working-directory: program
release-type: program
release-docker: true
release-docker-latest: true
release-docker-major: true
release-docker-minor: true
release-docker-extras: |
main.go
go.mod
upload-skip: true
secrets: inherit
library:
uses: ./.github/workflows/ci.yml
if: |
startsWith(github.ref, 'refs/tags/') == false
with:
license-skip: true
release-skip-publish: --skip-publish
working-directory: library
release-type: library
release-project-name: library
upload-skip: true
secrets: inherit
library-tag:
uses: ./.github/workflows/ci.yml
if: |
startsWith(github.ref, 'refs/tags/')
with:
copyright-skip: true
build-skip: true
lint-skip: true
license-skip: true
style-skip: true
#tests-skip: true
release-skip-publish: --skip-publish
working-directory: library
release-type: library
release-project-name: library
upload-skip: true
secrets: inherit
slow-things:
uses: ./.github/workflows/ci.yml
if: |
startsWith(github.ref, 'refs/tags/') == false
with:
working-directory: program
release-type: program
release-project-name: program
release-skip-publish: --skip-publish
upload-skip: true
yaml-lint-skip: false
secrets: inherit
slow-things-library:
uses: ./.github/workflows/ci.yml
if: |
startsWith(github.ref, 'refs/tags/') == false
with:
working-directory: library
release-type: library
release-project-name: library
release-skip-publish: --skip-publish
upload-skip: true
secrets: inherit
tag:
needs:
- command
- program
- library
- slow-things
- slow-things-library
runs-on: ubuntu-latest
if: |
always() &&
startsWith(github.ref, 'refs/tags/') == false &&
needs.command.result != 'failure' &&
needs.program.result != 'failure' &&
needs.library.result != 'failure' &&
needs.slow-things.result != 'failure' &&
needs.slow-things-library.result != 'failure'
steps:
- name: Checkout the code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
token: ${{ secrets.PUSH_TAG_TOKEN }}
- name: Tag for testing the release
shell: bash
run: |
patch=`date +%s`
git tag "v1.0.${patch}"
git push --tags
done:
needs: [ command-tag, program-tag, library-tag ]
runs-on: ubuntu-latest
if: |
always() &&
startsWith(github.ref, 'refs/tags/') == true &&
needs.command-tag.result != 'failure' &&
needs.program-tag.result != 'failure' &&
needs.library-tag.result != 'failure'
steps:
- name: Test Complete
shell: bash
run: |
echo "Test Complete"