Skip to content

ci: add CodeQL workflow for code scanning #350

ci: add CodeQL workflow for code scanning

ci: add CodeQL workflow for code scanning #350

Workflow file for this run

name: Build and Test
on:
push:
branches: ['main']
pull_request:
branches: ['main']
permissions:
contents: read
# Cancel in-progress runs when a new commit is pushed
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
node-version: [20.x, 22.x, 24.x]
steps:
- uses: actions/checkout@v6
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Configure git for tests
run: |
git config --global user.email "bedrock-agentcore-npm+ci@amazon.com"
git config --global user.name "CI"
- name: Install uv
uses: astral-sh/setup-uv@v5
- run: npm ci
- run: npm run build --if-present
- run: npm run test:unit
- name: Upload coverage artifact
if: matrix.node-version == '20.x'
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage/
coverage:
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v6
- name: Download coverage artifact
uses: actions/download-artifact@v4
with:
name: coverage-report
path: coverage/
- name: Coverage Report
uses: davelosert/vitest-coverage-report-action@v2
with:
json-summary-path: coverage/coverage-summary.json
json-final-path: coverage/coverage-final.json
vite-config-path: vitest.unit.config.ts
file-coverage-mode: none
coverage-thresholds: '{ "lines": 50, "branches": 50, "functions": 50, "statements": 50 }'