-
Notifications
You must be signed in to change notification settings - Fork 26
89 lines (73 loc) · 2.65 KB
/
e2e-integration.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
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
name: E2E integration
on:
push:
branches: [main]
pull_request_target:
branches: [main]
env:
GITHUB_REPO: nodejs/node
GITHUB_REPO_ESLINT_GLOB: lib
GITHUB_REPO_TSCONFIG: tsconfig.json
TEST_TARGET_DIR: test-target
TEST_RUN_DIR: test-run
PLUGIN_DIR: eslint-plugin-sdl
# This job runs the plugin with latest ESLint on the target repository in GITHUB_REPO env variable.
jobs:
build:
name: E2E run with SARIF
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- name: Setup Node.js environment
uses: actions/setup-node@v4
- name: Create test run directory
run: mkdir ${{env.TEST_RUN_DIR}}
- name: Install ESLint and dependencies required for test
run: |
npm i eslint
npm i typescript
npm i @microsoft/eslint-formatter-sarif
working-directory: ${{env.TEST_RUN_DIR}}
- uses: actions/checkout@v4
with:
repository: ${{env.GITHUB_REPO}}
path: ${{env.TEST_RUN_DIR}}/${{env.TEST_TARGET_DIR}}
clean: true
- uses: actions/checkout@v4
with:
path: ${{env.PLUGIN_DIR}}
clean: true
- name: Install plugin dependencies
run: npm install --production
working-directory: ${{env.PLUGIN_DIR}}
- name: Link plugin
run: sudo npm link ../${{env.PLUGIN_DIR}}
working-directory: ${{env.TEST_RUN_DIR}}
if: runner.os == 'Linux'
- name: Link plugin
run: npm link ../${{env.PLUGIN_DIR}}
working-directory: ${{env.TEST_RUN_DIR}}
if: runner.os == 'Windows'
- name: Create ESLint config file
run: echo 'module.exports = [...require("@microsoft/eslint-plugin-sdl").configs.recommended];' > eslint.config.js
working-directory: ${{env.TEST_RUN_DIR}}
- name: Run ESLint
run: npx eslint
--config eslint.config.js
--no-config-lookup
${{env.TEST_TARGET_DIR}}/${{env.GITHUB_REPO_ESLINT_GLOB}}
--parser-options=project:${{env.TEST_TARGET_DIR}}/${{env.GITHUB_REPO_TSCONFIG}}
--format @microsoft/eslint-formatter-sarif
--output-file eslint-result-${{ matrix.os }}-${{github.run_id}}.sarif
working-directory: ${{env.TEST_RUN_DIR}}
continue-on-error: true
- name: Upload ESLint results as artifact
uses: actions/upload-artifact@v4
with:
name: eslint-result-${{ matrix.os }}
path: ${{env.TEST_RUN_DIR}}/eslint-result-${{ matrix.os }}-${{github.run_id}}.sarif
if-no-files-found: error