-
Notifications
You must be signed in to change notification settings - Fork 38
117 lines (112 loc) · 4.09 KB
/
code-check.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
name: Code check
on:
workflow_call:
inputs:
affected:
type: boolean
required: false
default: false
description: Run test only on affective packages if true
skipNxCache:
type: boolean
default: false
required: false
description: Skip the nx cache
secrets:
NX_CLOUD_ACCESS_TOKEN:
required: false
description: Token to use Nx Cloud token
CODECOV_TOKEN:
required: false
description: Token Report to Codecov
env:
NX_SKIP_NX_CACHE: ${{ inputs.skipNxCache }}
YARN_ENABLE_HARDENED_MODE: 0
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
permissions:
contents: read
jobs:
markdown-link-check:
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: gaurav-nelson/github-action-markdown-link-check@d53a906aa6b22b8979d33bc86170567e619495ec # v1.0.15
with:
base-branch: 'main'
config-file: '.github/markdown-links.config.json'
folder-path: 'packages/,apps/,tools/'
test:
strategy:
fail-fast: false
matrix:
os: ${{ fromJson(github.event_name != 'push' && '["ubuntu-latest", "windows-latest"]' || '["ubuntu-latest"]') }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: ${{ inputs.affected && '0' || '1' }}
- name: Setup
uses: ./tools/github-actions/setup
- uses: ./.github/actions/setup-java
with:
install-jdk: 'true'
- name: Cache Jest
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
env:
hash: ${{ hashFiles('package.json', 'tsconfig.base.json', 'tsconfig.build.json', 'nx.json') }}
with:
path: .cache/jest
key: ${{ runner.os }}-jest-${{ env.hash }}
restore-keys: |
${{ runner.os }}-jest-${{ env.hash }}
${{ runner.os }}-jest
${{ runner.os }}
- name: Build swagger generator
run: yarn nx run ama-sdk-schematics:build-swagger
- name: Test
env:
testCmd: ${{ inputs.affected && format('test:affected --base=remotes/origin/{0}', github.base_ref || github.ref_name) || 'test'}}
NODE_OPTIONS: ${{ runner.os == 'Windows' && '--max_old_space_size=4096' || '' }}
run: yarn ${{ env.testCmd }} --collectCoverage
- name: Upload results to Codecov
uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0
with:
flags: unittests
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload test results to Codecov
uses: codecov/test-results-action@9739113ad922ea0a9abb4b2c0f8bf6a4aa8ef820 # 1.0.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Publish tests reports
if: always()
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: ut-reports-${{ matrix.os }}
path: |
apps/**/dist-test/junit.xml
packages/**/dist-test/junit.xml
tools/**/dist-test/junit.xml
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: ${{ inputs.affected && '0' || '1' }}
- name: Setup
uses: ./tools/github-actions/setup
- name: Cache Eslint
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
env:
hash: ${{ hashFiles('yarn.lock') }}
with:
path: .cache/eslint
key: ${{ runner.os }}-eslint-${{ env.hash }}
restore-keys: |
${{ runner.os }}-eslint-${{ env.hash }}
${{ runner.os }}-eslint
${{ runner.os }}
- name: Lint
env:
lintCmd: ${{ inputs.affected && format('lint:affected --base=remotes/origin/{0}', github.base_ref || github.ref_name) || 'lint'}}
run: yarn ${{ env.lintCmd }} --configuration ci