|
1 | 1 | # This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node |
2 | 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions |
3 | 3 |
|
4 | | -name: Node.js CI |
| 4 | +name: Continuous integration and deployment |
5 | 5 |
|
6 | 6 | on: |
7 | 7 | push: |
|
15 | 15 | - main |
16 | 16 |
|
17 | 17 | jobs: |
| 18 | + # "build" job will build artifacts for production. |
18 | 19 | build: |
19 | 20 | runs-on: ubuntu-latest |
20 | 21 |
|
21 | 22 | strategy: |
22 | 23 | matrix: |
23 | | - node-version: [14.x, 16.x] |
| 24 | + node-version: [16.x] |
24 | 25 |
|
25 | 26 | steps: |
26 | 27 | - name: Checking out for ${{ github.ref }} |
|
45 | 46 | run: | |
46 | 47 | node_modules/.bin/lerna version --force-publish --no-git-tag-version --no-push --yes `cat package.json | jq -r .version` |
47 | 48 |
|
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 | | - |
63 | 49 | - name: Building for production |
64 | 50 | env: |
65 | 51 | NODE_ENV: production |
|
91 | 77 | name: gh-pages |
92 | 78 | path: 'packages/playground/build/**/*' |
93 | 79 |
|
| 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 | + |
94 | 128 | publish: |
95 | | - needs: build |
| 129 | + needs: |
| 130 | + - build |
| 131 | + - test |
96 | 132 | runs-on: ubuntu-latest |
97 | 133 | if: ${{ startsWith(github.ref, 'refs/heads/') || startsWith(github.ref, 'refs/tags/') }} |
98 | 134 |
|
|
0 commit comments