-
Notifications
You must be signed in to change notification settings - Fork 27
209 lines (172 loc) · 6.55 KB
/
ci.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
name: CI
defaults:
run: {shell: bash}
env:
PROTOC_VERSION: 3.x
DEFAULT_NODE_VERSION: 15.x # If changing this, also change jobs.tests.strategy.matrix.node_version
on:
push:
branches: [main, feature.*]
tags: ['**']
pull_request:
jobs:
static_analysis:
name: Static analysis
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: ${{ env.DEFAULT_NODE_VERSION }}
check-latest: true
- uses: arduino/setup-protoc@v1
with:
version: ${{ env.PROTOC_VERSION }}
repo-token: '${{ github.token }}'
- name: Check out the embedded protocol
uses: sass/clone-linked-repo@v1
with: {repo: sass/embedded-protocol, default-ref: null}
- name: Check out the JS API definition
uses: sass/clone-linked-repo@v1
with: {repo: sass/sass, path: language}
- run: npm install
- name: npm run init
run: |
if [[ -d embedded-protocol ]]; then args=--protocol-path=embedded-protocol; fi
npm run init -- --skip-compiler --api-path=language $args
- run: npm run check
tests:
name: 'Tests | Node ${{ matrix.node-version }} | ${{ matrix.os }}'
runs-on: ${{ matrix.os }}-latest
strategy:
matrix:
os: [ubuntu, macos, windows]
node-version: [15.x, 14.x, 12.x] # If changing this, also change env.DEFAULT_NODE_VERSION
fail-fast: false
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
check-latest: true
- uses: frenck/action-setup-yq@v1
with: {version: v4.30.5} # frenck/action-setup-yq#35
- uses: arduino/setup-protoc@v1
with:
version: ${{ env.PROTOC_VERSION }}
repo-token: '${{ github.token }}'
- uses: dart-lang/setup-dart@v1
with: {sdk: stable}
- run: dart --version
- name: Check out the embedded protocol
uses: sass/clone-linked-repo@v1
with: {repo: sass/embedded-protocol, default-ref: null}
- name: Check out Dart Sass
uses: sass/clone-linked-repo@v1
with: {repo: sass/dart-sass}
- name: Check out the embedded compiler
uses: sass/clone-linked-repo@v1
with: {repo: sass/dart-sass-embedded}
- name: Link the embedded compiler to Dart Sass
run: |
yq -i '.dependency_overrides.sass = {"path": "../dart-sass"}' \
dart-sass-embedded/pubspec.yaml
- name: Check out the JS API definition
uses: sass/clone-linked-repo@v1
with: {repo: sass/sass, path: language}
- run: npm install
- name: npm run init
run: |
if [[ -d embedded-protocol ]]; then args=--protocol-path=embedded-protocol; fi
npm run init -- --compiler-path=dart-sass-embedded --api-path=language $args
- run: npm run test
# The versions should be kept up-to-date with the latest LTS Node releases.
# They next need to be rotated October 2021. See
# https://github.com/nodejs/Release.
sass_spec:
name: 'JS API Tests | Node ${{ matrix.node_version }} | ${{ matrix.os }}'
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os: [ubuntu, windows, macos]
node_version: [16]
include:
# Include LTS versions on Ubuntu
- os: ubuntu
node_version: 14
- os: ubuntu
node_version: 12
steps:
- uses: actions/checkout@v2
- uses: dart-lang/setup-dart@v1
with: {sdk: stable}
- uses: actions/setup-node@v2
with: {node-version: "${{ matrix.node_version }}"}
- uses: frenck/action-setup-yq@v1
with: {version: v4.30.5} # frenck/action-setup-yq#35
- uses: arduino/setup-protoc@v1
with:
version: ${{ env.PROTOC_VERSION }}
repo-token: '${{ github.token }}'
- name: Check out the embedded protocol
uses: sass/clone-linked-repo@v1
with: {repo: sass/embedded-protocol, default-ref: null}
- name: Check out Dart Sass
uses: sass/clone-linked-repo@v1
with: {repo: sass/dart-sass}
- name: Check out the embedded compiler
uses: sass/clone-linked-repo@v1
with: {repo: sass/dart-sass-embedded}
- name: Link the embedded compiler to Dart Sass
run: |
yq -i '.dependency_overrides.sass = {"path": "../dart-sass"}' \
dart-sass-embedded/pubspec.yaml
- name: Check out the JS API definition
uses: sass/clone-linked-repo@v1
with: {repo: sass/sass, path: language}
- run: npm install
- name: npm run init
run: |
if [[ -d embedded-protocol ]]; then args=--protocol-path=embedded-protocol; fi
npm run init -- --compiler-path=dart-sass-embedded --api-path=language $args
- name: Check out sass-spec
uses: sass/clone-linked-repo@v1
with: {repo: sass/sass-spec}
- name: Install sass-spec dependencies
run: npm install
working-directory: sass-spec
- name: Compile
run: |
npm run compile
ln -s {`pwd`/,dist/}lib/src/vendor/dart-sass-embedded
- name: Run tests
run: npm run js-api-spec -- --sassPackage .. --sassSassRepo ../language
working-directory: sass-spec
deploy_npm:
name: Deploy npm
runs-on: ubuntu-latest
if: "startsWith(github.ref, 'refs/tags/') && github.repository == 'sass/embedded-host-node'"
needs: [static_analysis, tests, sass_spec]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: ${{ env.DEFAULT_NODE_VERSION }}
check-latest: true
registry-url: 'https://registry.npmjs.org'
- run: npm install
- name: "Check we're not using a -dev version of the embedded protocol"
run: jq -r '.["protocol-version"]' package.json | grep -qv -- '-dev$'
- name: "Check we're not using a -dev version of the embedded compiler"
run: jq -r '.["compiler-version"]' package.json | grep -qv -- '-dev$'
- name: Publish optional dependencies
env:
NODE_AUTH_TOKEN: '${{ secrets.NPM_TOKEN }}'
run: |
for pkg in linux-arm linux-arm64 linux-ia32 linux-x64 darwin-arm64 darwin-x64 win32-ia32 win32-x64; do
npx ts-node ./tool/prepare-optional-release.ts --package=$pkg && npm publish ./npm/$pkg
done
- run: npm publish
env:
NODE_AUTH_TOKEN: '${{ secrets.NPM_TOKEN }}'