diff --git a/.azure-pipelines/steps/publish-code-coverage.yml b/.azure-pipelines/steps/publish-code-coverage.yml index 9c5cd329a279..a502ffa9ca71 100644 --- a/.azure-pipelines/steps/publish-code-coverage.yml +++ b/.azure-pipelines/steps/publish-code-coverage.yml @@ -6,6 +6,6 @@ steps: summaryFileLocation: $(System.DefaultWorkingDirectory)/coverage/cobertura-coverage.xml displayName: "Publish coverage" condition: and(variables.ENABLE_CODE_COVERAGE, succeededOrFailed()) - - script: yarn codecov -f coverage/cobertura-coverage.xml - displayName: "Publish coverage to Codecov" - condition: and(variables.ENABLE_CODE_COVERAGE, succeededOrFailed()) + # - script: yarn codecov -f coverage/cobertura-coverage.xml + # displayName: "Publish coverage to Codecov" + # condition: and(variables.ENABLE_CODE_COVERAGE, succeededOrFailed()) diff --git a/.github/workflows/dev-test.yml b/.github/workflows/dev-test.yml index aab8738039f4..cbf1672f1cee 100644 --- a/.github/workflows/dev-test.yml +++ b/.github/workflows/dev-test.yml @@ -1,9 +1,9 @@ -name: Dev_Test +name: Dev -on: [pull_request] +on: [push, pull_request] jobs: - dev_test: + test: strategy: fail-fast: false matrix: @@ -15,8 +15,14 @@ jobs: - "13" - "12" - "10" - - name: Dev test on node ${{ matrix.node }} and ${{ matrix.os }} + include: + # only enable coverage on the fastest job + - os: "ubuntu-latest" + node: "12" + ENABLE_CODE_COVERAGE: true + env: + ENABLE_CODE_COVERAGE: ${{ matrix.ENABLE_CODE_COVERAGE }} + name: Node.js ${{ matrix.node }} on ${{ matrix.os }} runs-on: ${{ matrix.os }} steps: - name: Checkout @@ -27,10 +33,17 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v1 with: - node-version: ${{ matrix.NODE }} + node-version: ${{ matrix.node }} - name: Install Dependencies run: yarn install --frozen-lockfile - - name: Run Test - run: yarn test + - name: Run Tests + run: yarn test --maxWorkers=4 + + - name: Upload Coverage + uses: codecov/codecov-action@v1 + if: matrix.ENABLE_CODE_COVERAGE + with: + file: ./coverage/lcov.info + fail_ci_if_error: true diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index bcb60fdc6a71..cc29015377f5 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,6 +1,6 @@ name: Lint -on: [pull_request] +on: [push, pull_request] jobs: lint: @@ -20,20 +20,23 @@ jobs: - name: Install Dependencies run: yarn install --frozen-lockfile - - name: Check dependencies + - name: Check Dependencies run: yarn lint:deps - - name: Check JSDoc types + - name: Check JSDoc Types run: yarn lint:typecheck - - name: Lint code + - name: Lint ESLint run: yarn lint:eslint - - name: Lint prettier + - name: Lint Prettier run: yarn lint:prettier - name: Spellcheck run: yarn lint:spellcheck - - name: Check file changes + - name: Lint Changelog + run: yarn lint:changelog + + - name: Check Lock File Changes run: yarn && echo "Listing changed files:" && git diff --name-only --exit-code && echo "No files changed during lint." diff --git a/.github/workflows/prod-test.yml b/.github/workflows/prod-test.yml index ac2c3bc5f4dc..8e52592168c7 100644 --- a/.github/workflows/prod-test.yml +++ b/.github/workflows/prod-test.yml @@ -1,6 +1,6 @@ -name: Prod_Test +name: Prod -on: [pull_request] +on: [push, pull_request] jobs: build: @@ -29,7 +29,34 @@ jobs: name: dist path: dist - prod_test: + lint: + name: Lint + runs-on: ubuntu-latest + needs: [build] + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 1 + + - name: Setup Node.js + uses: actions/setup-node@v1 + with: + node-version: "12" + + - name: Install Dependencies + run: yarn install --frozen-lockfile + + - name: Download Artifact + uses: actions/download-artifact@v1 + with: + name: dist + path: dist + + - name: Lint Code + run: yarn lint:dist + + test: strategy: fail-fast: false matrix: @@ -41,8 +68,47 @@ jobs: - "13" - "12" - "10" + name: Node.js ${{ matrix.node }} on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + needs: [build] + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 1 + + - name: Setup Node.js + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node }} + + - name: Install Dependencies + run: yarn install --frozen-lockfile + + - name: Download Artifact + uses: actions/download-artifact@v1 + with: + name: dist + path: dist + + - name: Run Tests + run: yarn test:dist - name: Prod test on node ${{ matrix.node }} and ${{ matrix.os }} + standalone: + strategy: + fail-fast: false + matrix: + os: + - "ubuntu-latest" + - "macos-latest" + - "windows-latest" + node: + - "13" + - "12" + - "10" + env: + STANDALONE: true + name: Node.js ${{ matrix.node }} on ${{ matrix.os }} (standalone) runs-on: ${{ matrix.os }} needs: [build] steps: @@ -65,5 +131,5 @@ jobs: name: dist path: dist - - name: Run Test + - name: Run Tests run: yarn test:dist diff --git a/README.md b/README.md index a6a129de2373..384f59d977da 100644 --- a/README.md +++ b/README.md @@ -45,8 +45,12 @@ This is the branch containing code for Prettier’s 2.0 release. See [the `maste

Azure Pipelines Build Status - - Github Actions Build Status + + Github Actions Build Status + + Github Actions Build Status + + Github Actions Build Status Codecov Coverage Status diff --git a/jest.config.js b/jest.config.js index 336caa345b00..248bdcd86a87 100644 --- a/jest.config.js +++ b/jest.config.js @@ -19,7 +19,7 @@ module.exports = { "/src/doc/doc-debug.js", "/src/main/massage-ast.js", ], - coverageReporters: ["text", "html", "cobertura"], + coverageReporters: ["text", "html", "cobertura", "lcov"], moduleNameMapper: { // Jest wires `fs` to `graceful-fs`, which causes a memory leak when // `graceful-fs` does `require('fs')`. @@ -37,4 +37,5 @@ module.exports = { "jest-watch-typeahead/testname", ], reporters: ["default"].concat(ENABLE_TEST_RESULTS ? "jest-junit" : []), + verbose: true, }; diff --git a/scripts/test-dist.js b/scripts/test-dist.js index a9a8c41acc8c..a915e9afee95 100644 --- a/scripts/test-dist.js +++ b/scripts/test-dist.js @@ -5,6 +5,7 @@ const path = require("path"); const shell = require("shelljs"); const tempy = require("tempy"); +const { isCI } = require("ci-info"); shell.config.fatal = true; @@ -20,7 +21,7 @@ shell.exec("npm init -y", { cwd: tmpDir }); shell.exec(`npm install "${tarPath}"`, { cwd: tmpDir }); shell.config.silent = false; -const runInBand = process.env.CI ? "--runInBand" : ""; +const runInBand = isCI ? "--runInBand" : ""; const testPath = process.env.TEST_STANDALONE ? "tests/" : ""; const cmd = `yarn test --color ${runInBand} ${testPath}`;