4.0.0 #319
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 | |
paths-ignore: | |
- "*/**.md" | |
- "*/**.txt" | |
pull_request: | |
paths-ignore: | |
- "*/**.md" | |
- "*/**.txt" | |
workflow_dispatch: | |
env: | |
CI: true | |
NODE_LATEST: 21.x | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
check: | |
name: check | |
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 | |
- 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: dump some variables | |
# run: | | |
# echo '## github object' >> $GITHUB_STEP_SUMMARY | |
# echo '```json' >> $GITHUB_STEP_SUMMARY | |
# echo '${{toJSON(github)}}' >> $GITHUB_STEP_SUMMARY | |
# echo '```' >> $GITHUB_STEP_SUMMARY | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: ${{matrix.node-version}} | |
- run: npm install | |
- run: npm run depcruise | |
if: matrix.node-version != '18.x' | |
- name: lint on platforms other than 18.x | |
if: matrix.node-version != '18.x' | |
run: npm run lint | |
- run: npm run test:cover | |
if: matrix.node-version != '18.x' | |
- run: npx tsx --test src/*.spec.ts src/**/*.spec.ts | |
if: matrix.node-version == '18.x' | |
- run: npm run build | |
- name: emit coverage results to step summary | |
if: always() && matrix.node-version == env.NODE_LATEST | |
run: | | |
echo '## Code coverage' >> $GITHUB_STEP_SUMMARY | |
npx tsx tools/istanbul-json-summary-to-markdown.ts < coverage/coverage-summary.json >> $GITHUB_STEP_SUMMARY | |
- name: emit full depcruise results to step summary | |
if: always() && matrix.node-version == env.NODE_LATEST | |
run: | | |
yarn --silent depcruise --output-type markdown >> $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:graph:diff:mermaid >> $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. >> $GITHUB_STEP_SUMMARY | |
echo '```mermaid' >> $GITHUB_STEP_SUMMARY | |
SHA=${{github.event.pull_request.base.sha}} yarn --silent depcruise:graph:diff:mermaid >> $GITHUB_STEP_SUMMARY | |
echo '' >> $GITHUB_STEP_SUMMARY | |
echo '```' >> $GITHUB_STEP_SUMMARY |