Reusable Gitea Actions workflows for lint, test, build, and deploy: - lint-python, lint-node, lint-rust - test-python, test-node, test-rust - build-push (Docker build + push to Gitea registry) - deploy-k8s (GitOps image tag update in cluster repo) Plus example caller workflows for python-fullstack, rust-service, and node-frontend stacks. Branch refs aligned to staging per CON-570 standards.
46 lines
1.3 KiB
YAML
46 lines
1.3 KiB
YAML
# Reusable workflow: Node.js testing
|
|
# Usage: uses: wectrl-net/ci-templates/.gitea/workflows/test-node.yaml@main
|
|
name: Test Node
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
node-version:
|
|
description: "Node.js version to use"
|
|
required: false
|
|
type: string
|
|
default: "22"
|
|
working-directory:
|
|
description: "Directory containing the Node.js project"
|
|
required: false
|
|
type: string
|
|
default: "."
|
|
test-script:
|
|
description: "npm script name for testing"
|
|
required: false
|
|
type: string
|
|
default: "test"
|
|
test-args:
|
|
description: "Additional args appended after -- (e.g. --passWithNoTests)"
|
|
required: false
|
|
type: string
|
|
default: "--passWithNoTests"
|
|
|
|
jobs:
|
|
test:
|
|
name: Tests
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: ${{ inputs.node-version }}
|
|
cache: npm
|
|
cache-dependency-path: ${{ inputs.working-directory }}/package-lock.json
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
working-directory: ${{ inputs.working-directory }}
|
|
- name: Run tests
|
|
run: npm run ${{ inputs.test-script }} -- ${{ inputs.test-args }}
|
|
working-directory: ${{ inputs.working-directory }}
|