-
-
Notifications
You must be signed in to change notification settings - Fork 12
166 lines (141 loc) · 4.06 KB
/
test.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
name: Run tests
on:
push:
paths:
- ".github/workflows/test.yml"
- "Taskfile.yml"
- "go.mod"
- "go.sum"
- "**/*.go"
- "**/testdata/**"
- "etc/schemas/**/*.json"
- "pyproject.toml"
- "test/**"
- "Taskfile.yml"
pull_request:
paths:
- ".github/workflows/test.yml"
- "Taskfile.yml"
- "go.mod"
- "go.sum"
- "**/*.go"
- "**/testdata/**"
- "etc/schemas/**/*.json"
- "pyproject.toml"
- "test/**"
- "Taskfile.yml"
env:
BUILDS_ARTIFACT: build-artifacts
jobs:
test-go:
strategy:
matrix:
operating-system:
- ubuntu-latest
- windows-latest
- macOS-latest
runs-on: ${{ matrix.operating-system }}
steps:
- name: Checkout local repository
uses: actions/checkout@v2
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: "1.14"
- name: Install Taskfile
uses: arduino/setup-task@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
version: 3.x
- name: Generate code
run: task go:generate
- name: Check for forgotten code generation
run: git diff --color --exit-code
- name: Run unit tests
run: task go:test-unit
- name: Send unit tests coverage to Codecov
if: matrix.operating-system == 'ubuntu-latest'
uses: codecov/codecov-action@v1
with:
file: ./coverage_unit.txt
flags: unit
fail_ci_if_error: true
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: "3.8"
- name: Install Poetry
run: pip install poetry
- name: Run integration tests
run: task test-integration
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v1
with:
fetch-depth: 0
- name: Install Taskfile
uses: arduino/setup-task@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
version: 3.x
- name: Build
run: |
PACKAGE_NAME_PREFIX="${{ github.workflow }}"
if [ "${{ github.event_name }}" = "pull_request" ]; then
PACKAGE_NAME_PREFIX="$PACKAGE_NAME_PREFIX-${{ github.event.number }}"
fi
PACKAGE_NAME_PREFIX="$PACKAGE_NAME_PREFIX-${{ github.sha }}-"
export PACKAGE_NAME_PREFIX
task dist:all
# Transfer builds to artifacts job
- name: Upload combined builds artifact
uses: actions/upload-artifact@v2
with:
path: dist/
name: ${{ env.BUILDS_ARTIFACT }}
artifacts:
name: ${{ matrix.artifact.name }} artifact
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
artifact:
- path: "*checksums.txt"
name: checksums
- path: "*Linux_32bit.tar.gz"
name: Linux_X86-32
- path: "*Linux_64bit.tar.gz"
name: Linux_X86-64
- path: "*Linux_ARM64.tar.gz"
name: Linux_ARM64
- path: "*Linux_ARMv6.tar.gz"
name: Linux_ARMv6
- path: "*Linux_ARMv7.tar.gz"
name: Linux_ARMv7
- path: "*macOS_64bit.tar.gz"
name: macOS_64
- path: "*Windows_32bit.zip"
name: Windows_X86-32
- path: "*Windows_64bit.zip"
name: Windows_X86-64
steps:
- name: Download combined builds artifact
uses: actions/download-artifact@v2
with:
name: ${{ env.BUILDS_ARTIFACT }}
path: ${{ env.BUILDS_ARTIFACT }}
- name: Upload individual build artifact
uses: actions/upload-artifact@v2
with:
path: ${{ env.BUILDS_ARTIFACT }}/${{ matrix.artifact.path }}
name: ${{ matrix.artifact.name }}
clean:
needs: artifacts
runs-on: ubuntu-latest
steps:
- name: Remove unneeded combined builds artifact
uses: geekyeggo/delete-artifact@v1
with:
name: ${{ env.BUILDS_ARTIFACT }}