-
-
Notifications
You must be signed in to change notification settings - Fork 53
114 lines (102 loc) · 3.19 KB
/
ci.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
name: CI
on:
push:
branches:
- 'main'
pull_request:
branches:
- 'main'
schedule:
- cron: '0 0 * * *'
env:
NX_CLOUD_DISTRIBUTED_EXECUTION: ${{ !contains(github.event.pull_request.user.login, 'dependabot') && !contains(github.event.pull_request.user.login, 'renovate') }}
NX_CLOUD_AUTH_TOKEN: ${{ startsWith(github.repository, 'jmcdo29') && secrets.NX_CLOUD_TOKEN || 'OTRjNTE0ZTgtNmVjOC00NjNmLWFkYzctYWM0MDlhM2VmNzMyfHJlYWQ=' }}
jobs:
main:
runs-on: ubuntu-latest
if: ${{ github.event_name != 'pull_request' }}
steps:
- uses: actions/checkout@v4
name: Checkout [main]
with:
fetch-depth: 0
- name: Derive appropriate SHAs for base and head for `nx affected` commands
uses: nrwl/nx-set-shas@v3
- name: Setup
uses: ./.github/actions/setup
- name: Lint, Build, Test
uses: ./.github/actions/lint-build-test
- name: Stop Nx Cloud Agents
run: pnpm nx-cloud stop-all-agents
- name: Tag main branch if all jobs succeed
uses: nrwl/nx-tag-successful-ci-run@v1
pr:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' }}
steps:
- uses: actions/checkout@v4
with:
# ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 0
- name: Derive appropriate SHAs for base and head for `nx affected` commands
uses: nrwl/nx-set-shas@v3
- name: Setup
uses: ./.github/actions/setup
- name: Lint, Build, Test
uses: ./.github/actions/lint-build-test
- name: Stop Nx Cloud Agents
run: pnpm nx-cloud stop-all-agents
analyze:
name: Analyze
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: javascript
- name: Autobuild
uses: github/codeql-action/autobuild@v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
auto-merge:
needs: pr
if: contains(github.event.pull_request.user.login, 'dependabot') || contains(github.event.pull_request.user.login, 'renovate')
runs-on: ubuntu-latest
steps:
- name: automerge
uses: pascalgn/automerge-action@v0.16.4
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
MERGE_LABELS: ''
MERGE_METHOD: rebase
send-coverage:
runs-on: ubuntu-latest
needs: [pr, main]
if: always()
steps:
- name: Download Coverage
uses: actions/download-artifact@v4
with:
name: coverage
path: coverage/
- name: Send Coverage
run: bash <(curl -Ls https://coverage.codacy.com/get.sh) report -r coverage/lcov.info
shell: bash
env:
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
agents:
runs-on: ubuntu-latest
name: Nx Agent
strategy:
matrix:
agent: [1, 2, 3]
steps:
- uses: actions/checkout@v4
- name: Setup
uses: ./.github/actions/setup
- name: Start Nx Agent ${{ matrix.agent }}
run: pnpm nx-cloud start-agent