Skip to content

Commit eb1f77d

Browse files
authored
ci: add workflow for running the eslint plugin e2e tests (#32397)
This change adds a workflow for PR builds, that runs the e2e tests for `eslint-plugin-react-hooks` created in #32396 ![screenshot of ci tests running](https://github.com/user-attachments/assets/307a878c-92b5-44cf-84f2-3b21979b262a)
1 parent be91130 commit eb1f77d

File tree

13 files changed

+96
-12
lines changed

13 files changed

+96
-12
lines changed

Diff for: .github/workflows/runtime_eslint_plugin_e2e.yml

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: (Runtime) ESLint Plugin E2E
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
paths-ignore:
8+
- compiler/**
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.event.pull_request.number || github.run_id }}
12+
cancel-in-progress: true
13+
14+
env:
15+
TZ: /usr/share/zoneinfo/America/Los_Angeles
16+
17+
jobs:
18+
# ----- TESTS -----
19+
test:
20+
name: ESLint v${{ matrix.eslint_major }}
21+
runs-on: ubuntu-latest
22+
strategy:
23+
matrix:
24+
eslint_major:
25+
- "6"
26+
- "7"
27+
- "8"
28+
- "9"
29+
continue-on-error: true
30+
steps:
31+
- uses: actions/checkout@v4
32+
with:
33+
ref: ${{ github.event.pull_request.head.sha || github.sha }}
34+
- uses: actions/setup-node@v4
35+
with:
36+
node-version-file: '.nvmrc'
37+
cache: yarn
38+
cache-dependency-path: yarn.lock
39+
- name: Restore cached node_modules
40+
uses: actions/cache@v4
41+
id: node_modules
42+
with:
43+
path: "**/node_modules"
44+
key: runtime-eslint_e2e-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
45+
- name: Ensure clean build directory
46+
run: rm -rf build
47+
- run: yarn install --frozen-lockfile
48+
- name: Build plugin
49+
working-directory: fixtures/eslint-v${{ matrix.eslint_major }}
50+
run: node build.mjs
51+
- name: Install fixture dependencies
52+
working-directory: ./fixtures/eslint-v${{ matrix.eslint_major }}
53+
run: yarn --frozen-lockfile
54+
- name: Run lint test
55+
working-directory: ./fixtures/eslint-v${{ matrix.eslint_major }}
56+
run: yarn lint

Diff for: fixtures/eslint-v6/build.mjs

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
#!/usr/bin/env node
22

33
import {exec} from 'node:child_process';
4+
import {dirname, resolve} from 'node:path';
5+
import {fileURLToPath} from 'node:url';
46

5-
exec('cd ../.. && yarn build -r stable eslint-plugin-react-hooks');
7+
const __filename = fileURLToPath(import.meta.url);
8+
const __dirname = dirname(__filename);
9+
10+
exec('yarn build -r stable eslint-plugin-react-hooks', {
11+
cwd: resolve(__dirname, '..', '..'),
12+
});

Diff for: fixtures/eslint-v6/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"name": "eslint-v6",
44
"dependencies": {
55
"eslint": "^6",
6-
"eslint-plugin-react-hooks": "link:../../build/node_modules/eslint-plugin-react-hooks"
6+
"eslint-plugin-react-hooks": "link:../../build/oss-stable/eslint-plugin-react-hooks"
77
},
88
"scripts": {
99
"build": "node build.mjs && yarn",

Diff for: fixtures/eslint-v6/yarn.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ escape-string-regexp@^1.0.5:
205205
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
206206
integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=
207207

208-
"eslint-plugin-react-hooks@link:../../build/node_modules/eslint-plugin-react-hooks":
208+
"eslint-plugin-react-hooks@link:../../build/oss-stable/eslint-plugin-react-hooks":
209209
version "0.0.0"
210210
uid ""
211211

Diff for: fixtures/eslint-v7/build.mjs

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
#!/usr/bin/env node
22

33
import {exec} from 'node:child_process';
4+
import {dirname, resolve} from 'node:path';
5+
import {fileURLToPath} from 'node:url';
46

5-
exec('cd ../.. && yarn build -r stable eslint-plugin-react-hooks');
7+
const __filename = fileURLToPath(import.meta.url);
8+
const __dirname = dirname(__filename);
9+
10+
exec('yarn build -r stable eslint-plugin-react-hooks', {
11+
cwd: resolve(__dirname, '..', '..'),
12+
});

Diff for: fixtures/eslint-v7/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"name": "eslint-v7",
44
"dependencies": {
55
"eslint": "^7",
6-
"eslint-plugin-react-hooks": "link:../../build/node_modules/eslint-plugin-react-hooks"
6+
"eslint-plugin-react-hooks": "link:../../build/oss-stable/eslint-plugin-react-hooks"
77
},
88
"scripts": {
99
"build": "node build.mjs && yarn",

Diff for: fixtures/eslint-v7/yarn.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ escape-string-regexp@^4.0.0:
234234
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34"
235235
integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==
236236

237-
"eslint-plugin-react-hooks@link:../../build/node_modules/eslint-plugin-react-hooks":
237+
"eslint-plugin-react-hooks@link:../../build/oss-stable/eslint-plugin-react-hooks":
238238
version "0.0.0"
239239
uid ""
240240

Diff for: fixtures/eslint-v8/build.mjs

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
#!/usr/bin/env node
22

33
import {exec} from 'node:child_process';
4+
import {dirname, resolve} from 'node:path';
5+
import {fileURLToPath} from 'node:url';
46

5-
exec('cd ../.. && yarn build -r stable eslint-plugin-react-hooks');
7+
const __filename = fileURLToPath(import.meta.url);
8+
const __dirname = dirname(__filename);
9+
10+
exec('yarn build -r stable eslint-plugin-react-hooks', {
11+
cwd: resolve(__dirname, '..', '..'),
12+
});

Diff for: fixtures/eslint-v8/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"name": "eslint-v8",
44
"dependencies": {
55
"eslint": "^8",
6-
"eslint-plugin-react-hooks": "link:../../build/node_modules/eslint-plugin-react-hooks"
6+
"eslint-plugin-react-hooks": "link:../../build/oss-stable/eslint-plugin-react-hooks"
77
},
88
"scripts": {
99
"build": "node build.mjs && yarn",

Diff for: fixtures/eslint-v8/yarn.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ escape-string-regexp@^4.0.0:
192192
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34"
193193
integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==
194194

195-
"eslint-plugin-react-hooks@link:../../build/node_modules/eslint-plugin-react-hooks":
195+
"eslint-plugin-react-hooks@link:../../build/oss-stable/eslint-plugin-react-hooks":
196196
version "0.0.0"
197197
uid ""
198198

Diff for: fixtures/eslint-v9/build.mjs

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
#!/usr/bin/env node
22

33
import {exec} from 'node:child_process';
4+
import {dirname, resolve} from 'node:path';
5+
import {fileURLToPath} from 'node:url';
46

5-
exec('cd ../.. && yarn build -r stable eslint-plugin-react-hooks');
7+
const __filename = fileURLToPath(import.meta.url);
8+
const __dirname = dirname(__filename);
9+
10+
exec('yarn build -r stable eslint-plugin-react-hooks', {
11+
cwd: resolve(__dirname, '..', '..'),
12+
});

Diff for: fixtures/eslint-v9/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"name": "eslint-v9",
44
"dependencies": {
55
"eslint": "^9",
6-
"eslint-plugin-react-hooks": "link:../../build/node_modules/eslint-plugin-react-hooks"
6+
"eslint-plugin-react-hooks": "link:../../build/oss-stable/eslint-plugin-react-hooks"
77
},
88
"scripts": {
99
"build": "node build.mjs && yarn",

Diff for: fixtures/eslint-v9/yarn.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ escape-string-regexp@^4.0.0:
209209
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34"
210210
integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==
211211

212-
"eslint-plugin-react-hooks@link:../../build/node_modules/eslint-plugin-react-hooks":
212+
"eslint-plugin-react-hooks@link:../../build/oss-stable/eslint-plugin-react-hooks":
213213
version "0.0.0"
214214
uid ""
215215

0 commit comments

Comments
 (0)