-
-
Notifications
You must be signed in to change notification settings - Fork 0
169 lines (141 loc) · 3.92 KB
/
build-and-test.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
name: Build and test
on:
push:
branches:
- '**'
pull_request:
branches:
- 'master'
workflow_call:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Checkout
uses: actions/checkout@v4
- name: Install clojure tools
uses: DeLaGuardo/setup-clojure@12.5
with:
cli: latest
bb: latest
- name: Cache clojure/java dependencies
uses: actions/cache@v4
with:
path: |
~/.m2/repository
~/.gitlibs
~/.deps.clj
key: ${{ runner.os }}-clojure-${{ hashFiles('**/*.edn') }}
restore-keys: |
${{ runner.os }}-clojure-
- name: Install node dependencies
run: npm install
- name: Cache npm
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- name: Build Pre-release VSIX
if: startsWith(github.ref, 'refs/heads/')
run: bb package-pre-release ${GITHUB_REF#refs/heads/}
- name: Build Release VSIX
if: startsWith(github.ref, 'refs/tags/v')
run: |
set -x
npm run package
- name: Get VSIX File Name
id: get-vsix-name
run: echo "VSIX_NAME=$(ls *.vsix)" >> $GITHUB_ENV
- name: Upload VSIX Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.VSIX_NAME }}
path: ${{ env.VSIX_NAME }}
- name: Upload Test Artifact
uses: actions/upload-artifact@v4
with:
name: extension-tests
path: out/extension-tests.js
test:
runs-on: ubuntu-latest
needs: build
steps:
- name: Download Test Artifact
uses: actions/download-artifact@v4
with:
name: extension-tests
pattern: out/extension-tests.js
merge-multiple: true
path: out/
- name: Run Tests
run: node out/extension-tests.js
e2e-test:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download VSIX Artifact
uses: actions/download-artifact@v4
with:
path: /tmp
pattern: '*.vsix'
merge-multiple: true
- name: Get VSIX File Name
id: get-vsix-name
run: echo "VSIX_NAME=$(ls /tmp/*.vsix)" >> $GITHUB_ENV
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Cache npm
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- name: Install node dependencies
run: npm install
- name: Setup Babashka
uses: DeLaGuardo/setup-clojure@12.5
with:
bb: latest
- name: Run Tests
uses: coactions/setup-xvfb@6b00cf1889f4e1d5a48635647013c0508128ee1a
with:
run: bb run-e2e-tests-vsix ${{ env.VSIX_NAME }}
lint:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install clojure tools
uses: DeLaGuardo/setup-clojure@12.5
with:
clj-kondo: latest
- name: Linting that sparks joy
run: |
clj-kondo --version
clj-kondo --lint src test --fail-level warning
check-format:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install clojure tools
uses: DeLaGuardo/setup-clojure@12.5
with:
cljfmt: latest
- name: Check formatting
run: |
cljfmt --version
cljfmt check