Skip to content

Commit 3f7482f

Browse files
chore: Improved workflow (#801)
1 parent f131880 commit 3f7482f

File tree

1 file changed

+88
-50
lines changed

1 file changed

+88
-50
lines changed

.github/workflows/main.yml

Lines changed: 88 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: build
33
on:
44
push:
55
branches:
6-
- master
6+
- '*'
77
pull_request:
88
branches:
99
- '*'
@@ -17,77 +17,45 @@ jobs:
1717
strategy:
1818
fail-fast: false
1919
matrix:
20-
os: [ubuntu-16.04, macOS-latest, windows-2019]
21-
version: ['', 'insiders']
20+
os: [ubuntu-latest, macOS-latest, windows-latest]
21+
version: ['stable', 'insiders']
2222

2323
steps:
2424
- name: Clone repository
2525
uses: actions/checkout@v1
26-
with:
27-
fetch-depth: 1
2826

2927
- name: Setup Node
3028
uses: actions/setup-node@v1
3129
with:
3230
node-version: '10.x'
3331

34-
- name: Npm cache Posix
35-
if: startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'macOS')
36-
uses: actions/cache@v1
37-
with:
38-
path: ~/.npm
39-
key: posix-node-${{ hashFiles('**/package-lock.json') }}
40-
restore-keys: |
41-
posix-node-
42-
43-
- name: Npm cache Windows
44-
if: startsWith(matrix.os, 'windows')
45-
uses: actions/cache@v1
46-
with:
47-
path: ~\AppData\Roaming\npm-cache
48-
key: ${{ runner.os }}-node-${{ hashFiles('**\package-lock.json') }}
49-
restore-keys: |
50-
${{ runner.os }}-node-
51-
5232
- name: Install Dependencies
5333
run: 'npm ci || npm ci'
5434
shell: bash
5535

56-
- name: Lint check
57-
if: startsWith(matrix.os, 'ubuntu') && matrix.version == ''
58-
run: npm run lint
59-
60-
- name: Style check
61-
if: startsWith(matrix.os, 'ubuntu') && matrix.version == ''
62-
run: npm run style-check
63-
6436
- name: Compile sources
6537
run: npm run build
66-
67-
- name: Start xvfb
68-
if: startsWith(matrix.os, 'ubuntu')
69-
run: /usr/bin/Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
7038

39+
- name: Cache VSCode binary
40+
id: cache-vscode
41+
uses: actions/cache@v1
42+
with:
43+
path: .vscode-test
44+
key: vscode-${{ runner.os }}-${{ matrix.version }}-${{ github.run_id }}
45+
restore-keys: |
46+
vscode-${{ runner.os }}-${{ matrix.version }}-
47+
vscode-${{ runner.os }}-
48+
7149
- name: Run tests
50+
uses: GabrielBB/xvfb-action@v1.0
51+
with:
52+
run: npm test
7253
env:
7354
CODE_VERSION: ${{ matrix.version }}
74-
DISPLAY: ':99.0'
75-
run: npm run test
76-
77-
- name: Prepare artifact
78-
if: startsWith(matrix.os, 'ubuntu') && matrix.version == '' && github.event_name == 'pull_request'
79-
run: |
80-
node_modules/.bin/vsce package -o svn-scm.vsix
81-
82-
- name: Upload artifact
83-
if: startsWith(matrix.os, 'ubuntu') && matrix.version == '' && github.event_name == 'pull_request'
84-
uses: actions/upload-artifact@v1
85-
with:
86-
name: svn-scm.vsix
87-
path: svn-scm.vsix
55+
continue-on-error: ${{ matrix.version == 'insiders' }}
8856

8957
- name: Release
90-
if: startsWith(matrix.os, 'ubuntu') && matrix.version == '' && github.ref == 'refs/heads/master' && github.repository == 'JohnstonCode/svn-scm'
58+
if: startsWith(matrix.os, 'ubuntu') && matrix.version == 'stable' && github.ref == 'refs/heads/master' && github.repository == 'JohnstonCode/svn-scm'
9159
run: npm run semantic-release
9260
env:
9361
VSCE_TOKEN: ${{ secrets.vsceToken }}
@@ -97,3 +65,73 @@ jobs:
9765
GIT_COMMITTER_EMAIL: ${{ secrets.gitEmail }}
9866
GIT_AUTHOR_NAME: ${{ secrets.gitName }}
9967
GIT_COMMITTER_NAME: ${{ secrets.gitName }}
68+
69+
eslint:
70+
runs-on: ubuntu-latest
71+
if: "!contains(github.event.head_commit.message, 'skip ci')"
72+
73+
steps:
74+
- name: Clone repository
75+
uses: actions/checkout@v1
76+
77+
- name: Setup Node
78+
uses: actions/setup-node@v1
79+
with:
80+
node-version: '10.x'
81+
82+
- name: Install Dependencies
83+
run: 'npm ci || npm ci'
84+
shell: bash
85+
86+
- name: Lint check
87+
uses: reviewdog/action-eslint@v1
88+
with:
89+
github_token: ${{ secrets.github_token }}
90+
reporter: github-pr-review
91+
eslint_flags: "src --ext .ts"
92+
93+
style:
94+
runs-on: ubuntu-latest
95+
if: "!contains(github.event.head_commit.message, 'skip ci')"
96+
97+
steps:
98+
- name: Clone repository
99+
uses: actions/checkout@v1
100+
101+
- name: Setup Node
102+
uses: actions/setup-node@v1
103+
with:
104+
node-version: '10.x'
105+
106+
- name: Install Dependencies
107+
run: 'npm ci || npm ci'
108+
shell: bash
109+
110+
- name: Style check
111+
run: npm run style-check
112+
113+
artifact:
114+
runs-on: ubuntu-latest
115+
steps:
116+
- name: Checkout
117+
uses: actions/checkout@v2
118+
119+
- name: Setup Node
120+
uses: actions/setup-node@v1
121+
with:
122+
node-version: '10.x'
123+
124+
- name: Install Dependencies
125+
run: 'npm ci || npm ci'
126+
shell: bash
127+
128+
- name: Package extension
129+
uses: lannonbr/vsce-action@master
130+
with:
131+
args: "package -o svn-scm.vsix"
132+
133+
- name: Upload artifact
134+
uses: actions/upload-artifact@v1
135+
with:
136+
name: "svn-scm-${{ github.sha }}.vsix"
137+
path: "svn-scm.vsix"

0 commit comments

Comments
 (0)