Skip to content

Github #344, #345: Add sbomscanner related configuration to unit test, CI test and typescript compilation #2

Github #344, #345: Add sbomscanner related configuration to unit test, CI test and typescript compilation

Github #344, #345: Add sbomscanner related configuration to unit test, CI test and typescript compilation #2

name: Unit Tests - SBOMScanner
on:
workflow_dispatch:
schedule:
- cron: '0 21 * * *'
pull_request:
branches:
- main
paths:
- 'pkg/sbomscanner/**'
jobs:
unit-test-sbomscanner:
if: github.repository_owner == 'rancher'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
with:
fetch-depth: 0
- name: Setup Nodejs and npm
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
with:
node-version: '20'
- name: Setup yarn
run: npm install -g yarn
- name: Setup Nodejs with yarn caching
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
with:
node-version: '20'
cache: yarn
- name: Install dependencies
run: yarn
- name: Run tests and collect coverage
run: |
yarn test:ci:sbomscanner
mkdir -p coverage-artifacts/coverage/sbomscanner/unit
cp coverage/unit/sbomscanner/coverage-final.json coverage-artifacts/coverage/sbomscanner/coverage-unit.json
- name: Upload coverage
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: ${{github.run_number}}-${{github.run_attempt}}-coverage-sbomscanner
path: coverage-artifacts/coverage/sbomscanner/**/*