Skip to content

Commit 0179462

Browse files
authored
Separate build and test job (#89)
* Separate build and test job * Add pull request template
1 parent 9e91b73 commit 0179462

File tree

2 files changed

+63
-18
lines changed

2 files changed

+63
-18
lines changed

.github/pull_request_template.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
## Changelog
2+
3+
> Please copy and paste new entries from `CHANGELOG.md` here.
4+
5+
## Specific changes
6+
7+
> Please list each individual specific change in this pull request.
8+
9+
-

.github/workflows/node.js.yml renamed to .github/workflows/ci.yml

Lines changed: 54 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
22
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
33

4-
name: Node.js CI
4+
name: Continuous integration and deployment
55

66
on:
77
push:
@@ -15,12 +15,13 @@ on:
1515
- main
1616

1717
jobs:
18+
# "build" job will build artifacts for production.
1819
build:
1920
runs-on: ubuntu-latest
2021

2122
strategy:
2223
matrix:
23-
node-version: [14.x, 16.x]
24+
node-version: [16.x]
2425

2526
steps:
2627
- name: Checking out for ${{ github.ref }}
@@ -45,21 +46,6 @@ jobs:
4546
run: |
4647
node_modules/.bin/lerna version --force-publish --no-git-tag-version --no-push --yes `cat package.json | jq -r .version`
4748
48-
- name: Building for instrumentation
49-
env:
50-
NODE_ENV: test
51-
SKIP_PREFLIGHT_CHECK: 'true'
52-
run: npm run build --if-present
53-
54-
- name: Starting Docker Compose
55-
run: npm run docker:up -- --detach
56-
57-
- name: Testing
58-
run: npm test -- --coverage
59-
60-
- name: Stopping Docker Compose
61-
run: npm run docker:down
62-
6349
- name: Building for production
6450
env:
6551
NODE_ENV: production
@@ -91,8 +77,58 @@ jobs:
9177
name: gh-pages
9278
path: 'packages/playground/build/**/*'
9379

80+
# "test" job will only run when not deploying, will build for instrumentation.
81+
test:
82+
if: ${{ !startsWith(github.ref, 'refs/heads/') && !startsWith(github.ref, 'refs/tags/') }}
83+
runs-on: ubuntu-latest
84+
85+
strategy:
86+
matrix:
87+
node-version: [14.x, 16.x]
88+
89+
steps:
90+
- name: Checking out for ${{ github.ref }}
91+
uses: actions/checkout@v2
92+
93+
- name: Using Node.js ${{ matrix.node-version }}
94+
uses: actions/setup-node@v1
95+
with:
96+
node-version: ${{ matrix.node-version }}
97+
98+
- name: Running npx version-from-git --no-git-tag-version
99+
if: ${{ startsWith(github.ref, 'refs/heads/') }}
100+
run: npx version-from-git --no-git-tag-version
101+
102+
- name: Installing dependencies
103+
run: npm ci
104+
105+
- name: Bootstrapping packages
106+
run: npm run bootstrap
107+
108+
- name: Propagating versions
109+
run: |
110+
node_modules/.bin/lerna version --force-publish --no-git-tag-version --no-push --yes `cat package.json | jq -r .version`
111+
112+
- name: Building for instrumentation
113+
env:
114+
NODE_ENV: test
115+
SKIP_PREFLIGHT_CHECK: 'true'
116+
run: npm run build --if-present
117+
118+
- name: Starting Docker Compose
119+
run: npm run docker:up -- --detach
120+
121+
- name: Testing
122+
run: npm test -- --coverage
123+
124+
- if: always()
125+
name: Stopping Docker Compose
126+
run: npm run docker:down
127+
94128
publish:
95-
needs: build
129+
needs:
130+
- build
131+
- test
96132
runs-on: ubuntu-latest
97133
if: ${{ startsWith(github.ref, 'refs/heads/') || startsWith(github.ref, 'refs/tags/') }}
98134

0 commit comments

Comments
 (0)