Files
skills-vault/.github/workflows/ci.yml
T

120 lines
3.1 KiB
YAML

name: CI
on:
pull_request:
branches:
- main
paths-ignore:
- ".archive/**"
- "docs/**"
- ".editorconfig"
- ".gitignore"
- ".github/*.md"
- ".github/ISSUE_TEMPLATE/**"
- ".github/PULL_REQUEST_TEMPLATE"
- ".github/PULL_REQUEST_TEMPLATE.md"
- ".github/PULL_REQUEST_TEMPLATE/**"
- "CHANGELOG.md"
- "CODEOWNERS"
- "CODE_OF_CONDUCT.md"
- "CONTRIBUTING.md"
- "LICENSE"
- "SECURITY.md"
- "SUPPORT.md"
push:
branches:
- main
paths-ignore:
- ".archive/**"
- "docs/**"
- ".editorconfig"
- ".gitignore"
- ".github/*.md"
- ".github/ISSUE_TEMPLATE/**"
- ".github/PULL_REQUEST_TEMPLATE"
- ".github/PULL_REQUEST_TEMPLATE.md"
- ".github/PULL_REQUEST_TEMPLATE/**"
- "CHANGELOG.md"
- "CODEOWNERS"
- "CODE_OF_CONDUCT.md"
- "CONTRIBUTING.md"
- "LICENSE"
- "SECURITY.md"
- "SUPPORT.md"
permissions:
contents: read
concurrency:
group: ci-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
NODE_VERSION: "22"
jobs:
validate:
name: Validate (${{ matrix.os }})
runs-on: ${{ matrix.os }}
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: Setup Node.js
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f
with:
node-version: ${{ env.NODE_VERSION }}
- name: Setup Bun
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Check formatting
run: bun run format:check
- name: Check workflow formatting
run: bunx prettier --check ".github/**/*.yml"
- name: Run tests
run: bun test
- name: Pack npm tarball
id: pack
shell: pwsh
run: |
$tarball = (npm pack | Select-Object -Last 1).Trim()
if (-not $tarball) {
throw "npm pack did not produce a tarball filename."
}
"tarball=$tarball" >> $env:GITHUB_OUTPUT
- name: Smoke test installed CLI
shell: pwsh
run: |
$prefix = Join-Path $PWD ".tmp-smoke"
$tarballPath = Join-Path $PWD "${{ steps.pack.outputs.tarball }}"
$expectedVersion = (node -p "require('./package.json').version").Trim()
npm install --prefix $prefix $tarballPath
$binName = if ($IsWindows) { "skvlt.cmd" } else { "skvlt" }
$binPath = Join-Path $prefix "node_modules/.bin/$binName"
& $binPath --help
$actualVersion = (& $binPath --version | Out-String).Trim()
if ($actualVersion -ne $expectedVersion) {
throw "Installed CLI version '$actualVersion' did not match package version '$expectedVersion'."
}