Skip to content

vers. 3.2 / performance enhancement #319

vers. 3.2 / performance enhancement

vers. 3.2 / performance enhancement #319

Workflow file for this run

# --------------------------------------------------------------------------------
#
# Workflow: Lint, Build & Pack
#
# This GitHub Actions workflow performs automated type-checking, linting, and
# building for the CmpStr project. It is triggered on every push and pull request
# targeting the master branch.
#
# The workflow consists of two jobs:
#
# 1. Lint (TypeScript Linting):
# - Installs dependencies
# - Runs TypeScript-based linting and type-checking via `npm run lint`
#
# 2. Test (Run Tests):
# - Runs after the Lint job completes successfully
# - Installs dependencies
# - Executes tests using `npm test`
#
# 3. Build (Build & Package):
# - Runs after the Lint job completes successfully
# - Installs dependencies
# - Builds the project using `npm run build`
# - Uploads the resulting `dist/` directory as an artifact
#
# 4. Check (Ready for Release):
# - Runs after the Build job completes successfully
# - Downloads the `dist/` artifact
# - Packs the project into an npm tarball using `npm pack`
# - Unpacks the tarball to validate the presence of expected files
# - Using `package-verify` with `verify.manifest.json` for validating files
# - Uploads the tarball as an artifact for further use
#
# --------------------------------------------------------------------------------
name: Build
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
lint:
name: TypeScript Linting
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v6
- name: Use Node.js 24.x
uses: actions/setup-node@v6
with:
node-version: 24
cache: npm
- name: Install Dependencies
run: npm ci
- name: Type Checking with `tsc`
run: npm run lint
test:
name: Run Tests
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v6
- name: Use Node.js 24.x
uses: actions/setup-node@v6
with:
node-version: 24
cache: npm
- name: Install Dependencies
run: npm ci
- name: Run Tests
run: npm test
build:
name: Build Project
runs-on: ubuntu-latest
needs: [ lint, test ]
steps:
- name: Checkout Repository
uses: actions/checkout@v6
- name: Use Node.js 24.x
uses: actions/setup-node@v6
with:
node-version: 24
cache: npm
- name: Install Dependencies
run: npm ci
- name: Build Project
run: npm run build
- name: Upload dist as Artifact
uses: actions/upload-artifact@v6
with:
name: cmpstr-dist
path: dist/
if-no-files-found: error
compression-level: 9
check:
name: Ready for Release?
runs-on: ubuntu-latest
needs: [ build ]
steps:
- name: Checkout Repository
uses: actions/checkout@v6
- name: Use Node.js 24.x
uses: actions/setup-node@v6
with:
node-version: 24
cache: npm
- name: Download dist Artifact
uses: actions/download-artifact@v6
with:
name: cmpstr-dist
path: dist/
- name: Pack npm Tarball
run: npm pack
- name: Unpack Tarball for Validation
run: |
mkdir extracted
tar -xzf cmpstr-*.tgz -C extracted
- name: Install package-verify
run: npm install --save-dev package-verify
- name: Validate Dist Files
run: npx verify-pkg --fail-on-warn --verbose
- name: Upload Tarball as Artifact
uses: actions/upload-artifact@v6
with:
name: cmpstr-tgz
path: cmpstr-*.tgz
if-no-files-found: error
compression-level: 0