Skip to content

Commit 45b32ff

Browse files
authored
Merge pull request #179 from per1234/test-artifact
Generate test build artifacts
2 parents 182dbba + 1eedcc6 commit 45b32ff

File tree

1 file changed

+85
-3
lines changed

1 file changed

+85
-3
lines changed

Diff for: .github/workflows/test.yml

+85-3
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:
@@ -58,9 +61,6 @@ jobs:
5861
- name: Check for forgotten code generation
5962
run: git diff --color --exit-code
6063

61-
- name: Build
62-
run: task build
63-
6464
- name: Run unit tests
6565
run: task go:test-unit
6666

@@ -82,3 +82,85 @@ jobs:
8282

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

0 commit comments

Comments
 (0)