-
Notifications
You must be signed in to change notification settings - Fork 11
168 lines (144 loc) · 4.76 KB
/
main.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
name: vscode-bitbake CI/CD
on:
workflow_dispatch:
push:
branches:
- '*'
tags:
- "v*"
pull_request:
branches:
- '*'
jobs:
build-test-vscode:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
env:
DBUS_SESSION_BUS_ADDRESS: unix:path=/run/user/1001/bus
SHELL: /usr/bin/bash
node-version: 20
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
cache: 'npm'
cache-dependency-path: |
package-lock.json
server/package-lock.json
client/package-lock.json
- name: Install Node.js dependencies
run: npm install
# Inspired by https://stackoverflow.com/a/72981982
- name: Configure Git autor for Yocto do_patch
run: |
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
- name: Install apt dependencies
run: sudo apt install chrpath diffstat
- name: Cache fetch
id: cache-fetch
uses: actions/cache@v4
with:
path: |
server/resources/docs
server/resources/spdx-licenses.json
resources/poky
key: cache-${{ hashFiles('scripts/fetch-poky.sh', 'scripts/fetch-docs.sh', 'scripts/fetch-spdx-licenses.sh') }}
- name: Fetch
if: steps.cache-fetch.outputs.cache-hit != 'true'
run: npm run fetch:poky && npm run fetch:docs && npm run fetch:spdx-licenses
- name: Cache build Wasm files
id: cache-wasm
uses: actions/cache@v4
with:
path: |
server/tree-sitter-bash.wasm
server/tree-sitter-bitbake.wasm
key: cache-${{ hashFiles('server/tree-sitter-bash.info', 'server/tree-sitter-bitbake.info') }}
- name: Fetch Wasm files
if: steps.cache-wasm.outputs.cache-hit != 'true'
run: npm run fetch:wasm
- name: Run Linter
run: npm run lint
- name: Build Project
run: npm run compile
- name: Cache VSCode installation
uses: actions/cache@v4
with:
path: |
.vscode-test/vscode-*
.vscode-test/extensions
key: cache-${{ hashFiles('integration-tests/src/runTest.ts') }}
- name: Test Project
run: npm run test
- name: Build the VSIX
run: npm run package
- name: Archive VSIX
uses: actions/upload-artifact@v4
with:
name: vscode-bitbake
path: ./yocto-bitbake*.vsix
# Inspired by https://github.com/microsoft/vscode-platform-specific-sample/blob/a0192a21122dfa5c90934b006f027cdf4e4d892d/.github/workflows/ci.yml#L64C11-L64C11 MIT License
publish-vsce:
runs-on: ubuntu-latest
environment: VSCE
needs: build-test-vscode
if: success() && startsWith( github.ref, 'refs/tags/')
steps:
- uses: actions/download-artifact@v4
- run: npx vsce publish --packagePath $(find . -iname yocto-bitbake*.vsix)
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
# Instructions on https://github.com/eclipse/openvsx/wiki/Publishing-Extensions
publish-open-vsx:
runs-on: ubuntu-latest
environment: OPEN-VSX
needs: build-test-vscode
if: success() && startsWith( github.ref, 'refs/tags/')
steps:
- uses: actions/download-artifact@v4
- run: npx ovsx publish $(find . -iname yocto-bitbake*.vsix) -p ${VSX_PAT}
env:
VSX_PAT: ${{ secrets.VSX_PAT }}
build-language-server-standalone:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
cache: 'npm'
cache-dependency-path: |
package-lock.json
server/package-lock.json
client/package-lock.json
- run: npm install
- run: npm run fetch:docs
- run: npm run fetch:wasm
- run: npm run fetch:spdx-licenses
- run: cd server && npm pack
- name: Archive server package
uses: actions/upload-artifact@v4
with:
name: language-server-bitbake
path: server/language-server-bitbake-*.tgz
# Inspired by https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
publish-npm:
runs-on: ubuntu-latest
environment: NPM
needs: [build-test-vscode, build-language-server-standalone]
if: success() && startsWith( github.ref, 'refs/tags/')
steps:
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
- uses: actions/download-artifact@v4
- name: Publish to npm
run: npm publish $(find . -iname language-server-bitbake-*.tgz)
env:
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}