-
Notifications
You must be signed in to change notification settings - Fork 2.5k
168 lines (157 loc) · 4.77 KB
/
Copy pathworkflow.yaml
File metadata and controls
168 lines (157 loc) · 4.77 KB
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
'env':
'CLIENT_DIR': 'client'
'GO_VERSION': '1.26.6'
'NODE_VERSION': '24'
'jobs':
'ESLint':
'if': |
${{ github.repository_owner != 'AdGuardSoftwareLimited' }}
'permissions':
'contents': 'read'
'runs-on': 'ubuntu-latest'
'steps':
- 'uses': 'actions/checkout@v6'
'with':
# Set to false to avoid GITHUB_TOKEN leaking.
#
# See https://github.com/actions/checkout/issues/485#issuecomment-934422611.
'persist-credentials': false
- 'name': 'Install modules'
'run': |
#!/bin/sh
set -e -f -u -x
npm \
--prefix="./${{ env.CLIENT_DIR }}" \
ci \
;
- 'name': 'Run ESLint'
'run': |
#!/bin/sh
set -e -f -u -x
npm \
--prefix="./${{ env.CLIENT_DIR }}" \
run lint \
;
'TestJob':
'if': |
${{ github.repository_owner != 'AdGuardSoftwareLimited' }}
'permissions':
'contents': 'read'
'runs-on': '${{ matrix.os }}'
'strategy':
'fail-fast': false
'matrix':
'os':
- 'windows-latest'
- 'macos-latest'
- 'ubuntu-latest'
'steps':
- 'uses': 'actions/checkout@v6'
'with':
# Set to false to avoid GITHUB_TOKEN leaking.
#
# See https://github.com/actions/checkout/issues/485#issuecomment-934422611.
'persist-credentials': false
- 'uses': 'actions/setup-go@v6'
'with':
'go-version': '${{ env.GO_VERSION }}'
- 'name': 'Lint step'
'run': |
#!/bin/sh
set -e -f -u -x
# NOTE: Only run those checks that only need Go and Go tools.
make \
VERBOSE=1 \
go-deps \
go-os-check \
go-lint \
;
'shell': 'bash'
- 'uses': 'actions/setup-node@v7'
'with':
'node-version': '${{ env.NODE_VERSION }}'
- 'name': 'Run tests'
'shell': 'bash'
'run': |
#!/bin/sh
set -e -f -u -x
make \
CLIENT_DIR=${{ env.CLIENT_DIR }} \
VERBOSE=1 \
deps \
test \
go-bench \
go-fuzz \
;
- 'name': 'Upload coverage'
'uses': 'codecov/codecov-action@v1'
'if': "success() && matrix.os == 'ubuntu-latest'"
'with':
'token': '${{ secrets.CODECOV_TOKEN }}'
'file': './cover.out'
'BuildSnapshot':
'if': |
${{ github.repository_owner != 'AdGuardSoftwareLimited' }}
'needs': 'TestJob'
'permissions':
'contents': 'read'
'runs-on': 'ubuntu-latest'
'steps':
- 'uses': 'actions/checkout@v6'
'with':
# Set to false to avoid GITHUB_TOKEN leaking.
#
# See https://github.com/actions/checkout/issues/485#issuecomment-934422611.
'persist-credentials': false
- 'uses': 'actions/setup-go@v6'
'with':
'go-version': '${{ env.GO_VERSION }}'
- 'name': 'Set up Go modules cache'
'uses': 'actions/cache@v4'
'with':
'path': '~/go/pkg/mod'
'key': "${{ runner.os }}-go-${{ hashFiles('go.sum') }}"
'restore-keys': '${{ runner.os }}-go-'
- 'uses': 'actions/setup-node@v7'
'with':
'node-version': '${{ env.NODE_VERSION }}'
- 'name': 'Set up Snapcraft'
'run': |
#!/bin/sh
set -e -f -u -x
sudo snap install snapcraft --classic
- 'name': 'Set up QEMU'
'uses': 'docker/setup-qemu-action@v3'
- 'name': 'Set up Docker Buildx'
'uses': 'docker/setup-buildx-action@v3'
'with':
'install': true
- 'name': 'Run snapshot build'
'run': |
#!/bin/sh
set -e -f -u -x
# Set a custom version string, since the checkout action does not seem
# to know about the master branch, while the version script uses it to
# count the number of commits within the branch.
make \
CLIENT_DIR=${{ env.CLIENT_DIR }} \
SIGN=0 \
VERBOSE=1 \
VERSION="v0.0.0-github" \
build-release \
build-docker \
;
'name': 'Test and snapshot workflow'
'on':
'push':
'tags':
- 'v*'
'branches':
- '*'
'pull_request':
# Permissions are disabled for all the jobs by default, and then overridden for
# specific jobs if needed. This is a recommended practice for security reasons,
# and also allows to avoid mistakes with permissions when creating new jobs.
#
# See https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#permissions.
'permissions': {}