-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy path.azure-pipelines.yml
More file actions
130 lines (112 loc) · 4.18 KB
/
.azure-pipelines.yml
File metadata and controls
130 lines (112 loc) · 4.18 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
trigger:
branches:
include:
- main
tags:
include:
- v*
- refs/tags/v*
strategy:
matrix:
linux:
imageName: "ubuntu-latest"
# mac:
# imageName: 'macos-latest'
# windows:
# imageName: 'windows-latest'
pool:
vmImage: $(imageName)
variables:
COVERALLS_REPO_TOKEN: $(CoverallsToken)
FROBTADS_REF: "master"
FROBTADS_CACHE_DIR: "$(Pipeline.Workspace)/frobtads-cache"
FROBTADS_PREFIX: "$(Pipeline.Workspace)/frobtads-cache/install"
NPM_CACHE_DIR: "$(Pipeline.Workspace)/.npm"
steps:
- task: NodeTool@0
inputs:
versionSpec: "^18.18.0"
displayName: "Install Node.js"
- bash: |
sudo apt-get update
sudo apt-get -y install curl g++ libcurl4-openssl-dev libncurses5-dev make cmake git tar
displayName: "Install dependencies via apt-get"
condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'))
- task: Cache@2
displayName: "Restore frobtads cache"
inputs:
key: 'frobtads | "$(Agent.OS)" | "$(FROBTADS_REF)"'
restoreKeys: |
frobtads | "$(Agent.OS)"
path: "$(FROBTADS_CACHE_DIR)"
cacheHitVar: FROBTADS_CACHE_HIT
condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'))
- task: Cache@2
displayName: "Restore npm cache"
inputs:
key: 'npm | "$(Agent.OS)" | package-lock.json, client/package-lock.json, server/package-lock.json'
restoreKeys: |
npm | "$(Agent.OS)"
path: "$(NPM_CACHE_DIR)"
- bash: |
set -euo pipefail
rm -rf "$(Pipeline.Workspace)/frobtads-src"
git clone --depth 1 --branch "$(FROBTADS_REF)" https://github.com/realnc/frobtads.git "$(Pipeline.Workspace)/frobtads-src"
cd "$(Pipeline.Workspace)/frobtads-src"
if [ -x ./configure ]; then
./configure
fi
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$(FROBTADS_PREFIX)"
cmake --build build --target install -j"$(nproc)"
displayName: "Fetch, build and install frobtads (cache miss only)"
condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'), ne(variables['FROBTADS_CACHE_HIT'], 'true'))
- bash: |
set -euo pipefail
if [ ! -d "$(FROBTADS_PREFIX)/share/frobtads" ]; then
echo "Expected frobtads libraries in $(FROBTADS_PREFIX)/share/frobtads but they were not found"
exit 1
fi
sudo mkdir -p /usr/local/share
sudo rm -rf /usr/local/share/frobtads
sudo ln -s "$(FROBTADS_PREFIX)/share/frobtads" /usr/local/share/frobtads
ls -la /usr/local/share/frobtads/tads3 | head -n 20
displayName: "Expose frobtads libraries at /usr/local/share/frobtads"
condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'))
# TODO: build for tads3 for mac & windows
# condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
# condition: and(succeeded(), eq(variables['Agent.OS'], 'Darwin'))
- bash: |
/usr/bin/Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
echo ">>> Started xvfb"
displayName: Start xvfb
condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'))
- bash: |
# Some CI environments inject a legacy npm config key that newer npm warns about.
# Remove it so logs stay clean and future npm versions do not fail.
unset npm_config_version_git_tag NPM_CONFIG_VERSION_GIT_TAG
echo ">>> Install dependencies"
npm ci --ignore-scripts
npm --prefix client ci
npm --prefix server ci
echo ">>> Compile vscode-test"
npm run compile
echo ">>> Compiled vscode-test"
echo ">>> Run unit tests test"
npm run coverage
echo ">>> Unit tests finished"
echo ">>> Publish coverage to coveralls"
npx coveralls < ./coverage/lcov.info
displayName: Run Tests
env:
COVERALLS_REPO_TOKEN: $(CoverallsToken)
DISPLAY: ":99.0"
PATH: $(FROBTADS_PREFIX)/bin:$(PATH)
LD_LIBRARY_PATH: $(FROBTADS_PREFIX)/lib:$(LD_LIBRARY_PATH)
npm_config_cache: $(NPM_CACHE_DIR)
- bash: |
echo ">>> Publish"
npm run deploy
displayName: Publish
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['Agent.OS'], 'Linux'))
env:
VSCE_PAT: $(BUILDSECRET)