Skip to content

Commit 49ab735

Browse files
committed
ci: improve caching and combine eslint with build job
1 parent 57ea7f0 commit 49ab735

4 files changed

Lines changed: 30 additions & 51 deletions

File tree

.github/workflows/build.yml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,36 @@ name: Build
22
on: [push, pull_request]
33
jobs:
44
build:
5-
name: Node ${{ matrix.node_version }} on ${{ matrix.os }}
5+
name: Build (${{ matrix.node_version}}-${{ matrix.os }})
66
runs-on: ${{ matrix.os }}
77
strategy:
88
matrix:
99
node_version: [10, 12, 14]
1010
os: [ubuntu-latest, windows-latest, macos-latest]
1111
steps:
12-
- uses: actions/checkout@v2
12+
- name: Checkout repository
13+
uses: actions/checkout@v2
1314
- name: Use node ${{ matrix.node_version }}
1415
uses: actions/setup-node@v1
1516
with:
1617
node-version: ${{ matrix.node_version }}
17-
- name: Restore lerna cache
18+
- name: Restore cache
1819
uses: actions/cache@v2
1920
with:
2021
path: |
2122
node_modules
2223
*/*/node_modules
23-
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
24+
key: ${{ matrix.os }}-${{ matrix.node_version}}-yarn-${{ hashFiles('**/yarn.lock') }}
25+
restore-keys: ${{ matrix.os }}-${{ matrix.node_version }}-yarn-
2426
- name: Install yarn dependencies
2527
run: yarn install
26-
- run: yarn bootstrap
27-
- name: Build package
28+
- name: Bootstrap lerna packages
29+
run: yarn bootstrap
30+
- name: Build lerna packages
2831
run: yarn build
29-
- name: Check built package sizes
32+
- name: Lint source code
33+
run: yarn lint
34+
if: matrix.node_version == 14 && matrix.os == 'ubuntu-latest'
35+
- name: Lint package sizes
3036
run: yarn size
3137
if: matrix.node_version == 14 && matrix.os == 'ubuntu-latest'

.github/workflows/codeql-analysis.yml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1-
name: "CodeQL"
1+
name: Code Scanning
22

33
on:
44
push:
5-
branches: [master, 9.x]
5+
branches: [master]
66
pull_request:
7-
# The branches below must be a subset of the branches above
8-
branches: [master, 9.x]
7+
branches: [master]
98
schedule:
10-
- cron: '0 6 * * 1'
9+
- cron: '0 0 * * 0'
1110

1211
jobs:
13-
analyse:
14-
name: Analyse
12+
codeQL:
1513
runs-on: ubuntu-latest
1614

1715
steps:
@@ -30,9 +28,8 @@ jobs:
3028
# Initializes the CodeQL tools for scanning.
3129
- name: Initialize CodeQL
3230
uses: github/codeql-action/init@v1
33-
# Override language selection by uncommenting this and choosing your languages
34-
# with:
35-
# languages: go, javascript, csharp, python, cpp, java
31+
with:
32+
languages: javascript
3633

3734
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
3835
# If this step fails, then you should remove it and run the build manually (see below)

.github/workflows/eslint.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

.github/workflows/jest.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,39 @@ name: Unit Tests
22
on: [push, pull_request]
33
jobs:
44
jest:
5-
name: Node ${{ matrix.node_version }} on ${{ matrix.os }}
5+
name: Jest (${{ matrix.node_version}}-${{ matrix.os }})
66
runs-on: ${{ matrix.os }}
77
strategy:
88
matrix:
99
node_version: [10, 12, 14]
1010
os: [ubuntu-latest, windows-latest, macos-latest]
1111
steps:
12-
- uses: actions/checkout@v2
12+
- name: Checkout repository
13+
uses: actions/checkout@v2
1314
- name: Use node ${{ matrix.node_version }}
1415
uses: actions/setup-node@v1
1516
with:
1617
node-version: ${{ matrix.node_version }}
17-
- name: Restore lerna cache
18+
- name: Restore cache
1819
uses: actions/cache@v2
1920
with:
2021
path: |
2122
node_modules
2223
*/*/node_modules
23-
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
24+
key: ${{ matrix.os }}-${{ matrix.node_version}}-yarn-${{ hashFiles('**/yarn.lock') }}
25+
restore-keys: ${{ matrix.os }}-${{ matrix.node_version }}-yarn-
2426
- name: Install yarn dependencies
2527
run: yarn install
28+
- name: Bootstrap lerna packages
29+
run: yarn bootstrap
2630
- name: Jest with code coverage
27-
if: (matrix.node_version == 14 && matrix.os == 'ubuntu-latest')
31+
if: matrix.node_version == 14 && matrix.os == 'ubuntu-latest'
2832
uses: mattallty/jest-github-action@v1.0.3
2933
with:
3034
changes-only: true
3135
test-command: 'yarn test:coverage'
3236
env:
3337
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3438
- name: Jest
35-
if: (matrix.node_version != 14 || matrix.os != 'ubuntu-latest')
39+
if: matrix.node_version != 14 || matrix.os != 'ubuntu-latest'
3640
run: yarn jest

0 commit comments

Comments
 (0)