-
Notifications
You must be signed in to change notification settings - Fork 214
199 lines (198 loc) · 5.48 KB
/
build_pipelinesrelease_template.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
# Environment variables defined in a calling workflow are not accessible to this reusable workflow. Refer to the documentation for further details on this limitation.
name: build_pipelinesrelease_template
on:
workflow_call:
inputs:
goVersion:
required: false
default: 1.23.3
type: string
registry:
required: false
default: ghcr.io/getporter/test
type: string
shouldPublish:
required: false
default: false
type: boolean
skipTests:
required: false
default: false
type: boolean
jobs:
Validate-build:
name: Native Compile
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4.1.0
- uses: actions/setup-go@v4
with:
go-version: ${{ inputs.goVersion }}
- name: Configure Agent
run: go run mage.go ConfigureAgent
- name: Native Build
run: mage build
shell: bash
- name: Publish Native Binaries
uses: actions/upload-artifact@v4.4.0
with:
name: build-bin
path: "${{ github.workspace }}/bin"
Validate-xbuild:
name: Cross Compile
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4.1.0
with:
fetch-depth: 0
- uses: actions/setup-go@v4
with:
go-version: ${{ inputs.goVersion }}
- name: Configure Agent
run: go run mage.go ConfigureAgent
- name: Cross Compile
run: mage XBuildAll
shell: bash
- name: Publish Release Binaries
uses: actions/upload-artifact@v4.4.0
with:
name: xbuild-bin
path: "${{ github.workspace }}/bin"
Validate-VetLint:
name: Vet and Lint
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4.1.0
- uses: actions/setup-go@v4
with:
go-version: ${{ inputs.goVersion }}
- name: Configure Agent
run: go run mage.go ConfigureAgent
- name: Vet
run: mage Vet
shell: bash
- name: Lint
run: mage Lint
shell: bash
Validate-unit_test:
name: Unit Test
runs-on: ubuntu-latest
if: ${{inputs.skipTests == false}}
steps:
- name: checkout
uses: actions/checkout@v4.1.0
- uses: actions/setup-go@v4
with:
go-version: ${{ inputs.goVersion }}
- name: Configure Agent
run: go run mage.go ConfigureAgent
- name: Unit Test
run: mage TestUnit
shell: bash
Validate-integration_test:
name: Integration Test
needs:
- Validate-build
uses: "./.github/workflows/porter-integration-release.yml"
with:
registry: ${{inputs.registry}}
Validate-smoke_test:
name: Run smoke tests on
needs:
- Validate-xbuild
runs-on: ubuntu-latest
if: success() && ${{inputs.skipTests == false}}
steps:
- name: checkout
uses: actions/checkout@v4.1.0
- uses: actions/setup-go@v4
with:
go-version: ${{ inputs.goVersion }}
- name: Download Cross-Compiled Porter Binaries
uses: actions/download-artifact@v4.1.8
with:
name: xbuild-bin
path: bin
- name: Setup Bin
run: go run mage.go ConfigureAgent UseXBuildBinaries
- name: Run Smoke Tests
run: mage -v TestSmoke
publish_binaries:
name: Publish Binaries
needs:
- Validate-build
- Validate-xbuild
- Validate-VetLint
- Validate-unit_test
- Validate-integration_test
- Validate-smoke_test
runs-on: ubuntu-latest
permissions: write-all
if: success() && ${{ inputs.shouldPublish == true }}
steps:
- name: checkout
uses: actions/checkout@v4.1.0
with:
fetch-depth: 0
- uses: actions/setup-go@v4
with:
go-version: ${{ inputs.goVersion }}
- name: Download Cross-Compiled Porter Binaries
uses: actions/download-artifact@v4.1.8
with:
name: xbuild-bin
path: bin
- name: Setup Bin
run: go run mage.go ConfigureAgent UseXBuildBinaries
- name: Publish Porter Binaries
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
VERSION: ${{github.ref_name}}
run: mage PublishPorter
- name: Publish Porter Mixins
env:
GITHUB_TOKEN: "${{ secrets.PUBLISH_TOKEN }}"
VERSION: ${{github.ref_name}}
run: mage PublishMixins
publish-ghcr:
env:
DOCKER_REGISTRY: ${{inputs.registry}}
DOCKER_USERNAME: getporterbot
VERSION: ${{github.ref_name}}
name: Publish Docker Images
needs:
- Validate-build
- Validate-xbuild
- Validate-VetLint
- Validate-unit_test
- Validate-integration_test
- Validate-smoke_test
runs-on: ubuntu-latest
permissions: write-all
if: success() && ${{inputs.shouldPublish == true}}
steps:
- name: checkout
uses: actions/checkout@v4.1.0
with:
fetch-depth: 0
- uses: actions/setup-go@v4
with:
go-version: ${{ inputs.goVersion }}
- name: Download Cross-Compiled Porter Binaries
uses: actions/download-artifact@v4.1.8
with:
name: xbuild-bin
path: bin
- name: Setup Bin
run: go run mage.go ConfigureAgent UseXBuildBinaries
- name: Login to Container Registry
uses: docker/login-action@v3.0.0
with:
registry: "${{inputs.registry}}"
username: "${{ github.actor }}"
password: "${{ secrets.GITHUB_TOKEN }}"
- name: Publish Docker Images to ${{inputs.registry}}
run: PORTER_REGISTRY=${{inputs.registry}} mage PublishImages PublishServerMultiArchImages