Skip to content

Commit f740836

Browse files
authored
ci: update pipeline with v4 changes (#289)
* ci: migrate to GitHub Actions (#286) * ci: schedule github actions updates * ci: add github actions release workflow * ci: remove config related to travis * ci: split workflows * ci: use action for installing dependencies * ci: remove lint max warnings * ci: improve scripts * ci: remove format check * ci: install dependencies with npm * ci: revert - install dependencies with npm * ci: install dependencies manually on test step * ci: set ci env var on install step * ci: install peer deps in legacy mode * ci: revert manual deps install * ci: remove node 15 * ci: update badge in README.md Closes #275 * ci: github actions improvements (#288) * chore: fix scripts related to testing * ci: bump checkout action to v2 * ci: merge workflows files into single one * ci: add a step for canceling previous runs * ci: remove workflow run conditions * ci: rename workflow * ci: update github actions with v4 CI changes * chore: bump dependencies to last minor * chore: setting test environment to jest-environment-jsdom v25 I had to downgrade jsdom because of some errors jsdom v16 was causing when running tests in node v10. Apparently, jsdom v16 is compatible with node v10, so I'm not sure why is causing an issue. This can be removed when dropping support for node v10.
1 parent 50727e6 commit f740836

File tree

6 files changed

+152
-67
lines changed

6 files changed

+152
-67
lines changed

.github/dependabot.yml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: 2
2+
updates:
3+
# Set update schedule for GitHub Actions
4+
- package-ecosystem: 'github-actions'
5+
directory: '/'
6+
schedule:
7+
interval: 'daily'

.github/workflows/pipeline.yml

+117
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
name: Pipeline
2+
3+
on:
4+
push:
5+
branches:
6+
# semantic-release valid branches, excluding all-contributors
7+
- '+([0-9])?(.{+([0-9]),x}).x'
8+
- 'main'
9+
- 'next'
10+
- 'next-major'
11+
- 'beta'
12+
- 'alpha'
13+
- '!all-contributors/**'
14+
pull_request:
15+
types: [ opened, synchronize ]
16+
17+
jobs:
18+
code_validation:
19+
name: Code Validation
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- name: Cancel Previous Runs
24+
uses: styfle/[email protected]
25+
with:
26+
access_token: ${{ secrets.GITHUB_TOKEN }}
27+
28+
- name: Checkout
29+
uses: actions/checkout@v2
30+
31+
- name: Use Node
32+
uses: actions/setup-node@v2
33+
with:
34+
node-version: '14'
35+
36+
- name: Install dependencies
37+
uses: bahmutov/npm-install@v1
38+
with:
39+
useLockFile: false
40+
41+
- name: Check Types
42+
run: npm run type-check
43+
44+
- name: Lint code
45+
run: npm run lint
46+
47+
- name: Check format
48+
run: npm run format:check -- --max-warnings 0
49+
50+
tests:
51+
name: Tests (Node v${{ matrix.node }} - ESLint v${{ matrix.eslint }})
52+
runs-on: ubuntu-latest
53+
54+
strategy:
55+
matrix:
56+
node: [ '10.22.1', '10', '12', '14' ]
57+
eslint: [ '7.5', '7', ]
58+
59+
steps:
60+
- name: Cancel Previous Runs
61+
uses: styfle/[email protected]
62+
with:
63+
access_token: ${{ secrets.GITHUB_TOKEN }}
64+
- name: Checkout
65+
uses: actions/checkout@v2
66+
67+
- name: Use Node
68+
uses: actions/setup-node@v2
69+
with:
70+
node-version: ${{ matrix.node }}
71+
72+
- name: Install dependencies
73+
uses: bahmutov/npm-install@v1
74+
with:
75+
useLockFile: false
76+
77+
- name: Install ESLint v${{ matrix.eslint }}
78+
run: npm install --no-save eslint@${{ matrix.eslint }}
79+
80+
- name: Run tests
81+
run: npm run test:ci
82+
83+
release:
84+
name: NPM Release
85+
needs: [code_validation, tests]
86+
runs-on: ubuntu-latest
87+
if:
88+
${{ github.repository == 'testing-library/eslint-plugin-testing-library' &&
89+
contains('refs/heads/main,refs/heads/beta,refs/heads/next,refs/heads/alpha',
90+
github.ref) && github.event_name == 'push' }}
91+
92+
steps:
93+
- name: Cancel Previous Runs
94+
uses: styfle/[email protected]
95+
with:
96+
access_token: ${{ secrets.GITHUB_TOKEN }}
97+
- name: Checkout
98+
uses: actions/checkout@v2
99+
100+
- name: Use Node
101+
uses: actions/setup-node@v2
102+
with:
103+
node-version: '14'
104+
105+
- name: Install dependencies
106+
uses: bahmutov/npm-install@v1
107+
with:
108+
useLockFile: false
109+
110+
- name: Build package
111+
run: npm run build
112+
113+
- name: Release new version to NPM
114+
env:
115+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
116+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
117+
run: npx semantic-release

.travis.yml

-39
This file was deleted.

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,8 @@ To enable this configuration use the `extends` property in your
153153
| [prefer-wait-for](docs/rules/prefer-wait-for.md) | Use `waitFor` instead of deprecated wait methods | | ![fixable-badge][] |
154154
| [render-result-naming-convention](docs/rules/render-result-naming-convention.md) | Enforce a valid naming for return value from `render` | ![angular-badge][] ![react-badge][] ![vue-badge][] | |
155155

156-
[build-badge]: https://img.shields.io/travis/testing-library/eslint-plugin-testing-library?style=flat-square
157-
[build-url]: https://travis-ci.org/testing-library/eslint-plugin-testing-library
156+
[build-badge]: https://github.com/testing-library/eslint-plugin-testing-library/actions/workflows/ci.yml/badge.svg
157+
[build-url]: https://github.com/testing-library/eslint-plugin-testing-library/actions/workflows/ci.yml
158158
[version-badge]: https://img.shields.io/npm/v/eslint-plugin-testing-library?style=flat-square
159159
[version-url]: https://www.npmjs.com/package/eslint-plugin-testing-library
160160
[license-badge]: https://img.shields.io/npm/l/eslint-plugin-testing-library?style=flat-square

jest.config.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
module.exports = {
2+
testEnvironment: 'jest-environment-jsdom',
23
testMatch: ['**/tests/**/*.test.ts'],
34
transform: {
45
'^.+\\.tsx?$': 'ts-jest',
@@ -10,7 +11,7 @@ module.exports = {
1011
lines: 100,
1112
statements: 100,
1213
},
13-
// TODO drop this custom threshold in v4
14+
// TODO drop this custom threshold after v4
1415
'./lib/node-utils.ts': {
1516
branches: 85,
1617
functions: 90,

package.json

+24-25
Original file line numberDiff line numberDiff line change
@@ -45,45 +45,44 @@
4545
"lint:fix": "npm run lint -- --fix",
4646
"format": "prettier --write README.md \"{lib,docs,tests}/**/*.{js,ts,md}\"",
4747
"format:check": "prettier --check README.md \"{lib,docs,tests}/**/*.{js,json,yml,ts,md}\"",
48-
"test:local": "jest",
49-
"test:ci": "jest --coverage",
50-
"test:update": "npm run test:local -- --u",
51-
"test:watch": "npm run test:local -- --watch",
52-
"test": "is-ci test:ci test:local",
48+
"test": "jest",
49+
"test:ci": "jest --ci --coverage",
50+
"test:update": "npm run test -- --u",
51+
"test:watch": "npm run test -- --watch",
5352
"type-check": "tsc --noEmit",
5453
"semantic-release": "semantic-release"
5554
},
5655
"dependencies": {
57-
"@typescript-eslint/experimental-utils": "^4.1.1"
56+
"@typescript-eslint/experimental-utils": "^4.18.0"
5857
},
5958
"devDependencies": {
6059
"@commitlint/cli": "^11.0.0",
6160
"@commitlint/config-conventional": "^11.0.0",
62-
"@types/jest": "^26.0.14",
63-
"@typescript-eslint/eslint-plugin": "^4.1.1",
64-
"@typescript-eslint/parser": "^4.1.1",
61+
"@types/jest": "^25.2.3",
62+
"@typescript-eslint/eslint-plugin": "^4.18.0",
63+
"@typescript-eslint/parser": "^4.18.0",
6564
"cpy-cli": "^3.1.1",
6665
"eslint": "^7.9.0",
67-
"eslint-config-prettier": "^6.11.0",
66+
"eslint-config-prettier": "^6.15.0",
6867
"eslint-config-standard": "^14.1.1",
69-
"eslint-plugin-import": "^2.22.0",
70-
"eslint-plugin-jest": "^24.0.2",
71-
"eslint-plugin-jest-formatting": "^2.0.0",
68+
"eslint-plugin-import": "^2.22.1",
69+
"eslint-plugin-jest": "^24.3.1",
70+
"eslint-plugin-jest-formatting": "^2.0.1",
7271
"eslint-plugin-node": "^11.1.0",
73-
"eslint-plugin-prettier": "^3.1.4",
74-
"eslint-plugin-promise": "^4.2.1",
75-
"eslint-plugin-standard": "^4.0.1",
76-
"husky": "^4.3.0",
77-
"is-ci-cli": "^2.1.2",
78-
"jest": "^26.4.2",
79-
"lint-staged": "^10.4.0",
80-
"prettier": "2.1.2",
81-
"semantic-release": "^17.1.2",
82-
"ts-jest": "^26.4.0",
83-
"typescript": "^4.0.3"
72+
"eslint-plugin-prettier": "^3.3.1",
73+
"eslint-plugin-promise": "^4.3.1",
74+
"eslint-plugin-standard": "^4.1.0",
75+
"husky": "^4.3.8",
76+
"jest": "26.6.3",
77+
"jest-environment-jsdom": "25",
78+
"lint-staged": "^10.5.4",
79+
"prettier": "2.2.1",
80+
"semantic-release": "^17.4.2",
81+
"ts-jest": "^26.5.3",
82+
"typescript": "^4.2.3"
8483
},
8584
"peerDependencies": {
86-
"eslint": "^7.5.0"
85+
"eslint": "^7.22.0"
8786
},
8887
"engines": {
8988
"node": "^10.22.1 || >=12.0.0",

0 commit comments

Comments
 (0)