Skip to content

Commit ee70757

Browse files
Jakub Sliacanadrianriobo
authored andcommitted
gha: unify all windows artifacts builds into one workflow
This helps circumvent multiple complications. One, windows-e2e workflow does not need to wait for 2 workflows to finish (which is hard for a workflow_run triggered workflow). Two, we do not need to worry about matching the right artifacts from builder workflows with the right workflow_run that needs them (formerly used commit sha to do this). Third, the organization of workflows becomes logical: builder that prepares artifacts, and tester that consumes them and runs tests.
1 parent 24a6552 commit ee70757

4 files changed

Lines changed: 103 additions & 113 deletions

File tree

.github/workflows/build-tests.yml

Lines changed: 0 additions & 53 deletions
This file was deleted.
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: Build Windows artifacts
2+
on:
3+
push:
4+
branches:
5+
- "main"
6+
pull_request: {}
7+
8+
env:
9+
IMAGE_NAME_E2E: crc-e2e
10+
IMAGE_NAME_INTEGRATION: crc-integration
11+
12+
jobs:
13+
build-installer:
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
os:
19+
- windows-2022
20+
go:
21+
- '1.20'
22+
steps:
23+
- name: Check out repository code
24+
uses: actions/checkout@v3
25+
- name: Set up Go
26+
uses: actions/setup-go@v4
27+
with:
28+
go-version: ${{ matrix.go }}
29+
- name: Set path for heat.exe and light.exe
30+
run: echo "$WIX\\bin" >>$GITHUB_PATH
31+
shell: bash
32+
- name: Build Windows installer
33+
run: make out/windows-amd64/crc-windows-installer.zip
34+
- name: Upload windows installer artifact
35+
uses: actions/upload-artifact@v3
36+
with:
37+
name: Windows Installer (${{ matrix.os }})
38+
path: "./out/windows-amd64/crc-windows-installer.zip"
39+
40+
build-e2e:
41+
runs-on: ubuntu-latest
42+
strategy:
43+
fail-fast: false
44+
45+
steps:
46+
- name: Check out repository code
47+
uses: actions/checkout@v3
48+
49+
- name: Build and archive e2e image
50+
# use github.sha as ID to correlate various workflows triggered by the same event
51+
run: |
52+
CRC_E2E_IMG_VERSION=gh make containerized_e2e
53+
podman save -o ${{ env.IMAGE_NAME_E2E }}.tar quay.io/crcont/${{ env.IMAGE_NAME_E2E}}:gh
54+
55+
- name: Upload e2e image
56+
uses: actions/upload-artifact@v3
57+
with:
58+
name: ${{ env.IMAGE_NAME_E2E }}-gh
59+
path: ${{ env.IMAGE_NAME_E2E }}.tar
60+
61+
build-integration:
62+
runs-on: ubuntu-latest
63+
strategy:
64+
fail-fast: false
65+
66+
steps:
67+
- name: Check out repository code
68+
uses: actions/checkout@v3
69+
70+
- name: Build and archive integration image
71+
# use github.sha as ID to correlate various workflows triggered by the same event
72+
run: |
73+
CRC_INTEGRATION_IMG_VERSION=gh make containerized_integration
74+
podman save -o ${{ env.IMAGE_NAME_INTEGRATION }}.tar quay.io/crcont/${{ env.IMAGE_NAME_INTEGRATION }}:gh
75+
76+
- name: Upload integration image
77+
uses: actions/upload-artifact@v3
78+
with:
79+
name: ${{ env.IMAGE_NAME_INTEGRATION }}-gh
80+
path: ${{ env.IMAGE_NAME_INTEGRATION }}.tar
81+
82+
save-gh-context:
83+
runs-on: ubuntu-latest
84+
strategy:
85+
fail-fast: false
86+
87+
steps:
88+
89+
- name: Save the GH context in an artifact
90+
shell: bash
91+
env:
92+
GH_CONTEXT: ${{ toJSON(github) }}
93+
run: echo $GH_CONTEXT > gh_context.json
94+
95+
- name: Upload the GH context artifact
96+
uses: actions/upload-artifact@v3
97+
with:
98+
name: gh_context
99+
path: ./gh_context.json

.github/workflows/windows-e2e.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Windows e2e
22

33
on:
44
workflow_run:
5-
workflows: [Build Windows installer]
5+
workflows: [Build Windows artifacts]
66
types:
77
- completed
88

@@ -31,9 +31,6 @@ jobs:
3131
run: |
3232
set -xuo
3333
34-
# SHA used as ID to correlate artifacts between buld-tests, windows-installer, and windows-e2e workflows
35-
echo "SHA=$(cat gh_context.json | jq -r '.sha')" >> "$GITHUB_ENV"
36-
3734
COMMIT_ID=$(cat gh_context.json | jq -r '.event.after')
3835
# if this is a new PR, .event.after is empty, use .sha instead in that case
3936
if [[ -z "$COMMIT_ID" ]]; then
@@ -136,7 +133,7 @@ jobs:
136133
with:
137134
workflow_conclusion: completed
138135
workflow: build-tests.yml
139-
name: crc-e2e-id${{ env.SHA }}
136+
name: crc-e2e-gh
140137

141138
- name: Run CRC e2e
142139
run: |
@@ -163,7 +160,7 @@ jobs:
163160
-v $PWD/pull-secret:/opt/crc/pull-secret:Z \
164161
-v $PWD/output:/output:Z \
165162
-v $PWD/id_rsa:/opt/crc/id_rsa:Z \
166-
quay.io/crcont/crc-e2e:id-${{ env.SHA }} \
163+
quay.io/crcont/crc-e2e:gh \
167164
-targetFolder ${TARGET_FOLDER} \
168165
-junitResultsPath ${TARGET_FOLDER}/junit
169166
@@ -229,4 +226,4 @@ jobs:
229226
--project-name 'windows-desktop' \
230227
--backed-url 'file:///workspace'
231228
# Check logs
232-
podman logs -f windows-destroy
229+
podman logs -f windows-destroy

.github/workflows/windows-installer.yml

Lines changed: 0 additions & 53 deletions
This file was deleted.

0 commit comments

Comments
 (0)