Skip to content

test: Add property-based tests for Agones resources #97

test: Add property-based tests for Agones resources

test: Add property-based tests for Agones resources #97

Workflow file for this run

# Copyright Contributors to Agones a Series of LF Projects, LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Based on https://github.com/headlamp-k8s/plugins/blob/main/.github/workflows/headlamp-plugin-github-workflow.yaml
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
# SECURITY: Fork PRs are untrusted. The entire workflow (checkout, build,
# tests, artifact upload) must be approved by a maintainer before it runs.
# Configure this under:
# Settings → Actions → General → "Fork pull request workflows from outside
# collaborators" → "Require approval for all outside collaborators"
# See: https://docs.github.com/en/actions/how-tos/manage-workflow-runs/approve-runs-from-forks
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build, Lint & Test
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [22.x]
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v4
with:
node-version: ${{ matrix.node-version }}
cache: npm
cache-dependency-path: package-lock.json
- name: Install dependencies
run: npm ci
- name: Build
run: |
if ! npm run build; then
echo ""
echo "::error::Build failed. Run 'npm run build' locally to reproduce the error."
exit 1
fi
- name: Type check
run: |
if ! npm run tsc; then
echo ""
echo "::error::Type check failed. Run 'npm run tsc' locally to see the TypeScript errors."
exit 1
fi
- name: Lint
run: |
if ! npm run lint; then
echo ""
echo "::error::Lint failed. Run 'npm run lint' locally to see the issues, or 'npm run lint-fix' to auto-fix import ordering."
exit 1
fi
- name: Check formatting
run: |
if ! npm run format -- --check; then
echo ""
echo "::error::Formatting check failed. Run 'npm run format' locally to auto-fix all files, then commit and push."
exit 1
fi
- name: Test
run: |
if find src -type f \( -name '*.test.*' -o -name '*.spec.*' \) | grep -q .; then
if ! npm run test; then
echo ""
echo "::error::Tests failed. Run 'npm run test' locally to see the failing tests."
exit 1
fi
else
echo "No test files found – skipping tests"
fi
- name: Upload build artifact
if: success()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: agones-plugin-dist
path: dist/
retention-days: 14