-
Notifications
You must be signed in to change notification settings - Fork 26
134 lines (124 loc) · 3.71 KB
/
gh-actions.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
name: ServerConnectorCI
on:
push:
branches: [master]
pull_request:
branches: [master]
workflow_dispatch:
inputs:
publishToMarketPlace:
description: 'Publish to VS Code Marketplace ?'
required: true
type: choice
options:
- 'true'
- 'false'
default: 'false'
publishToOVSX:
description: 'Publish to OpenVSX Registry ?'
required: true
type: choice
options:
- 'true'
- 'false'
default: 'false'
jobs:
test:
runs-on: ${{ matrix.os }} # runs a test on Ubuntu, Windows and macOS
strategy:
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
node: [ 20 ]
steps:
# Checkout
- uses: actions/checkout@v4
# Setup node
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
# Install from npm
- run: npm install
# Build the component
- run: npm run build
# Run Unit tests
- name: Run Unit tests
uses: GabrielBB/[email protected]
with:
run: npm test
# Run UI tests
- name: Run UI tests
if: runner.os == 'Linux'
uses: GabrielBB/[email protected]
with:
run: npm run public-ui-test
# Archive test artifacts
- name: Archiving test artifacts
uses: actions/upload-artifact@v4
if: failure()
with:
name: artifacts-${{ matrix.os }}
path: |
test-resources/screenshots/*.png
retention-days: 2
# Upload code coverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
file: ./coverage/coverage-final.json
packaging-job:
runs-on: ubuntu-latest
if: ${{ github.event_name != 'schedule' }}
steps:
- name: Checkout vscode-server-connector
uses: actions/checkout@v4
- name: Set Up NodeJS
uses: actions/setup-node@v4
with:
node-version: '18'
- name: Install NodeJS dependencies
run: npm install -g typescript "@vscode/vsce" "ovsx"
- name: Cache Version
run: |
echo "EXT_VERSION=$(cat package.json | jq -r .version)" >> $GITHUB_ENV
- name: Build vscode-server-connector
run: |
npm install
npm run build
- name: Package vscode-server-connector
run: |
vsce package -o vscode-server-connector-${{ env.EXT_VERSION }}.vsix
ls -lash *.vsix
- name: Upload VSIX Artifacts
uses: actions/upload-artifact@v4
with:
name: vscode-server-connector
path: |
*.vsix
if-no-files-found: error
release-job:
environment: ${{ (inputs.publishToMarketPlace == 'true' || inputs.publishToOVSX == 'true') && 'release' }}
runs-on: ubuntu-latest
needs: packaging-job
steps:
- name: Set Up NodeJS
uses: actions/setup-node@v4
with:
node-version: '18'
- name: Install dependencies
run: |
npm install -g typescript "@vscode/vsce" "ovsx"
- name: Download VSIX
uses: actions/download-artifact@v4
- name: Publish to VS Code Marketplace
if: ${{ inputs.publishToMarketPlace == 'true' }}
run: |
for platformVsix in *.vsix; do
vsce publish --skip-duplicate -p ${{ secrets.VSCODE_MARKETPLACE_TOKEN }} --packagePath ${platformVsix}
done
- name: Publish to OpenVSX Registry
if: ${{ inputs.publishToOVSX == 'true' }}
run: |
for platformVsix in *.vsix; do
ovsx publish --skip-duplicate -p ${{ secrets.OVSX_MARKETPLACE_TOKEN }} --packagePath ${platformVsix}
done