ci(deps): bump actions/cache from 3 to 4 #282
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ci | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
env: | |
NODE_LATEST: 21.x | |
CI: true | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
check-linux: | |
strategy: | |
fail-fast: false | |
matrix: | |
node-version: [18.x, 21.x] | |
platform: [ubuntu-latest] | |
runs-on: ${{matrix.platform}} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
if: github.event_name == 'pull_request' && matrix.node-version == env.NODE_LATEST | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
if: github.event_name != 'pull_request' || matrix.node-version != env.NODE_LATEST | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: ${{matrix.node-version}} | |
- uses: actions/cache@v4 | |
with: | |
path: node_modules | |
key: ${{matrix.node-version}}@${{matrix.platform}}-build-${{hashFiles('package.json')}} | |
restore-keys: | | |
${{matrix.node-version}}@${{matrix.platform}}-build- | |
- name: install | |
run: | | |
npm install | |
apt-fast --assume-yes install graphviz | |
- name: lint (on node ${{env.NODE_LATEST}} only) | |
if: matrix.node-version == env.NODE_LATEST | |
run: | | |
npm run depcruise -- --progress performance-log --cache-strategy content | |
npm run lint | |
- name: test (on node != ${{env.NODE_LATEST}} only) | |
if: matrix.node-version != env.NODE_LATEST | |
run: npm test | |
- name: test coverage (on node ${{env.NODE_LATEST}} only) | |
if: matrix.node-version == env.NODE_LATEST | |
run: npm run test:cover | |
- name: report coverage to code climate (on node ${{env.NODE_LATEST}} only) | |
if: matrix.node-version == env.NODE_LATEST | |
uses: paambaati/codeclimate-action@v5 | |
env: | |
CC_TEST_REPORTER_ID: ${{ secrets.CODE_CLIMATE_TEST_COVERAGE_ID }} | |
- name: emit coverage results & depcruise result to step summary | |
if: always() && matrix.node-version == env.NODE_LATEST | |
run: | | |
echo '## Code coverage' >> $GITHUB_STEP_SUMMARY | |
# using node --nowarnings --loader ts-node/esm instead of just ts-node | |
# because https://github.com/TypeStrong/ts-node/issues/2005 happens | |
# on node 20 | |
node --no-warnings --loader ts-node/esm tools/istanbul-json-summary-to-markdown.mts < coverage/coverage-summary.json >> $GITHUB_STEP_SUMMARY | |
yarn --silent depcruise:github-actions:markdown --progress performance-log --cache-strategy content >> $GITHUB_STEP_SUMMARY | |
- name: on pushes to the default branch emit graph to the step summary | |
if: always() && matrix.node-version == env.NODE_LATEST && github.event_name == 'push' && github.ref_name == github.event.repository.default_branch | |
run: | | |
echo '## Visual overview' >> $GITHUB_STEP_SUMMARY | |
echo '```mermaid' >> $GITHUB_STEP_SUMMARY | |
yarn --silent depcruise:github-actions:mermaid --progress performance-log --cache-strategy content >> $GITHUB_STEP_SUMMARY | |
echo '' >> $GITHUB_STEP_SUMMARY | |
echo '```' >> $GITHUB_STEP_SUMMARY | |
- name: on pull requests emit depcruise graph to step summary with changed modules highlighted | |
if: always() && matrix.node-version == env.NODE_LATEST && github.event_name == 'pull_request' && github.ref_name != github.event.repository.default_branch | |
run: | | |
echo '## Visual diff' >> $GITHUB_STEP_SUMMARY | |
echo Modules changed in this PR have a fluorescent green color. All other modules in the graph are those directly or indirectly affected by changes in the green modules. >> $GITHUB_STEP_SUMMARY | |
echo '```mermaid' >> $GITHUB_STEP_SUMMARY | |
SHA=${{github.event.pull_request.base.sha}} yarn --silent depcruise:github-actions:mermaid:affected --progress performance-log >> $GITHUB_STEP_SUMMARY | |
echo '' >> $GITHUB_STEP_SUMMARY | |
echo '```' >> $GITHUB_STEP_SUMMARY | |
- name: dependency review (manifest scan) | |
if: matrix.node-version == env.NODE_LATEST && github.event_name == 'pull_request' | |
uses: actions/dependency-review-action@v3 | |
check-windows: | |
env: | |
PLATFORM: windows-latest | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: ${{env.NODE_LATEST}} | |
- uses: actions/cache@v4 | |
with: | |
path: node_modules | |
key: ${{matrix.node-version}}@${{matrix.platform}}-build-${{hashFiles('package.json')}} | |
restore-keys: | | |
${{matrix.node-version}}@${{matrix.platform}}-build- | |
- run: npm install | |
- run: npm test |