Skip to content

chore(deps-dev): bump istanbul-reports from 3.1.5 to 3.1.6 #2561

chore(deps-dev): bump istanbul-reports from 3.1.5 to 3.1.6

chore(deps-dev): bump istanbul-reports from 3.1.5 to 3.1.6 #2561

Workflow file for this run

# docs: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
name: Node CI
on:
push:
branches: [ main ]
tags: [ "v*" ] # have tools scan this stable version
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
NODE_ACTIVE_LTS: "20" # see https://nodejs.org/en/about/releases/
REPORTS_DIR: "CI_reports"
TESTS_REPORTS_ARTIFACT: tests-reports
STANDARD_REPORTS_ARTIFACT: cs-reports
jobs:
build:
name: build ${{ matrix.target }}
runs-on: "ubuntu-latest"
strategy:
fail-fast: false
matrix:
target:
- node
- web
- d
timeout-minutes: 10
steps:
- name: Checkout
# see https://github.com/actions/checkout
uses: actions/checkout@v3
- name: Setup Node.js ${{ env.NODE_ACTIVE_LTS }}
# see https://github.com/actions/setup-node
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_ACTIVE_LTS }}
cache: "npm"
cache-dependency-path: "**/package-lock.json"
- name: setup project
run: npm ci --ignore-scripts --include=optional --loglevel=silly
- name: build ${{ matrix.target }}
run: npm run build:${{ matrix.target }}
- name: artifact build result
# see https://github.com/actions/upload-artifact
uses: actions/upload-artifact@v3
with:
name: dist.${{ matrix.target }}
path: dist.${{ matrix.target }}
if-no-files-found: error
test-standard:
name: test standard
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
# see https://github.com/actions/checkout
uses: actions/checkout@v3
- name: Setup Node.js ${{ env.NODE_ACTIVE_LTS }}
# see https://github.com/actions/setup-node
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_ACTIVE_LTS }}
cache: "npm"
cache-dependency-path: "**/package-lock.json"
- name: setup project
run: npm ci --ignore-scripts --include=optional --loglevel=silly
- name: make reports dir
run: mkdir -p "$REPORTS_DIR"
- name: test
run: >
npm run --
test:standard
--format checkstyle
--output-file "$REPORTS_DIR/eslint.xml"
- name: Publish Checkstyle report
# see https://github.com/Juuxel/publish-checkstyle-report
uses: Juuxel/publish-checkstyle-report@v1
if: ${{ failure() || success() }}
with:
reports: ${{ env.REPORTS_DIR }}/eslint.xml
- name: artifact build result
# see https://github.com/actions/upload-artifact
uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: ${{ env.STANDARD_REPORTS_ARTIFACT }}
path: ${{ env.REPORTS_DIR }}
if-no-files-found: error
test-node:
needs: [ 'build' ]
name: test node (${{ matrix.node-version }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
node-version:
# action based on https://github.com/actions/node-versions/releases
# see also: https://nodejs.org/en/about/releases/
- "20" # Current
- "18" # active LTS
- "16"
- "14"
- "14.0.0" # lowest supported
os:
- ubuntu-latest
- macos-latest
- windows-latest
timeout-minutes: 10
steps:
- name: Checkout
# see https://github.com/actions/checkout
uses: actions/checkout@v3
- name: Setup Node.js ${{ matrix.node-version }}
# see https://github.com/actions/setup-node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
cache-dependency-path: "**/package-lock.json"
- name: setup project
shell: bash
run: |
set -ex
npm ci --ignore-scripts --include=optional --loglevel=silly
## rebuild deps for which scripts were ignored, or partially installed - since "ignore-scripts" was used
npm rebuild --loglevel=silly libxmljs2 || npm uninstall --no-save libxmljs2
- name: fetch build artifact
# see https://github.com/actions/download-artifact
uses: actions/download-artifact@v3
with:
name: dist.node
path: dist.node
- name: test
run: npm run test:node
- name: collect coverage
if: ${{ failure() || success() }}
run: >
node -- node_modules/c8/bin/c8.js
report
--reporter clover
--reports-dir '${{ env.REPORTS_DIR }}/coverage/${{ matrix.os }}_node${{ matrix.node-version }}'
- name: artifact test reports
if: ${{ ! cancelled() }}
# see https://github.com/actions/upload-artifact
uses: actions/upload-artifact@v3
with:
name: ${{ env.TESTS_REPORTS_ARTIFACT }}
path: ${{ env.REPORTS_DIR }}
# test-web:
# TODO via https://github.com/CycloneDX/cyclonedx-javascript-library/issues/51
test-omit-optional-deps:
needs: [ 'build' ]
name: test w/o optional dependencies
runs-on: ubuntu-latest
steps:
- name: Checkout
# see https://github.com/actions/checkout
uses: actions/checkout@v3
- name: Setup Node.js ${{ env.NODE_ACTIVE_LTS }}
# see https://github.com/actions/setup-node
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_ACTIVE_LTS }}
- name: setup library
run: npm ci --ignore-scripts --omit=optional --loglevel=silly
- name: fetch build artifact
# see https://github.com/actions/download-artifact
uses: actions/download-artifact@v3
with:
name: dist.node
path: dist.node
- name: test
run: npm run test:node
- name: collect coverage
if: ${{ failure() || success() }}
run: >
npx c8 report
--reporter clover
--reports-dir '${{ env.REPORTS_DIR }}/coverage/no-optional-deps'
- name: artifact test reports
if: ${{ ! cancelled() }}
# see https://github.com/actions/upload-artifact
uses: actions/upload-artifact@v3
with:
name: ${{ env.TESTS_REPORTS_ARTIFACT }}
path: ${{ env.REPORTS_DIR }}
report-coverage:
name: Publish test coverage
needs:
- test-node
- test-omit-optional-deps
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: fetch test artifacts
# see https://github.com/actions/download-artifact
uses: actions/download-artifact@v3
with:
name: ${{ env.TESTS_REPORTS_ARTIFACT }}
path: ${{ env.REPORTS_DIR }}
- name: Run codacy-coverage-reporter
env:
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
if: ${{ env.CODACY_PROJECT_TOKEN != '' }} ## see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-using-secrets
# see https://github.com/codacy/codacy-coverage-reporter-action/blob/8a27d704d4ea6890aee42477b231c4fbbebac2ae/action.yml#L59
run: |
set -eux
auth="--project-token '$CODACY_PROJECT_TOKEN'"
reports=''
for report in $REPORTS_DIR/coverage/*/*
do
reports="$reports -r '$report'"
done
bash <(curl -Ls https://raw.githubusercontent.com/codacy/codacy-coverage-reporter/master/get.sh) report $auth $reports --partial -l TypeScript &&\
bash <(curl -Ls https://raw.githubusercontent.com/codacy/codacy-coverage-reporter/master/get.sh) report $auth $reports --partial -l Javascript &&\
bash <(curl -Ls https://raw.githubusercontent.com/codacy/codacy-coverage-reporter/master/get.sh) final $auth
examples-JS:
needs: [ 'build' ]
name: example JS ${{ matrix.js-type }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
js-type: [ 'cjs', 'mjs' ]
env:
EXAMPLE_DIR: examples/node/javascript
steps:
- name: Checkout
# see https://github.com/actions/checkout
uses: actions/checkout@v3
- name: Setup Node.js ${{ env.NODE_ACTIVE_LTS }}
# see https://github.com/actions/setup-node
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_ACTIVE_LTS }}
- name: fetch build artifact 'node'
# see https://github.com/actions/download-artifact
uses: actions/download-artifact@v3
with:
name: dist.node
path: dist.node
- name: setup library
run: |
set -ex
npm ci --ignore-scripts --omit=dev --include=optional --loglevel=silly
## rebuild deps for which scripts were ignored, or partially installed - since "ignore-scripts" was used
npm rebuild --loglevel=silly libxmljs2 || npm uninstall --no-save libxmljs2
- name: setup example project
run: npm i --no-save --loglevel=silly
working-directory: ${{ env.EXAMPLE_DIR }}
- name: run example
run: node -- 'example.${{ matrix.js-type }}'
working-directory: ${{ env.EXAMPLE_DIR }}
example-TS:
needs: [ 'build' ]
name: example TS${{ matrix.typescript-version }} ${{ matrix.js-type }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
typescript-version:
- '^5' # latest 5.X
- '^4' # latest 4.X
js-type: [ 'cjs', 'mjs' ]
include:
- # lowest reasonable number that works
typescript-version: '^3.8'
nodeTypes-version: '^14'
js-type: 'cjs'
env:
EXAMPLE_DIR: examples/node/typescript/example.${{ matrix.js-type }}
timeout-minutes: 10
steps:
- name: Checkout
# see https://github.com/actions/checkout
uses: actions/checkout@v3
- name: Setup Node.js ${{ env.NODE_ACTIVE_LTS }}
# see https://github.com/actions/setup-node
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_ACTIVE_LTS }}
- name: fetch build artifact 'd'
# see https://github.com/actions/download-artifact
uses: actions/download-artifact@v3
with:
name: dist.d
path: dist.d
- name: fetch build artifact 'node'
# see https://github.com/actions/download-artifact
uses: actions/download-artifact@v3
with:
name: dist.node
path: dist.node
- name: setup library
run: |
set -ex
npm ci --ignore-scripts --omit=dev --include=optional --loglevel=silly
## rebuild deps for which scripts were ignored, or partially installed - since "ignore-scripts" was used
npm rebuild --loglevel=silly libxmljs2 || npm uninstall --no-save libxmljs2
- name: setup example project
run: npm i --no-save --loglevel=silly 'typescript@${{ matrix.typescript-version }}'
working-directory: ${{ env.EXAMPLE_DIR }}
- name: get TS-version
id: ts_version
run: node -p '`v=ts${require("typescript").version.split(".",2).join(".")}`' >> "$GITHUB_OUTPUT"
working-directory: ${{ env.EXAMPLE_DIR }}
- name: adjust @types/node version
run: npm i --no-save --loglevel=silly '@types/node@${{ matrix.nodeTypes-version || steps.ts_version.outputs.v}}'
working-directory: ${{ env.EXAMPLE_DIR }}
- name: build example
run: npm run build
working-directory: ${{ env.EXAMPLE_DIR }}
- name: run example
run: npm run example
working-directory: ${{ env.EXAMPLE_DIR }}
examples-Web:
needs: [ 'build' ]
name: example Web ${{ matrix.packer }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
packer:
- parcel
- webpack
env:
EXAMPLE_DIR: examples/web/${{ matrix.packer }}
steps:
- name: Checkout
# see https://github.com/actions/checkout
uses: actions/checkout@v3
- name: Setup Node.js ${{ env.NODE_ACTIVE_LTS }}
# see https://github.com/actions/setup-node
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_ACTIVE_LTS }}
- name: fetch build artifact 'node'
# see https://github.com/actions/download-artifact
uses: actions/download-artifact@v3
with:
name: dist.web
path: dist.web
- name: setup library
run: npm ci --ignore-scripts --omit=dev --include=optional --loglevel=silly
- name: setup example project
run: npm i --no-save --loglevel=silly
working-directory: ${{ env.EXAMPLE_DIR }}
- name: build example
run: npm run build
working-directory: ${{ env.EXAMPLE_DIR }}
api-doc:
name: api-doc ${{ matrix.target }}
runs-on: "ubuntu-latest"
strategy:
fail-fast: false
matrix:
target:
- node
- web
timeout-minutes: 10
steps:
- name: Checkout
# see https://github.com/actions/checkout
uses: actions/checkout@v3
- name: Setup Node.js ${{ env.NODE_ACTIVE_LTS }}
# see https://github.com/actions/setup-node
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_ACTIVE_LTS }}
cache: "npm"
cache-dependency-path: "**/package-lock.json"
- name: setup project
run: npm ci --ignore-scripts --loglevel=silly
- name: api-doc ${{ matrix.target }}
run: npm run api-doc:${{ matrix.target }}