forked from AmadeusITGroup/otter
-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (71 loc) · 2.53 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
name: Code check
on:
workflow_call:
inputs:
affected:
type: boolean
required: false
default: false
description: Run test only on affective packages if true
secrets:
NX_CLOUD_ACCESS_TOKEN:
required: false
description: Token to use Nx Cloud token
jobs:
test:
runs-on: ubuntu-latest
env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: ${{ inputs.affected && '0' || '1' }}
- name: Setup
uses: ./.github/actions/setup
with:
enable-build-cache: 'false'
install-jdk: 'true'
- name: Cache Jest
uses: actions/cache@v3
env:
hash: ${{ hashFiles('package.json', 'tsconfig.base.json', 'tsconfig.build.json', 'nx.json') }}
with:
path: .cache/jest
key: ${{ runner.os }}-jest-${{ env.hash }}-${{ github.ref_name }}
restore-keys: |
${{ runner.os }}-jest-${{ env.hash }}-${{ github.event_name == 'pull_request' && github.base_ref || 'main' }}
${{ runner.os }}-jest-${{ env.hash }}-
${{ runner.os }}-jest-
${{ runner.os }}-
- name: Build swagger generator
run: yarn nx run ama-sdk-generator-sdk:build-swagger
- name: Test
env:
testCmd: ${{ inputs.affected && format('test:affected --base=remotes/origin/{0}', github.base_ref || github.ref_name) || 'test'}}
run: yarn ${{ env.testCmd }}
lint:
runs-on: ubuntu-latest
env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: ${{ inputs.affected && '0' || '1' }}
- name: Setup
uses: ./.github/actions/setup
with:
enable-build-cache: 'false'
- name: Cache Eslint
uses: actions/cache@v3
with:
path: .cache/eslint
key: ${{ runner.os }}-eslint-${{ hashFiles('yarn.lock') }}-${{ github.ref_name }}
restore-keys: |
${{ runner.os }}-eslint-${{ env.hash }}-${{ github.event_name == 'pull_request' && github.base_ref || 'main' }}
${{ 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