-
Notifications
You must be signed in to change notification settings - Fork 1
129 lines (124 loc) · 3.74 KB
/
main.yaml
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
name: Main
on:
push:
branches:
- main
pull_request:
permissions:
contents: read
env:
# Disabled husky on CI by default
HUSKY: 0
jobs:
commitcheck:
runs-on: ubuntu-latest
steps:
- name: Set up source code
uses: actions/checkout@v4
- name: Set up pnpm
uses: pnpm/action-setup@v4
- name: Set up nodejs
uses: actions/setup-node@v4
with:
node-version-file: .tool-versions
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Validate current commit
run: pnpm commitlint --last --verbose
- name: Validate pull-request title
if: github.event_name == 'pull_request'
run: echo "$PR_TITLE" | pnpm commitlint --verbose
env:
PR_TITLE: "${{ github.event.pull_request.title }}"
spellcheck:
runs-on: ubuntu-latest
steps:
- name: Set up source code
uses: actions/checkout@v4
- name: Run cspell
uses: streetsidesoftware/cspell-action@v5
with:
config: ".github/linters/cspell.json"
# Limit the files checked to the ones in the pull request or push.
# We will enabled this only if this job tooks more than 3 minutes
incremental_files_only: false
strict: true
inline: warning
verbose: false
licensecheck:
runs-on: ubuntu-latest
steps:
- name: Set up source code
uses: actions/checkout@v4
- name: Scan dependencies
uses: fossas/fossa-action@main
with:
api-key: ${{ secrets.FOSSA_API_KEY }}
- name: Test dependencies
uses: fossas/fossa-action@main
with:
api-key: ${{ secrets.FOSSA_API_KEY }}
run-tests: true
lintcheck:
runs-on: ubuntu-latest
needs:
- commitcheck
permissions:
contents: read
packages: read
statuses: write
steps:
- name: Set up source code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Start super-linter
uses: super-linter/super-linter/slim@v7
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
IGNORE_GITIGNORED_FILES: true
VALIDATE_ALL_CODEBASE: false
## json using eslint which conflicted with repo file
VALIDATE_JSON: false
## Should be run by nx lint target
VALIDATE_TSX: false
VALIDATE_JSX: false
VALIDATE_TYPESCRIPT_ES: false
VALIDATE_JAVASCRIPT_ES: false
## We didn't use typescript-standard
VALIDATE_TYPESCRIPT_STANDARD: false
main:
runs-on: ubuntu-latest
needs:
- commitcheck
- spellcheck
- licensecheck
steps:
- name: Set up source code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up pnpm
uses: pnpm/action-setup@v4
## https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
# - name: Set up task distribution
# run: pnpm dlx nx-cloud start-ci-run --distribute-on="3 linux-medium-js" --stop-agents-after="build"
- name: Set up nodejs
uses: actions/setup-node@v4
with:
node-version-file: .tool-versions
cache: pnpm
- name: Set up affected modules
uses: nrwl/nx-set-shas@v4
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Lint, Build and Test packages
run: pnpm start:ci
env:
NX_CLOUD_ACCESS_TOKEN: "${{ secrets.NX_CLOUD_ACCESS_TOKEN }}"
- name: Scan source code
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}