Skip to content

Commit

Permalink
WIP: update integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mkacmar committed Sep 30, 2024
1 parent 2f7577d commit 0ae2dc6
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 95 deletions.
88 changes: 0 additions & 88 deletions .github/workflows/E2E integration.yml

This file was deleted.

87 changes: 87 additions & 0 deletions .github/workflows/e2e-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

name: E2E integration

on:
push:
branches: [main, dev/martinkamar/eslint-v9]
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

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

- uses: actions/checkout@v4
with:
repository: ${{env.GITHUB_REPO}}
path: ${{env.TEST_TARGET_DIR}}
clean: true
- uses: actions/checkout@v4
with:
path: eslint-plugin-sdl
clean: true

- name: Create test run directory
run: mkdir ${{env.TEST_RUN_DIR}}
working-directory: ${{github.workspace}}
continue-on-error: true

- name: Install ESLint and eslint-plugin-sdl dependencies
run: |
npm i eslint
npm i eslint-plugin-security
npm i eslint-plugin-react
npm i eslint-plugin-node
npm i typescript
npm i @microsoft/eslint-formatter-sarif
working-directory: ${{env.TEST_RUN_DIR}}

- name: Link eslint-plugin-sdl
run: sudo npm link ../eslint-plugin-sdl
working-directory: ${{env.TEST_RUN_DIR}}
if: runner.os == 'Linux'

- name: Link eslint-plugin-sdl
run: npm link ../eslint-plugin-sdl
working-directory: ${{env.TEST_RUN_DIR}}
if: runner.os == 'Windows'

- name: Copy ESLint config file
run: cp ../eslint-plugin-sdl/tests/fixtures/eslint.config.js .
working-directory: ${{env.TEST_RUN_DIR}}

- name: Run ESLint
run: npx eslint
--config eslint.config.js
../${{env.TEST_TARGET_DIR}}/${{env.GITHUB_REPO_ESLINT_TARGET}}/
--parser-options=project:../${{env.TEST_TARGET_DIR}}/${{env.GITHUB_REPO_TSCONFIG}}
--no-config-lookup
--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
9 changes: 2 additions & 7 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,12 @@ on:
types: [created]

jobs:
# Run one last check
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
- run: npm i
- run: npm i # TODO
- run: npm test

publish-npm:
Expand All @@ -25,10 +22,8 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
registry-url: https://registry.npmjs.org/
- run: npm i
- run: npm i # TODO
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
5 changes: 5 additions & 0 deletions tests/fixtures/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const pluginMicrosoftSdl = require("@microsoft/eslint-plugin-sdl");

module.exports = [
...pluginMicrosoftSdl.configs.recommended
];

0 comments on commit 0ae2dc6

Please sign in to comment.