forked from Azure/azure-rest-api-specs
-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (70 loc) · 2.11 KB
/
_reusable-eng-tools-test.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
# Prefix with "~" to sort last in Actions list
name: ~Templates - eng/tools - Test
on:
workflow_call:
inputs:
package:
description: Name of package under eng/tools
required: true
type: string
sparse-checkout-paths:
description: Paths for sparse checkout
type: string
lint:
description: Run 'npm run lint' if true
required: false
type: boolean
prettier:
description: Run 'npm run prettier' if true
required: false
type: boolean
jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
node-version: [18, 20]
exclude:
- os: ubuntu-latest
node-version: 20
- os: windows-latest
node-version: 18
runs-on: ${{ matrix.os }}
steps:
- if: runner.os == 'Windows'
run: git config --global core.longpaths true
shell: pwsh
- uses: actions/checkout@v4
with:
sparse-checkout: |
eng
${{ inputs.sparse-checkout-paths }}
- name: Use Node ${{ matrix.node-version }}.x
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}.x
- run: npm ci
shell: pwsh
- run: npm ls -a
shell: pwsh
continue-on-error: true
- run: npm run build
shell: pwsh
working-directory: ./eng/tools/${{ inputs.package }}
- run: npm run lint
if: inputs.lint == true
shell: pwsh
working-directory: ./eng/tools/${{ inputs.package }}
- run: npm run prettier
if: inputs.prettier == true
shell: pwsh
working-directory: ./eng/tools/${{ inputs.package }}
- run: npm run test:ci
shell: pwsh
working-directory: ./eng/tools/${{ inputs.package }}
- name: Archive code coverage results
uses: actions/upload-artifact@v4
with:
name: code-coverage-report-${{ matrix.os }}-${{ matrix.node-version }}
path: ./eng/tools/${{ inputs.package }}/coverage
if-no-files-found: ignore