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

Followup work on setup github actions #7431

Merged
merged 37 commits into from Mar 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
412bb10
Followup work on setup github actions
fisker Jan 25, 2020
d49207d
Coverage report & split `prod_lint`
fisker Jan 25, 2020
254278e
Add env
fisker Jan 25, 2020
2735e45
Remove coverage report on azure pipelines
fisker Jan 25, 2020
ad855a1
Remove build step on lint
fisker Jan 25, 2020
273381d
remove coverage report on prod_test
fisker Jan 25, 2020
d55836f
Use `ci-info` instead of `is-ci`
fisker Jan 25, 2020
3ff3798
Always enable `ENABLE_TEST_RESULTS` and `AST_COMPARE` on CI
fisker Jan 25, 2020
689e14e
Merge branch 'ci-env' into adjust-github-actions
fisker Jan 25, 2020
d38e456
Standalone test and remove some env
fisker Jan 25, 2020
19d8967
coverage report
fisker Jan 25, 2020
6f55df1
reduce matrix
fisker Jan 25, 2020
7df8ef8
Merge branch 'next' into adjust-github-actions
fisker Feb 14, 2020
9275fc2
standalone test
fisker Feb 14, 2020
f1133ad
Merge branch 'next' into adjust-github-actions
fisker Feb 14, 2020
a63f1a5
Merge branch 'next' into adjust-github-actions
fisker Mar 17, 2020
ce57952
`ci-info`
fisker Mar 17, 2020
5edd2de
Remove token
fisker Mar 17, 2020
404c81c
Disable `coverage` on azure pipelines
fisker Mar 17, 2020
7815cc5
use master version of codecov-action
fisker Mar 17, 2020
838e0f7
Link to master status
fisker Mar 17, 2020
767ffb6
fix prod lint
fisker Mar 17, 2020
869bf20
Use boolean env
fisker Mar 17, 2020
57ecc9a
Remove locv report
fisker Mar 17, 2020
3dcbf7d
Merge branch 'next' into adjust-github-actions
fisker Mar 18, 2020
7e61875
Try lcov report
fisker Mar 18, 2020
53f55fa
pin `codecov-action` version, enable `verbose`
fisker Mar 18, 2020
293c0c7
Merge branch 'next' into adjust-github-actions
fisker Mar 19, 2020
f2fb408
azure coverage
fisker Mar 19, 2020
e13fc68
Name
fisker Mar 19, 2020
a2acc7e
Trigger CI
fisker Mar 19, 2020
777253f
Use `basename`
fisker Mar 20, 2020
8e7f033
Trigger CI
fisker Mar 20, 2020
ac38ef0
Try `runInBand`
fisker Mar 21, 2020
173a068
Merge branch 'adjust-github-actions' of 13.114.40.48:fisker/prettier …
fisker Mar 21, 2020
a6e476a
try `maxWorkers`
fisker Mar 21, 2020
c2bf918
Merge branch 'master' into adjust-github-actions
thorn0 Mar 21, 2020
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
6 changes: 3 additions & 3 deletions .azure-pipelines/steps/publish-code-coverage.yml
Expand Up @@ -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())
29 changes: 21 additions & 8 deletions .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:
Expand All @@ -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
Expand All @@ -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
15 changes: 9 additions & 6 deletions .github/workflows/lint.yml
@@ -1,6 +1,6 @@
name: Lint

on: [pull_request]
on: [push, pull_request]

jobs:
lint:
Expand All @@ -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."
76 changes: 71 additions & 5 deletions .github/workflows/prod-test.yml
@@ -1,6 +1,6 @@
name: Prod_Test
name: Prod

on: [pull_request]
on: [push, pull_request]

jobs:
build:
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -65,5 +131,5 @@ jobs:
name: dist
path: dist

- name: Run Test
- name: Run Tests
run: yarn test:dist
8 changes: 6 additions & 2 deletions README.md
Expand Up @@ -45,8 +45,12 @@ This is the branch containing code for Prettier’s 2.0 release. See [the `maste
<p align="center">
<a href="https://dev.azure.com/prettier/prettier/_build/latest?definitionId=5">
<img alt="Azure Pipelines Build Status" src="https://img.shields.io/azure-devops/build/prettier/79013671-677c-4846-a6d8-3050d40e21c0/5.svg?style=flat-square&label=build&branchName=master"></a>
<a href="https://github.com/prettier/prettier/actions">
<img alt="Github Actions Build Status" src="https://img.shields.io/github/workflow/status/prettier/prettier/Prod_Test?style=flat-square"></a>
<a href="https://github.com/prettier/prettier/actions?query=workflow%3AProd+branch%3Amaster">
<img alt="Github Actions Build Status" src="https://img.shields.io/github/workflow/status/prettier/prettier/Prod?label=Prod&style=flat-square"></a>
<a href="https://github.com/prettier/prettier/actions?query=workflow%3ADev+branch%3Amaster">
<img alt="Github Actions Build Status" src="https://img.shields.io/github/workflow/status/prettier/prettier/Dev?label=Dev&style=flat-square"></a>
<a href="https://github.com/prettier/prettier/actions?query=workflow%3ALint+branch%3Amaster">
<img alt="Github Actions Build Status" src="https://img.shields.io/github/workflow/status/prettier/prettier/Lint?label=Lint&style=flat-square"></a>
<a href="https://codecov.io/gh/prettier/prettier">
<img alt="Codecov Coverage Status" src="https://img.shields.io/codecov/c/github/prettier/prettier.svg?style=flat-square"></a>
<a href="https://twitter.com/acdlite/status/974390255393505280">
Expand Down
3 changes: 2 additions & 1 deletion jest.config.js
Expand Up @@ -19,7 +19,7 @@ module.exports = {
"<rootDir>/src/doc/doc-debug.js",
"<rootDir>/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')`.
Expand All @@ -37,4 +37,5 @@ module.exports = {
"jest-watch-typeahead/testname",
],
reporters: ["default"].concat(ENABLE_TEST_RESULTS ? "jest-junit" : []),
verbose: true,
Copy link
Member

Choose a reason for hiding this comment

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

Could we remove this verbose: true? Now Jest prints too much when I run it locally.

Copy link
Sponsor Member Author

@fisker fisker Mar 25, 2020

Choose a reason for hiding this comment

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

How about set to isCI, yarn test will print less, and yarn test --verbose can still print more

Copy link
Sponsor Member Author

Choose a reason for hiding this comment

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

};
3 changes: 2 additions & 1 deletion scripts/test-dist.js
Expand Up @@ -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;

Expand All @@ -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}`;

Expand Down