mirror of
https://github.com/chartjs/Chart.js.git
synced 2024-10-06 12:19:08 +02:00
ci(workflow): add cache to workflows using actions/setup-node (#9757)
* ci(workflow): add 'npm' cache for actions/setup-node in .github/workflows * style(workflows): restore single quotes and remove unnecessary 'null'
This commit is contained in:
parent
6a250de81d
commit
12d5e4c7e7
145
.github/workflows/ci.yml
vendored
145
.github/workflows/ci.yml
vendored
@ -10,7 +10,6 @@ on:
|
|||||||
- master
|
- master
|
||||||
- "2.9"
|
- "2.9"
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
@ -24,80 +23,80 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Use Node.js
|
- name: Use Node.js
|
||||||
uses: actions/setup-node@v1
|
uses: actions/setup-node@v2
|
||||||
with:
|
with:
|
||||||
node-version: '14'
|
node-version: '14'
|
||||||
- uses: dorny/paths-filter@v2
|
cache: npm
|
||||||
id: changes
|
- uses: dorny/paths-filter@v2
|
||||||
with:
|
id: changes
|
||||||
filters: |
|
with:
|
||||||
docs:
|
filters: |
|
||||||
- 'docs/**'
|
docs:
|
||||||
- 'package.json'
|
- 'docs/**'
|
||||||
- 'tsconfig.json'
|
- 'package.json'
|
||||||
src:
|
- 'tsconfig.json'
|
||||||
- 'src/**'
|
src:
|
||||||
- 'package.json'
|
- 'src/**'
|
||||||
test:
|
- 'package.json'
|
||||||
- 'test/**'
|
test:
|
||||||
- 'karma.conf.js'
|
- 'test/**'
|
||||||
- 'package.json'
|
- 'karma.conf.js'
|
||||||
types:
|
- 'package.json'
|
||||||
- 'types/**'
|
types:
|
||||||
- 'package.json'
|
- 'types/**'
|
||||||
- 'tsconfig.json'
|
- 'package.json'
|
||||||
- name: Install
|
- 'tsconfig.json'
|
||||||
run: npm ci
|
- name: Install
|
||||||
- name: Build
|
run: npm ci
|
||||||
run: npm run build
|
- name: Build
|
||||||
- name: Test
|
run: npm run build
|
||||||
if: |
|
- name: Test
|
||||||
steps.changes.outputs.src == 'true' ||
|
if: |
|
||||||
steps.changes.outputs.test == 'true'
|
steps.changes.outputs.src == 'true' ||
|
||||||
run: |
|
steps.changes.outputs.test == 'true'
|
||||||
npm run build
|
run: |
|
||||||
if [ "${{ runner.os }}" == "Windows" ]; then
|
npm run build
|
||||||
npm test
|
if [ "${{ runner.os }}" == "Windows" ]; then
|
||||||
elif [ "${{ runner.os }}" == "macOS" ]; then
|
npm test
|
||||||
npm test --browsers chrome,safari
|
elif [ "${{ runner.os }}" == "macOS" ]; then
|
||||||
else
|
npm test --browsers chrome,safari
|
||||||
xvfb-run --auto-servernum npm test
|
else
|
||||||
fi
|
xvfb-run --auto-servernum npm test
|
||||||
shell: bash
|
fi
|
||||||
- name: Lint
|
shell: bash
|
||||||
run: npm run lint
|
- name: Lint
|
||||||
- name: Package
|
run: npm run lint
|
||||||
if: steps.changes.outputs.docs == 'true'
|
- name: Package
|
||||||
run: |
|
if: steps.changes.outputs.docs == 'true'
|
||||||
npm run docs
|
run: |
|
||||||
npm pack
|
npm run docs
|
||||||
- name: Coveralls Parallel - Chrome
|
npm pack
|
||||||
if: steps.changes.outputs.src == 'true'
|
- name: Coveralls Parallel - Chrome
|
||||||
uses: coverallsapp/github-action@master
|
if: steps.changes.outputs.src == 'true'
|
||||||
with:
|
uses: coverallsapp/github-action@master
|
||||||
github-token: ${{ secrets.github_token }}
|
with:
|
||||||
path-to-lcov: './coverage/chrome/lcov.info'
|
github-token: ${{ secrets.github_token }}
|
||||||
flag-name: ${{ matrix.os }}-chrome
|
path-to-lcov: './coverage/chrome/lcov.info'
|
||||||
parallel: true
|
flag-name: ${{ matrix.os }}-chrome
|
||||||
- name: Coveralls Parallel - Firefox
|
parallel: true
|
||||||
if: steps.changes.outputs.src == 'true'
|
- name: Coveralls Parallel - Firefox
|
||||||
uses: coverallsapp/github-action@master
|
if: steps.changes.outputs.src == 'true'
|
||||||
with:
|
uses: coverallsapp/github-action@master
|
||||||
github-token: ${{ secrets.github_token }}
|
with:
|
||||||
path-to-lcov: './coverage/firefox/lcov.info'
|
github-token: ${{ secrets.github_token }}
|
||||||
flag-name: ${{ matrix.os }}-firefox
|
path-to-lcov: './coverage/firefox/lcov.info'
|
||||||
parallel: true
|
flag-name: ${{ matrix.os }}-firefox
|
||||||
|
parallel: true
|
||||||
|
|
||||||
finish:
|
finish:
|
||||||
needs: build
|
needs: build
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Coveralls Finished
|
- name: Coveralls Finished
|
||||||
if: needs.build.outputs.coveralls == 'true'
|
if: needs.build.outputs.coveralls == 'true'
|
||||||
uses: coverallsapp/github-action@master
|
uses: coverallsapp/github-action@master
|
||||||
with:
|
with:
|
||||||
github-token: ${{ secrets.github_token }}
|
github-token: ${{ secrets.github_token }}
|
||||||
parallel-finished: true
|
parallel-finished: true
|
||||||
|
39
.github/workflows/deploy-docs.yml
vendored
39
.github/workflows/deploy-docs.yml
vendored
@ -10,27 +10,28 @@ jobs:
|
|||||||
correct_repository:
|
correct_repository:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: fail on fork
|
- name: fail on fork
|
||||||
if: github.repository_owner != 'chartjs'
|
if: github.repository_owner != 'chartjs'
|
||||||
run: exit 1
|
run: exit 1
|
||||||
|
|
||||||
build:
|
build:
|
||||||
needs: correct_repository
|
needs: correct_repository
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Use Node.js
|
- name: Use Node.js
|
||||||
uses: actions/setup-node@v1
|
uses: actions/setup-node@v2
|
||||||
with:
|
with:
|
||||||
node-version: '14.x'
|
node-version: '14.x'
|
||||||
- name: Package & Deploy Docs
|
cache: npm
|
||||||
run: |
|
- name: Package & Deploy Docs
|
||||||
npm ci
|
run: |
|
||||||
npm run build
|
npm ci
|
||||||
./scripts/docs-config.sh "master"
|
npm run build
|
||||||
npm run docs
|
./scripts/docs-config.sh "master"
|
||||||
npm pack
|
npm run docs
|
||||||
./scripts/deploy-docs.sh "master"
|
npm pack
|
||||||
env:
|
./scripts/deploy-docs.sh "master"
|
||||||
GITHUB_TOKEN: ${{ secrets.GH_AUTH_TOKEN }}
|
env:
|
||||||
GH_AUTH_EMAIL: ${{ secrets.GH_AUTH_EMAIL }}
|
GITHUB_TOKEN: ${{ secrets.GH_AUTH_TOKEN }}
|
||||||
|
GH_AUTH_EMAIL: ${{ secrets.GH_AUTH_EMAIL }}
|
||||||
|
8
.github/workflows/release.yml
vendored
8
.github/workflows/release.yml
vendored
@ -20,10 +20,11 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: actions/setup-node@v1
|
- uses: actions/setup-node@v2
|
||||||
with:
|
with:
|
||||||
node-version: '14.x'
|
node-version: '14.x'
|
||||||
registry-url: https://registry.npmjs.org/
|
registry-url: https://registry.npmjs.org/
|
||||||
|
cache: npm
|
||||||
- name: Setup and build
|
- name: Setup and build
|
||||||
run: |
|
run: |
|
||||||
npm ci
|
npm ci
|
||||||
@ -59,15 +60,16 @@ jobs:
|
|||||||
asset_name: ${{ format('chart.js-{0}.tgz', needs.setup.outputs.version) }}
|
asset_name: ${{ format('chart.js-{0}.tgz', needs.setup.outputs.version) }}
|
||||||
asset_content_type: application/gzip
|
asset_content_type: application/gzip
|
||||||
release-tag:
|
release-tag:
|
||||||
needs: [setup,release]
|
needs: [setup, release]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: "!github.event.release.prerelease"
|
if: "!github.event.release.prerelease"
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: actions/setup-node@v1
|
- uses: actions/setup-node@v2
|
||||||
with:
|
with:
|
||||||
node-version: '14.x'
|
node-version: '14.x'
|
||||||
registry-url: https://registry.npmjs.org/
|
registry-url: https://registry.npmjs.org/
|
||||||
|
cache: npm
|
||||||
- name: Setup and build
|
- name: Setup and build
|
||||||
run: |
|
run: |
|
||||||
npm ci
|
npm ci
|
||||||
|
Loading…
Reference in New Issue
Block a user