This repository has been archived by the owner on Jan 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 479
182 lines (176 loc) · 5.04 KB
/
preflight-checks.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
name: preflight-checks
on:
push:
tags:
- 'v*'
branches:
- master
- release-*
pull_request:
branches:
- master
- release-*
jobs:
go_unit_tests:
strategy:
matrix:
go-version:
- 1.16.x
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
name: Golang tests on ${{ matrix.platform }}
steps:
- - uses: actions/checkout@v2
- uses: actions/setup-node@v2.4.0
with:
node-version: '16'
cache: 'npm'
cache-dependency-path: 'web/package-lock.json'
- uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: install_prettier
run: |
npm i -g prettier
- name: run_go_tests
env:
GOFLAGS: -mod=vendor
run: |
go run build.go test
verify_tag:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v2
with:
go-version: 1.16.x
- uses: actions/checkout@v2
- name: Get tag
run: echo "GITHUB_TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
- name: Verify tag
run: |
bash ./ci/github-actions-tag-check.sh
shell: bash
node_unit_tests:
strategy:
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
name: Karma tests on ${{ matrix.platform }}
steps:
- uses: actions/setup-node@v2.4.0
with:
node-version: '16'
cache: 'npm'
cache-dependency-path: 'web/package-lock.json'
- uses: actions/checkout@v2
- name: run_karma
run: |
go run build.go web-test
bundle_assets:
needs: [go_unit_tests, node_unit_tests]
strategy:
matrix:
go-version:
- 1.16.x
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
name: Build on ${{ matrix.platform }}
steps:
- uses: actions/setup-node@v2.3.2
with:
node-version: '16'
- uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- uses: actions/checkout@v2
- name: Build web assets
run: |
go run build.go web-build
- uses: actions/upload-artifact@v2
with:
name: bundle
path: web/dist
- name: Go tools
env:
GOFLAGS: -mod=vendor
run: |
go run build.go go-install
go generate ./web
go generate ./pkg/plugin/plugin.go
- name: Build binary
env:
GOFLAGS: -mod=vendor
run: |
go run build.go build
./build/octant version
- if: startsWith(github.ref, 'refs/tags/v')
name: Build electron binary
env:
GOFLAGS: -mod=vendor
run: |
go run build.go build-electron
- if: startsWith(github.ref, 'refs/tags/v')
name: Build electron
uses: samuelmeuli/action-electron-builder@v1.6.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
package_root: 'web'
build_script_name: 'build-electron'
- uses: actions/upload-artifact@v2
if: startsWith(github.ref, 'refs/tags/v')
with:
name: electron-artifacts
path: web/release/Octant*
goreleaser:
if: startsWith(github.ref, 'refs/tags/v')
needs: [bundle_assets, verify_tag]
runs-on: ubuntu-latest
container: goreleaser/goreleaser:v0.174.2
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/download-artifact@v2
with:
name: bundle
path: web/dist
- name: Run GoReleaser
run: |
goreleaser --skip-publish
- uses: actions/upload-artifact@v2
with:
name: binary-artifacts
path: dist
release:
if: startsWith(github.ref, 'refs/tags/v')
needs: [goreleaser, bundle_assets]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
name: binary-artifacts
path: dist
- uses: actions/download-artifact@v2
with:
name: electron-artifacts
path: web/release
- name: Create release
# actions/upload-release-asset@v1 does not support glob
run: |
set -x
assets=()
for asset in ./dist/*; do
if [[ $asset == *.txt ]] || [[ $asset == *.tar.gz ]] || [[ $asset == *.rpm ]] || [[ $asset == *.deb ]] || [[ $asset == *.zip ]]
then
assets+=("-a" "$asset")
fi
done
for asset in ./web/release/Octant*; do
shasum -a 256 "$asset" | awk '{sub(/.*\//," ",$2)} 1' >> ./dist/checksums.txt
assets+=("-a" "$asset")
done
hub release create "${assets[@]}" -m "${GITHUB_REF:10}" "${GITHUB_REF:10}" --draft
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}