-
-
Notifications
You must be signed in to change notification settings - Fork 5
125 lines (121 loc) · 3.62 KB
/
cicd.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
name: Build, Lint, Test and Deploy
on:
push:
branches:
- "*"
pull_request:
branches:
- master
release:
types:
- published
jobs:
build-lint-test:
name: Node ${{ matrix.node }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
timeout-minutes: 10
strategy:
fail-fast: true
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
node:
- 16
outputs:
vsixPath: ${{ steps.packageExtension.outputs.vsixPath }}
steps:
- name: Setup GIT for Windows
run: |
git config --global core.autocrlf false
git config --global core.eol lf
if: runner.os == 'Windows'
- name: Checkout Source
uses: actions/checkout@v2
- name: Install Node ${{ matrix.node }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
- name: Install Dependencies
run: npm ci
- name: Run Linter
run: npm run lint
- name: Build Code
run: npm run build
- name: Run Unit Tests on Windows or macOS
run: npm run test
if: runner.os != 'Linux'
- name: Run Unit Tests on Linux
run: xvfb-run -a npm test
if: runner.os == 'Linux'
- name: Upload Coverage Report
uses: coverallsapp/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel: true
flag-name: Test on ${{ matrix.os }}
- name: Package Extension
id: packageExtension
uses: HaaLeo/publish-vscode-extension@v1
with:
pat: stub
dryRun: true
- name: Upload Extension Package as Artifact
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.os }}
path: ${{ steps.packageExtension.outputs.vsixPath }}
coverage:
name: Code Coverage
runs-on: ubuntu-latest
timeout-minutes: 10
needs: build-lint-test
steps:
- name: Let Coveralls know that all tests have finished
uses: coverallsapp/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
publish:
name: Publish Github Action
needs:
- build-lint-test
- coverage
if: github.event_name == 'release'
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout Source
uses: actions/checkout@v2
- name: Install Node v16
uses: actions/setup-node@v1
with:
node-version: 16
- name: Install Dependencies
run: npm ci
- name: Download Build Artifact
uses: actions/download-artifact@v2
with:
name: ubuntu-latest
- name: GitHub Release
uses: softprops/action-gh-release@v1
with:
generate_release_notes: true
body: |
# Summary
See [changelog](https://github.com/HaaLeo/vscode-timing/blob/master/CHANGELOG.md#changelog)
name: ${{ github.ref_name }}
fail_on_unmatched_files: true
files: ${{ needs.build-lint-test.outputs.vsixPath }}
- name: Publish to Visual Studio Marketplace
uses: HaaLeo/publish-vscode-extension@v1
with:
pat: ${{ secrets.VS_MARKETPLACE_TOKEN }}
extensionFile: ${{ needs.build-lint-test.outputs.vsixPath }}
registryUrl: https://marketplace.visualstudio.com
- name: Publish to Open VSX Registry
uses: HaaLeo/publish-vscode-extension@v1
with:
pat: ${{ secrets.OPEN_VSX_TOKEN }}
extensionFile: ${{ needs.build-lint-test.outputs.vsixPath }}