diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 199da601..00000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,69 +0,0 @@ -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/pipeline.yml b/.github/workflows/pipeline.yml new file mode 100644 index 00000000..7a91b8b4 --- /dev/null +++ b/.github/workflows/pipeline.yml @@ -0,0 +1,114 @@ +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: Lint code + run: npm run lint + + # TODO: reenable on v4 + run tsc + # - name: Check format + # run: npm run format:check + + tests: + 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: 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 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 4128186b..00000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,44 +0,0 @@ -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/package.json b/package.json index 4faa5a78..ab457434 100644 --- a/package.json +++ b/package.json @@ -46,8 +46,8 @@ "format": "prettier --write README.md {lib,docs,tests}/**/*.{js,md}", "test": "jest", "test:ci": "jest --ci --coverage", - "test:update": "npm run test:local -- --u", - "test:watch": "npm run test:local -- --watch", + "test:update": "npm run test -- --u", + "test:watch": "npm run test -- --watch", "semantic-release": "semantic-release" }, "dependencies": {