Skip to content

Commit 7224c03

Browse files
committed
Generate test build artifacts
Providing pre-built binaries for every pull request or commit that changes relevant files enables any interested party to participate in the review or beta testing process without imposing the requirement to set up the build toolchain on their local machine. This will also avoid any chance of differences between the tester's environment and the release system environment introducing spurious results.
1 parent 182dbba commit 7224c03

File tree

1 file changed

+85
-0
lines changed

1 file changed

+85
-0
lines changed

.github/workflows/test.yml

+85
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ on:
2626
- "test/**"
2727
- "Taskfile.yml"
2828

29+
env:
30+
BUILDS_ARTIFACT: build-artifacts
31+
2932
jobs:
3033
test-go:
3134
strategy:
@@ -82,3 +85,85 @@ jobs:
8285

8386
- name: Run integration tests
8487
run: task test-integration
88+
89+
build:
90+
runs-on: ubuntu-latest
91+
92+
steps:
93+
- name: Checkout repository
94+
uses: actions/checkout@v1
95+
with:
96+
fetch-depth: 0
97+
98+
- name: Install Taskfile
99+
uses: arduino/setup-task@v1
100+
with:
101+
repo-token: ${{ secrets.GITHUB_TOKEN }}
102+
version: 3.x
103+
104+
- name: Build
105+
run: |
106+
PACKAGE_NAME_PREFIX="${{ github.workflow }}"
107+
if [ "${{ github.event_name }}" = "pull_request" ]; then
108+
PACKAGE_NAME_PREFIX="$PACKAGE_NAME_PREFIX-${{ github.event.number }}"
109+
fi
110+
PACKAGE_NAME_PREFIX="$PACKAGE_NAME_PREFIX-${{ github.sha }}-"
111+
export PACKAGE_NAME_PREFIX
112+
task dist:all
113+
114+
# Transfer builds to artifacts job
115+
- name: Upload combined builds artifact
116+
uses: actions/upload-artifact@v2
117+
with:
118+
path: dist/
119+
name: ${{ env.BUILDS_ARTIFACT }}
120+
121+
artifacts:
122+
name: ${{ matrix.artifact.name }} artifact
123+
needs: build
124+
runs-on: ubuntu-latest
125+
126+
strategy:
127+
matrix:
128+
artifact:
129+
- path: "*checksums.txt"
130+
name: checksums
131+
- path: "*Linux_32bit.tar.gz"
132+
name: Linux_X86-32
133+
- path: "*Linux_64bit.tar.gz"
134+
name: Linux_X86-64
135+
- path: "*Linux_ARM64.tar.gz"
136+
name: Linux_ARM64
137+
- path: "*Linux_ARMv6.tar.gz"
138+
name: Linux_ARMv6
139+
- path: "*Linux_ARMv7.tar.gz"
140+
name: Linux_ARMv7
141+
- path: "*macOS_64bit.tar.gz"
142+
name: macOS_64
143+
- path: "*Windows_32bit.zip"
144+
name: Windows_X86-32
145+
- path: "*Windows_64bit.zip"
146+
name: Windows_X86-64
147+
148+
steps:
149+
- name: Download combined builds artifact
150+
uses: actions/download-artifact@v2
151+
with:
152+
name: ${{ env.BUILDS_ARTIFACT }}
153+
path: ${{ env.BUILDS_ARTIFACT }}
154+
155+
- name: Upload individual build artifact
156+
uses: actions/upload-artifact@v2
157+
with:
158+
path: ${{ env.BUILDS_ARTIFACT }}/${{ matrix.artifact.path }}
159+
name: ${{ matrix.artifact.name }}
160+
161+
clean:
162+
needs: artifacts
163+
runs-on: ubuntu-latest
164+
165+
steps:
166+
- name: Remove unneeded combined builds artifact
167+
uses: geekyeggo/delete-artifact@v1
168+
with:
169+
name: ${{ env.BUILDS_ARTIFACT }}

0 commit comments

Comments
 (0)