-
-
Notifications
You must be signed in to change notification settings - Fork 5
204 lines (168 loc) · 5.91 KB
/
ci-tests.yaml
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
199
200
201
202
203
204
name: CI Tests
on:
push:
branches:
- master
pull_request:
branches:
- master
env:
GO_VERSION: "1.15"
NODE_BUILDER_IMAGE: "node:14-alpine"
GPGKEY_ID: "0x4C6D7DB1D92F58EE"
GPGKEY_ID_FULL: "26426A3E380F1D1B67031D3C4C6D7DB1D92F58EE"
GPGKEY_USER: "prvt CI <ci@prvt>"
S3_ENDPOINT: "127.0.0.1:9000"
S3_TLS: "false"
AZURE_STORAGE_ACCOUNT: "devstoreaccount1"
AZURE_STORAGE_ACCESS_KEY: "Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw=="
AZURE_STORAGE_CUSTOM_ENDPOINT: "127.0.0.1:10000"
AZURE_STORAGE_TLS: "false"
AWS_ACCESS_KEY_ID: "AKIAIOSFODNN7EXAMPLE"
AWS_SECRET_ACCESS_KEY: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
jobs:
build-ui:
name: Build UI
runs-on: ubuntu-20.04
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Build web UI
run: |
# Build using Docker
docker run \
--rm \
-v "$PWD"/ui:/usr/src/myapp \
-w /usr/src/myapp \
-e APP_VERSION=dev \
${{env.NODE_BUILDER_IMAGE}} \
sh -c '
set -e
echo -e "###\nInstalling npm dependencies\n"
npm ci
echo -e "\n###\nBuilding UI\n"
npm run build
'
echo -e "\n###\nCompilation done\n"
ls -al ui/dist
- name: Publish web UI artifact
uses: actions/upload-artifact@v2
with:
name: ui
path: ui/dist/
test-linux:
name: Test on Linux
runs-on: ubuntu-20.04
needs: build-ui
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ^${{env.GO_VERSION}}
- name: Go version
run: |
go version
- name: Check out code
uses: actions/checkout@v2
- name: Fetch web UI artifact
uses: actions/download-artifact@v2
with:
name: ui
path: ui/dist
# Can't use a GitHub Action service because that doesn't allow overriding the container's command
- name: Start minio
run: |
docker run \
-d \
-p 9000:9000 \
-e "MINIO_ACCESS_KEY=${{env.AWS_ACCESS_KEY_ID}}" \
-e "MINIO_SECRET_KEY=${{env.AWS_SECRET_ACCESS_KEY}}" \
minio/minio \
server /data
- name: Start Azurite
run: |
docker run \
-d \
-p 10000:10000 \
mcr.microsoft.com/azure-storage/azurite \
azurite-blob --blobHost 0.0.0.0 --blobPort 10000
- name: Import CI GPG key
run: |
gpg --import tests/fixtures/gpg-ci-key.asc
echo "${{env.GPGKEY_ID_FULL}}:6:" | gpg --import-ownertrust
gpg --list-secret-keys
- name: Fetch tools
run: |
# Install goveralls and go-acc
curl -sf https://gobinaries.com/github.com/mattn/[email protected] | PREFIX=. sh
curl -sf https://gobinaries.com/github.com/ory/[email protected] | PREFIX=. sh
- name: Get dependencies
run: |
go get -v -t -d ./...
- name: Build
run: |
go build -v .
- name: Test
run: |
# Exclude the wasm package because it requires a different compilation target
./go-acc \
$(go list ./... | grep -v prvt/wasm) \
-- \
-v \
-ldflags "-X github.com/ItalyPaleAle/prvt/buildinfo.Production=1"
# Remove generated (.pb.go ones) files from coverage report
cat coverage.txt| grep -v ".pb.go:" > coverage-filtered.txt
- name: Send coverage
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./goveralls -coverprofile=coverage-filtered.txt -service=github
test-windows:
name: Test on Windows
runs-on: windows-2019
needs: build-ui
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ^${{env.GO_VERSION}}
- name: Go version
run: |
go.exe version
- name: Check out code
uses: actions/checkout@v2
- name: Fetch web UI artifact
uses: actions/download-artifact@v2
with:
name: ui
path: ui\dist
- name: Fetch and start minio
run: |
$downloadURL = "https://dl.minio.io/server/minio/release/windows-amd64/minio.exe"
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-WebRequest -Uri $downloadURL -OutFile "minio.exe"
mkdir D:\minio
Start-Process powershell -ArgumentList ".\minio.exe server --address 127.0.0.1:9000 D:\minio > D:\minio-log.txt" -WindowStyle hidden
New-NetFirewallRule -Action Allow -DisplayName "MinIO" -Direction Inbound -LocalPort 9000 -Protocol TCP -Profile Domain, Private
env:
MINIO_ACCESS_KEY: "${{env.AWS_ACCESS_KEY_ID}}"
MINIO_SECRET_KEY: "${{env.AWS_SECRET_ACCESS_KEY}}"
- name: Fetch and start Azurite
run: |
npm install -g azurite
mkdir D:\azurite
Start-Process powershell -ArgumentList "azurite-blob --location D:\azurite --blobHost 127.0.0.1 --blobPort 10000 > D:\azurite-log.txt" -WindowStyle hidden
New-NetFirewallRule -Action Allow -DisplayName "Azurite" -Direction Inbound -LocalPort 10000 -Protocol TCP -Profile Domain, Private
- name: Import CI GPG key
run: |
gpg.exe --import tests/fixtures/gpg-ci-key.asc
echo "${{env.GPGKEY_ID_FULL}}:6:" | gpg.exe --import-ownertrust
gpg.exe --list-secret-keys
- name: Get dependencies
run: |
go.exe get -v -t -d ./...
- name: Build
run: |
go.exe build -v .
- name: Test
run: |
iex "go.exe test -v $(go.exe list ./... | grep -v prvt/wasm) -ldflags '-X github.com/ItalyPaleAle/prvt/buildinfo.Production=1'"