This repository has been archived by the owner on Oct 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 91
229 lines (208 loc) · 7.28 KB
/
task.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
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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
# alternative KISS pipeline to bloated ci.yml, modeled after vscode-ansible one.
name: task
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the main branch
on:
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
env:
FORCE_COLOR: "1" # make mocha output colorful
# https://docs.github.com/en/actions/learn-github-actions/environment-variables
# https://devblogs.microsoft.com/commandline/share-environment-vars-between-wsl-and-windows/
WSLENV: CI:FORCE_COLOR:GITHUB_ACTION:GITHUB_ACTION_PATH/p:GITHUB_ACTION_REPOSITORY:GITHUB_WORKFLOW:GITHUB_WORKSPACE/p:GITHUB_PATH/p
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
test:
env:
# to expose matrix job name to steps, which is not possible with expansions
JOB_NAME: ${{ matrix.name || matrix.task-name }}
SKIP_PODMAN: ${{ matrix.skip_podman || '0' }}
SKIP_DOCKER: ${{ matrix.skip_docker || '0' }}
name: ${{ matrix.name || matrix.task-name }}
# The type of runner that the job will run on
runs-on: ${{ matrix.os || 'ubuntu-22.04' }}
defaults:
run:
shell: ${{ matrix.shell || 'bash'}}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-22.04
node-version:
- "16"
task-name:
- vscode
- test-node14
- test-node16
upload-artifact:
- false
name:
- false
include:
- name: lint
task-name: lint
- name: docs
task-name: docs
- name: test-without-ee (wsl)
# runner does not support running container
task-name: test-without-ee
# https://github.com/actions/virtual-environments/issues/5151
os: windows-2022
shell: "wsl-bash {0}"
- name: test-without-ee (macos)
os: macos-11
# runner does not support running container
task-name: test-without-ee
skip_docker: "1"
skip_podman: "1"
steps:
- name: Disable autocrlf
if: "contains(matrix.os, 'windows')"
run: |-
git config --global core.autocrlf false
git config --global core.eol lf
shell: bash # <-- keep it here to avoid using default shell
- uses: actions/checkout@v4
# https://github.com/marketplace/actions/setup-wsl
- name: Activate WSL
if: "contains(matrix.shell, 'wsl')"
uses: Vampire/[email protected]
with:
set-as-default: 'true'
# we want to load user profile
# https://github.com/Vampire/setup-wsl#wsl-shell-command
wsl-shell-command: "bash -euo pipefail"
# https://github.com/MicrosoftDocs/WSL/blob/main/WSL/wsl-config.md#L159
wsl-conf: |
[automount]
enabled = true
root = /
options = "metadata,umask=077"
[interop]
enabled = false
appendWindowsPath = false
[network]
hostname = wsl
additional-packages:
curl
git
make
python3-dev
python3-pip
python3-venv
qemu-user-static
xvfb
- name: Enable caching
if: "!contains(matrix.shell, 'wsl')"
uses: actions/cache@v3
with:
path: |
~/.cache/npm
~/.cache/pip
~/.cache/yarn
~/.nvm/.cache
~/Library/Caches/pip
key: >
${{ runner.os }}-${{ matrix.task-name }}-${{ hashFiles(
'package.json',
'package-lock.json',
'.config/Containerfile'
) }}
- name: Enable caching for podman-machine
uses: actions/cache@v3
if: "contains(matrix.os, 'macos')"
with:
path: |
~/.local/share/containers
~/.config/containers
key: ${{ runner.os }}-${{ matrix.task-name }}-${{ hashFiles('package.json', 'yarn.lock', '.config/Containerfile', '**/Taskfile.yml', 'tools/*.*') }}
- name: Install Task
if: "!contains(matrix.shell, 'wsl')"
uses: arduino/setup-task@v1
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install Task (wsl)
if: "contains(matrix.shell, 'wsl')"
run: |
sudo apt-get update && sudo apt-get install -y curl
sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin
task --version
- name: Dump node version into .nvmrc file
# save node version in .nvmrc file by looking for a pattern like
# node12 in job name. If pattern is not found it uses 'current' alias
if: "!contains(matrix.shell, 'wsl')"
run: >
python3 -c 'import os, re;
v = re.search("node(\d+)", os.environ.get("JOB_NAME", "")) or ["", "current"];
print(v[1])' > .nvmrc
- name: Use node
# as Windows executables are exposed inside WSL at top of PATH, we
# would end with broken npm script in PATH on wsl.
if: "!contains(matrix.shell, 'wsl')"
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
- name: Install task inside WSL
if: "contains(matrix.shell, 'wsl')"
run: |
mkdir -p ~/.local/bin
sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b ~/.local/bin
echo $PATH
command -v task
- run: task setup
- name: task ${{ matrix.task-name }}
run: task -v ${{ matrix.task-name }}
### Uncomment to hold the runner node for debugging
# - uses: actions/checkout@v2
# - name: Setup tmate session
# if: ${{ failure() }}
# uses: mxschmitt/action-tmate@v3
- name: Gather logs
if: ${{ always() }}
run: |
mkdir -p out/vscode
cp -r ../vscode-ansible/out/userdata/logs/* out/vscode || true
- name: Upload test logs
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: logs-${{ matrix.os }}-${{ matrix.task-name }}.zip
path: |
out/vscode
out/e2eTestReport
out/log
out/test-resources/settings/logs
out/userdata/logs
if-no-files-found: ignore
retention-days: 15
- name: Stop services
if: "contains(matrix.os, 'macos')"
# Stopping podman machine is needed or caching it will fail
run: |
command -v podman && {
podman machine stop
while [[ "$(podman machine ls --format '{{.Running}}' \
--noheading || true)" != "false" ]]; do
sleep 1
echo -n .
done
echo .
}
continue-on-error: true
check: # This job does nothing and is only used for the branch protection
if: always()
runs-on: ubuntu-22.04
needs:
- test
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}