Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: migrate to GitHub Actions #286

Merged
merged 16 commits into from
Mar 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
updates:
# Set update schedule for GitHub Actions
- package-ecosystem: 'github-actions'
directory: '/'
schedule:
interval: 'daily'
69 changes: 69 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: CI

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

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

steps:
- name: Checkout
uses: actions/checkout@v1

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

- name: Install dependencies
uses: bahmutov/npm-install@v1
with:
useLockFile: false
Comment on lines +30 to +33
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is not necessary to use an extra GH action here, while a simple

name: Install dependencies
run: npm install

should do the trick

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This npm-install action will cache stuff related to npm properly :)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ohh nice


- name: Lint code
run: npm run lint

# TODO: reenable on v4
# - name: Check format
# run: npm run format:check

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

strategy:
matrix:
node: ['10.12', '10', '12.0', '12', '14']
eslint: [5, 6, 7]

steps:
- name: Checkout
uses: actions/checkout@v1

- 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
44 changes: 44 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Release

on:
workflow_run:
workflows: ['CI']
types:
- completed
push:
branches:
# semantic-release valid branches
- '+([0-9])?(.{+([0-9]),x}).x'
- 'main'
- 'next'
- 'next-major'
- 'beta'
- 'alpha'

jobs:
main:
name: NPM Release
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v1

- 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
Comment on lines +37 to +38
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we build in ci.yml ? I think we should (without releasing ofc)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mmmm not really sure about that, what would be the purpose for it? I'm gonna merge both workflows into a single file actually, since it's triggering the release twice.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to ensure there are no compilation errors (Typings for instance) committed without noticing?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah! I'm doing that on v4 so on "Code Validation" job I'll add format check and typescript check steps. I'll create a PR later with those updates for v4!


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

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ To enable this configuration use the `extends` property in your
| [prefer-screen-queries](docs/rules/prefer-screen-queries.md) | Suggest using screen while using queries | | |
| [prefer-wait-for](docs/rules/prefer-wait-for.md) | Use `waitFor` instead of deprecated wait methods | | ![fixable-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
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,10 @@
"lint": "eslint . --ext .js,.ts",
"lint:fix": "npm run lint -- --fix",
"format": "prettier --write README.md {lib,docs,tests}/**/*.{js,md}",
"test:local": "jest",
"test:ci": "jest --coverage",
"test": "jest",
"test:ci": "jest --ci --coverage",
"test:update": "npm run test:local -- --u",
"test:watch": "npm run test:local -- --watch",
"test": "is-ci test:ci test:local",
"semantic-release": "semantic-release"
},
"dependencies": {
Expand All @@ -72,7 +71,6 @@
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.1",
"husky": "^4.3.0",
"is-ci-cli": "^2.1.2",
"jest": "^25.5.4",
"lint-staged": "^9.5.0",
"prettier": "1.19.1",
Expand Down