Skip to content

Commit

Permalink
ci: update pipeline with v4 changes (#289)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
Belco90 committed Mar 16, 2021
1 parent 50727e6 commit f740836
Show file tree
Hide file tree
Showing 6 changed files with 152 additions and 67 deletions.
7 changes: 7 additions & 0 deletions .github/dependabot.yml
@@ -0,0 +1,7 @@
version: 2
updates:
# Set update schedule for GitHub Actions
- package-ecosystem: 'github-actions'
directory: '/'
schedule:
interval: 'daily'
117 changes: 117 additions & 0 deletions .github/workflows/pipeline.yml
@@ -0,0 +1,117 @@
name: Pipeline

on:
push:
branches:
# semantic-release valid branches, excluding all-contributors
- '+([0-9])?(.{+([0-9]),x}).x'
- 'main'
- 'next'
- 'next-major'
- 'beta'
- 'alpha'
- '!all-contributors/**'
pull_request:
types: [ opened, synchronize ]

jobs:
code_validation:
name: Code Validation
runs-on: ubuntu-latest

steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.6.0
with:
access_token: ${{ secrets.GITHUB_TOKEN }}

- name: Checkout
uses: actions/checkout@v2

- name: Use Node
uses: actions/setup-node@v2
with:
node-version: '14'

- name: Install dependencies
uses: bahmutov/npm-install@v1
with:
useLockFile: false

- name: Check Types
run: npm run type-check

- name: Lint code
run: npm run lint

- name: Check format
run: npm run format:check -- --max-warnings 0

tests:
name: Tests (Node v${{ matrix.node }} - ESLint v${{ matrix.eslint }})
runs-on: ubuntu-latest

strategy:
matrix:
node: [ '10.22.1', '10', '12', '14' ]
eslint: [ '7.5', '7', ]

steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.6.0
with:
access_token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout
uses: actions/checkout@v2

- name: Use Node
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}

- name: Install dependencies
uses: bahmutov/npm-install@v1
with:
useLockFile: false

- name: Install ESLint v${{ matrix.eslint }}
run: npm install --no-save eslint@${{ matrix.eslint }}

- name: Run tests
run: npm run test:ci

release:
name: NPM Release
needs: [code_validation, tests]
runs-on: ubuntu-latest
if:
${{ github.repository == 'testing-library/eslint-plugin-testing-library' &&
contains('refs/heads/main,refs/heads/beta,refs/heads/next,refs/heads/alpha',
github.ref) && github.event_name == 'push' }}

steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.6.0
with:
access_token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout
uses: actions/checkout@v2

- name: Use Node
uses: actions/setup-node@v2
with:
node-version: '14'

- name: Install dependencies
uses: bahmutov/npm-install@v1
with:
useLockFile: false

- name: Build package
run: npm run build

- name: Release new version to NPM
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release
39 changes: 0 additions & 39 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -153,8 +153,8 @@ To enable this configuration use the `extends` property in your
| [prefer-wait-for](docs/rules/prefer-wait-for.md) | Use `waitFor` instead of deprecated wait methods | | ![fixable-badge][] |
| [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][] | |

[build-badge]: https://img.shields.io/travis/testing-library/eslint-plugin-testing-library?style=flat-square
[build-url]: https://travis-ci.org/testing-library/eslint-plugin-testing-library
[build-badge]: https://github.com/testing-library/eslint-plugin-testing-library/actions/workflows/ci.yml/badge.svg
[build-url]: https://github.com/testing-library/eslint-plugin-testing-library/actions/workflows/ci.yml
[version-badge]: https://img.shields.io/npm/v/eslint-plugin-testing-library?style=flat-square
[version-url]: https://www.npmjs.com/package/eslint-plugin-testing-library
[license-badge]: https://img.shields.io/npm/l/eslint-plugin-testing-library?style=flat-square
Expand Down
3 changes: 2 additions & 1 deletion jest.config.js
@@ -1,4 +1,5 @@
module.exports = {
testEnvironment: 'jest-environment-jsdom',
testMatch: ['**/tests/**/*.test.ts'],
transform: {
'^.+\\.tsx?$': 'ts-jest',
Expand All @@ -10,7 +11,7 @@ module.exports = {
lines: 100,
statements: 100,
},
// TODO drop this custom threshold in v4
// TODO drop this custom threshold after v4
'./lib/node-utils.ts': {
branches: 85,
functions: 90,
Expand Down
49 changes: 24 additions & 25 deletions package.json
Expand Up @@ -45,45 +45,44 @@
"lint:fix": "npm run lint -- --fix",
"format": "prettier --write README.md \"{lib,docs,tests}/**/*.{js,ts,md}\"",
"format:check": "prettier --check README.md \"{lib,docs,tests}/**/*.{js,json,yml,ts,md}\"",
"test:local": "jest",
"test:ci": "jest --coverage",
"test:update": "npm run test:local -- --u",
"test:watch": "npm run test:local -- --watch",
"test": "is-ci test:ci test:local",
"test": "jest",
"test:ci": "jest --ci --coverage",
"test:update": "npm run test -- --u",
"test:watch": "npm run test -- --watch",
"type-check": "tsc --noEmit",
"semantic-release": "semantic-release"
},
"dependencies": {
"@typescript-eslint/experimental-utils": "^4.1.1"
"@typescript-eslint/experimental-utils": "^4.18.0"
},
"devDependencies": {
"@commitlint/cli": "^11.0.0",
"@commitlint/config-conventional": "^11.0.0",
"@types/jest": "^26.0.14",
"@typescript-eslint/eslint-plugin": "^4.1.1",
"@typescript-eslint/parser": "^4.1.1",
"@types/jest": "^25.2.3",
"@typescript-eslint/eslint-plugin": "^4.18.0",
"@typescript-eslint/parser": "^4.18.0",
"cpy-cli": "^3.1.1",
"eslint": "^7.9.0",
"eslint-config-prettier": "^6.11.0",
"eslint-config-prettier": "^6.15.0",
"eslint-config-standard": "^14.1.1",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-jest": "^24.0.2",
"eslint-plugin-jest-formatting": "^2.0.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jest": "^24.3.1",
"eslint-plugin-jest-formatting": "^2.0.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.1",
"husky": "^4.3.0",
"is-ci-cli": "^2.1.2",
"jest": "^26.4.2",
"lint-staged": "^10.4.0",
"prettier": "2.1.2",
"semantic-release": "^17.1.2",
"ts-jest": "^26.4.0",
"typescript": "^4.0.3"
"eslint-plugin-prettier": "^3.3.1",
"eslint-plugin-promise": "^4.3.1",
"eslint-plugin-standard": "^4.1.0",
"husky": "^4.3.8",
"jest": "26.6.3",
"jest-environment-jsdom": "25",
"lint-staged": "^10.5.4",
"prettier": "2.2.1",
"semantic-release": "^17.4.2",
"ts-jest": "^26.5.3",
"typescript": "^4.2.3"
},
"peerDependencies": {
"eslint": "^7.5.0"
"eslint": "^7.22.0"
},
"engines": {
"node": "^10.22.1 || >=12.0.0",
Expand Down

0 comments on commit f740836

Please sign in to comment.