Skip to content

Commit 3c9f181

Browse files
authored
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
1 parent 15c9616 commit 3c9f181

File tree

6 files changed

+124
-40
lines changed

6 files changed

+124
-40
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/ci.yml

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
# semantic-release valid branches
7+
- '+([0-9])?(.{+([0-9]),x}).x'
8+
- 'main'
9+
- 'next'
10+
- 'next-major'
11+
- 'beta'
12+
- 'alpha'
13+
pull_request:
14+
types: [opened, synchronize]
15+
16+
jobs:
17+
code_validation:
18+
name: Code Validation
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v1
24+
25+
- name: Use Node
26+
uses: actions/setup-node@v2
27+
with:
28+
node-version: '14'
29+
30+
- name: Install dependencies
31+
uses: bahmutov/npm-install@v1
32+
with:
33+
useLockFile: false
34+
35+
- name: Lint code
36+
run: npm run lint
37+
38+
# TODO: reenable on v4
39+
# - name: Check format
40+
# run: npm run format:check
41+
42+
test:
43+
name: Tests (Node v${{ matrix.node }} - ESLint v${{ matrix.eslint }})
44+
runs-on: ubuntu-latest
45+
46+
strategy:
47+
matrix:
48+
node: ['10.12', '10', '12.0', '12', '14']
49+
eslint: [5, 6, 7]
50+
51+
steps:
52+
- name: Checkout
53+
uses: actions/checkout@v1
54+
55+
- name: Use Node
56+
uses: actions/setup-node@v2
57+
with:
58+
node-version: ${{ matrix.node }}
59+
60+
- name: Install dependencies
61+
uses: bahmutov/npm-install@v1
62+
with:
63+
useLockFile: false
64+
65+
- name: Install ESLint v${{ matrix.eslint }}
66+
run: npm install --no-save eslint@${{ matrix.eslint }}
67+
68+
- name: Run tests
69+
run: npm run test:ci

.github/workflows/release.yml

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Release
2+
3+
on:
4+
workflow_run:
5+
workflows: ['CI']
6+
types:
7+
- completed
8+
push:
9+
branches:
10+
# semantic-release valid branches
11+
- '+([0-9])?(.{+([0-9]),x}).x'
12+
- 'main'
13+
- 'next'
14+
- 'next-major'
15+
- 'beta'
16+
- 'alpha'
17+
18+
jobs:
19+
main:
20+
name: NPM Release
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v1
26+
27+
- name: Use Node
28+
uses: actions/setup-node@v2
29+
with:
30+
node-version: '14'
31+
32+
- name: Install dependencies
33+
uses: bahmutov/npm-install@v1
34+
with:
35+
useLockFile: false
36+
37+
- name: Build package
38+
run: npm run build
39+
40+
- name: Release new version to NPM
41+
env:
42+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
44+
run: npx semantic-release

.travis.yml

-34
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-screen-queries](docs/rules/prefer-screen-queries.md) | Suggest using screen while using queries | | |
154154
| [prefer-wait-for](docs/rules/prefer-wait-for.md) | Use `waitFor` instead of deprecated wait methods | | ![fixable-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

package.json

+2-4
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,10 @@
4444
"lint": "eslint . --ext .js,.ts",
4545
"lint:fix": "npm run lint -- --fix",
4646
"format": "prettier --write README.md {lib,docs,tests}/**/*.{js,md}",
47-
"test:local": "jest",
48-
"test:ci": "jest --coverage",
47+
"test": "jest",
48+
"test:ci": "jest --ci --coverage",
4949
"test:update": "npm run test:local -- --u",
5050
"test:watch": "npm run test:local -- --watch",
51-
"test": "is-ci test:ci test:local",
5251
"semantic-release": "semantic-release"
5352
},
5453
"dependencies": {
@@ -72,7 +71,6 @@
7271
"eslint-plugin-promise": "^4.2.1",
7372
"eslint-plugin-standard": "^4.0.1",
7473
"husky": "^4.3.0",
75-
"is-ci-cli": "^2.1.2",
7674
"jest": "^25.5.4",
7775
"lint-staged": "^9.5.0",
7876
"prettier": "1.19.1",

0 commit comments

Comments
 (0)