forked from AmadeusITGroup/otter
-
Notifications
You must be signed in to change notification settings - Fork 0
106 lines (101 loc) · 3.7 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
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
env:
NX_SKIP_NX_CACHE: ${{ inputs.skipNxCache }}
permissions:
contents: read
jobs:
markdown-link-check:
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- 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 }}
env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
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@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.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 }}
- name: Publish tests reports
if: always()
# TODO upgrade to v4 when https://github.com/AmadeusITGroup/otter/issues/1198 is fixed
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with:
name: ut-reports-${{ matrix.os }}
path: |
apps/**/dist-test/ut-report.xml
packages/**/dist-test/ut-report.xml
tools/**/dist-test/ut-report.xml
lint:
runs-on: ubuntu-latest
env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
fetch-depth: ${{ inputs.affected && '0' || '1' }}
- name: Setup
uses: ./tools/github-actions/setup
- name: Cache Eslint
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: .cache/eslint
key: ${{ runner.os }}-eslint-${{ hashFiles('yarn.lock') }}
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