-
Notifications
You must be signed in to change notification settings - Fork 3
160 lines (133 loc) · 3.87 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
name: Build and Test
on:
push:
branches:
- main
pull_request:
branches:
- main
- 'v[0-9]+.[0-9]+.[0-9]+-?*-dev'
workflow_dispatch:
workflow_call:
outputs:
vsixPath:
description: "The path to the packaged and published VSIX file."
value: ${{ jobs.upload-artifacts.outputs.vsixPath }}
env:
coqlsp-path: "coq-lsp"
coqlsp-version: "0.1.8+8.19"
jobs:
create-matrix:
name: Create a configuration matrix for the following jobs
strategy:
matrix:
os: [ubuntu-latest]
ocaml-compiler: [4.14]
runs-on: ${{ matrix.os }}
outputs:
os: ${{ matrix.os }}
ocaml-compiler: ${{ matrix.ocaml-compiler }}
build:
needs: create-matrix
strategy:
matrix:
os: [needs.create-matrix.outputs.os]
ocaml-compiler: [needs.create-matrix.outputs.ocaml-compiler]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout tree
uses: actions/checkout@v4
# For some reason, the most significant thing for caching opam dependencies properly
# is `dune-cache: true` instead of this caching action.
- name: Restore cached opam dependencies
id: cache-opam
uses: actions/cache@v3
with:
path: ~/.opam/
key: opam-${{ matrix.os }}-${{ matrix.ocaml-compiler }}-${{ env.coqlsp-version }}
restore-keys: opam-${{ matrix.os }}-${{ matrix.ocaml-compiler }}-
- name: Set-up OCaml ${{ matrix.ocaml-compiler }}
uses: ocaml/setup-ocaml@v2
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}
dune-cache: true
- name: Install opam dependencies
env:
OPAMYES: true
run: |
opam install coq-lsp.0.1.8+8.19
eval $(opam env)
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
- run: npm ci
- name: Check coq-lsp version
env:
OPAMYES: true
run: |
opam list coq-lsp
eval $(opam env)
which coq-lsp
- name: Check if coq-lsp is in PATH
run: |
eval $(opam env)
if ! command -v coq-lsp &> /dev/null
then
echo "coq-lsp could not be found"
fi
echo "coqlsppath=`which coq-lsp`" >> $GITHUB_ENV
shell: bash
test:
needs: [create-matrix, build]
strategy:
matrix:
os: [needs.create-matrix.outputs.os]
ocaml-compiler: [needs.create-matrix.outputs.ocaml-compiler]
runs-on: ${{ matrix.os }}
steps:
- name: Test on Linux
if: runner.os == 'Linux'
env:
COQ_LSP_PATH: ${{ env.coqlsp-path }}
run: |
eval $(opam env)
xvfb-run -a npm run clean-test
- name: Test not on Linux
if: runner.os != 'Linux'
env:
COQ_LSP_PATH: ${{ env.coqlsp-path }}
run: |
eval $(opam env)
npm run clean-test
setup-ci-debug-session:
name: Start a CI debug session if build or test fail
needs: [create-matrix, build]
strategy:
matrix:
os: [needs.create-matrix.outputs.os]
ocaml-compiler: [needs.create-matrix.outputs.ocaml-compiler]
runs-on: ${{ matrix.os }}
if: always()
steps:
- name: Setup tmate session
if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3
upload-artifacts:
name: Build and upload extension package
needs: test
runs-on: ubuntu-latest
outputs:
vsixPath: ${{ steps.package-extension.outputs.vsixPath }}
steps:
- name: Package Extension
id: package-extension
uses: HaaLeo/publish-vscode-extension@v1
with:
pat: stub
dryRun: true
- name: Upload Extension Package as Artifact
uses: actions/upload-artifact@v2
with:
name: ubuntu-latest
path: ${{ steps.package-extension.outputs.vsixPath }}