diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..c54be545 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,7 @@ +version: 2 +updates: + # Set update schedule for GitHub Actions + - package-ecosystem: 'github-actions' + directory: '/' + schedule: + interval: 'daily' diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..199da601 --- /dev/null +++ b/.github/workflows/ci.yml @@ -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 + + - 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 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..4128186b --- /dev/null +++ b/.github/workflows/release.yml @@ -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 + + - name: Release new version to NPM + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + run: npx semantic-release diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index eee7f934..00000000 --- a/.travis.yml +++ /dev/null @@ -1,34 +0,0 @@ -language: node_js - -env: - global: - - FORCE_COLOR=true - matrix: - - ESLINT=5 - - ESLINT=6 - - ESLINT=7 - -node_js: - - 10.12 - - 10 - - 12.0 - - 12 - - 14 - -before_script: - - 'if [ -n "${ESLINT-}" ]; then npm install --no-save "eslint@${ESLINT}" ; fi' - -jobs: - include: - - stage: release - if: branch = main AND type != pull_request AND fork = false - node_js: 14 - env: ESLINT=7 - script: npm run build - deploy: - provider: script - skip_cleanup: true - on: - branch: main - script: - - npx semantic-release diff --git a/README.md b/README.md index e7e46d09..03f7f89d 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/package.json b/package.json index afd0dde4..4faa5a78 100644 --- a/package.json +++ b/package.json @@ -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": { @@ -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",