-
Notifications
You must be signed in to change notification settings - Fork 405
139 lines (113 loc) Β· 4.16 KB
/
pr-validation.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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# For more information see:
# - https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
# - https://docs.github.com/en/actions/learn-github-actions/contexts#github-context
name: pr-validation
on:
pull_request:
env:
NODE_VERSION: 16.x
BASE_REF: ${{ format('remotes/origin/{0}', github.base_ref) }}
defaults:
run:
shell: bash
concurrency:
group: ${{ github.head_ref }}.${{ github.sha }}.pr-validation
cancel-in-progress: true
jobs:
premerge-build:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Setup
uses: ./.github/actions/setup
with:
node-version: ${{ env.NODE_VERSION }}
github-ref-name: ${{ github.head_ref }}
github-sha: ${{ github.event.pull_request.head.sha }}
- name: Build NGXS
run: yarn build
premerge-test:
runs-on: ubuntu-latest
needs: premerge-build
strategy:
matrix:
script: [lint, 'test']
steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Setup
uses: ./.github/actions/setup
with:
node-version: ${{ env.NODE_VERSION }}
github-ref-name: ${{ github.head_ref }}
github-sha: ${{ github.event.pull_request.head.sha }}
- name: Run ${{ matrix.script }}
run: yarn nx run-many --target=${{ matrix.script }} --all --configuration=ci --base=${{ env.BASE_REF}} --head=HEAD
- name: Upload coverage results to Code Climate
if: ${{ matrix.script == 'test' }}
run: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > /tmp/cc-test-reporter
chmod +x /tmp/cc-test-reporter
node tools/merge-reports.js --coverageDir=coverage/packages --reporterBinaryPath=/tmp/cc-test-reporter
/tmp/cc-test-reporter upload-coverage -i tmp/codeclimate-final.json
env:
CC_TEST_REPORTER_ID: 3f4c9a9d57ded045e0f9ab5d23e5bbcbf709bb85637bea555f1233e72134b818 # TODO: better store it in the repository secrets. Name the variable: CC_TEST_REPORTER_ID. Then delete this line and uncomment the next one
# CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
premerge-integration-test:
runs-on: ubuntu-latest
needs: premerge-build
strategy:
matrix:
script:
- 'integration:ng15'
- 'integration:ng16'
- 'test:types'
steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Setup
uses: ./.github/actions/setup
with:
node-version: ${{ env.NODE_VERSION }}
github-ref-name: ${{ github.head_ref }}
github-sha: ${{ github.event.pull_request.head.sha }}
- name: Run ${{ matrix.script }}
run: yarn ${{ matrix.script }}
- name: Upload an integration test artifact
if: ${{ matrix.script == 'integration:ng15' }}
uses: ./.github/actions/upload-integration-test-artifact
with:
script: ${{ matrix.script }}
premerge-bundlemon:
if: github.repository_owner == 'ngxs'
runs-on: ubuntu-latest
needs: premerge-integration-test
steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Setup
uses: ./.github/actions/setup
with:
node-version: ${{ env.NODE_VERSION }}
github-ref-name: ${{ github.head_ref }}
github-sha: ${{ github.event.pull_request.head.sha }}
- name: Download integration test artifacts
uses: ./.github/actions/download-integration-test-artifacts
- name: Run BundleMon
run: yarn bundlemon
env:
BUNDLEMON_PROJECT_ID: 62b174ff6619780d8caf79fa
CI_COMMIT_SHA: ${{ github.event.pull_request.head.sha }}