### Package Manager Compatibility CI Source: https://context7.com/fastify/workflows/llms.txt Verifies plugin installation and tests pass with both pnpm and Yarn. This ensures compatibility regardless of the consumer's package manager. ```yaml # .github/workflows/ci-package-managers.yml name: Package Manager CI on: push: branches: [main] pull_request: permissions: contents: read jobs: package-manager-test: uses: fastify/workflows/.github/workflows/plugins-ci-package-manager.yml@v5 with: node-versions: '["20", "22", "24"]' # Runs: # pnpm v10 × [Node 20, 22, 24] → pnpm install --ignore-scripts && pnpm run test # Yarn latest × [Node 20, 22, 24] → yarn install --ignore-scripts && yarn run test ``` -------------------------------- ### Plugin CI with MongoDB Service (`plugins-ci-mongo.yml`) Source: https://context7.com/fastify/workflows/llms.txt Includes a MongoDB 8 service container for CI, accessible on port 27017. This setup does not require authentication, aligning with common local development configurations. ```yaml # .github/workflows/ci.yml (in a plugin that requires MongoDB) name: CI on: push: branches: [main] pull_request: permissions: contents: read jobs: test: permissions: contents: write pull-requests: write uses: fastify/workflows/.github/workflows/plugins-ci-mongo.yml@v5 with: lint: true license-check: true node-versions: '["20", "22", "24"]' auto-merge-exclude: 'fastify' # MongoDB is exposed on port 27017 ``` -------------------------------- ### Basic Plugin CI Workflow (`plugins-ci.yml`) Source: https://context7.com/fastify/workflows/llms.txt Use this workflow for the majority of Fastify plugins. It includes quality checks, a cross-platform test matrix, and auto-merging for Dependabot PRs. Configure options like linting, license checking, Node.js versions, and dependency integration. ```yaml # .github/workflows/ci.yml (in a consumer plugin repository) name: CI on: push: branches: - main - next - 'v*' paths-ignore: - 'docs/**' - '*.md' pull_request: paths-ignore: - 'docs/**' - '*.md' permissions: contents: read jobs: test: permissions: contents: write pull-requests: write uses: fastify/workflows/.github/workflows/plugins-ci.yml@v5 with: # Run the repository's `npm run lint` script before tests lint: true # Verify all production dependencies use permissive licenses license-check: true # Allow an additional license on top of the defaults license-check-allowed-additional: 'CC-BY-4.0' # Test on Node.js 20, 22, and 24 (default) node-versions: '["20", "22", "24"]' # Do not auto-merge Dependabot bumps of these packages auto-merge-exclude: 'fastify;@fastify/error' # Also run fastify's own test suite with the proposed plugin changes fastify-dependency-integration: true ``` -------------------------------- ### Plugin CI with PostgreSQL Service (`plugins-ci-postgres.yml`) Source: https://context7.com/fastify/workflows/llms.txt Extends the basic CI workflow with a PostgreSQL service container. Tests run against `postgres:18-alpine` and can access the database using provided environment variables. Configure Node.js versions and auto-merge exclusions. ```yaml # .github/workflows/ci.yml (in a plugin that requires PostgreSQL) name: CI on: push: branches: [main] pull_request: permissions: contents: read jobs: test: permissions: contents: write pull-requests: write uses: fastify/workflows/.github/workflows/plugins-ci-postgres.yml@v5 with: lint: true license-check: true node-versions: '["20", "22", "24"]' auto-merge-exclude: 'fastify' # PostgreSQL is exposed on port 5432; access it in tests via: # PGHOST=localhost PGPORT=5432 PGUSER=postgres PGPASSWORD=postgres PGDATABASE=postgres ``` -------------------------------- ### Plugin CI with MySQL Service (`plugins-ci-mysql.yml`) Source: https://context7.com/fastify/workflows/llms.txt Integrates a MySQL 8.0 service container for CI. Tests run on Ubuntu across specified Node.js versions. The MySQL instance is pre-configured with a root user, an empty password, and a 'mysql' database. ```yaml # .github/workflows/ci.yml (in a plugin that requires MySQL) name: CI on: push: branches: [main] pull_request: permissions: contents: read jobs: test: permissions: contents: write pull-requests: write uses: fastify/workflows/.github/workflows/plugins-ci-mysql.yml@v5 with: lint: false license-check: false node-versions: '["20", "22", "24"]' auto-merge-exclude: 'fastify' # MySQL is exposed on port 3306; no password required (MYSQL_ALLOW_EMPTY_PASSWORD=yes) # Database name: mysql ``` -------------------------------- ### Basic CI Workflow Usage Source: https://github.com/fastify/workflows/blob/main/README.md Use this basic CI workflow for most plugins. It triggers on push to main, next, or version branches, and on pull requests, ignoring documentation changes. ```yaml name: CI on: push: branches: - main - next - 'v*' paths-ignore: - 'docs/**' - '*.md' pull_request: paths-ignore: - 'docs/**' - '*.md' permissions: contents: read jobs: test: permissions: contents: write pull-requests: write uses: fastify/workflows/.github/workflows/plugins-ci.yml@v5 ``` -------------------------------- ### CI with MongoDB Service Source: https://context7.com/fastify/workflows/llms.txt Use this workflow for plugins that depend on MongoDB. It spins up a MongoDB instance for testing. ```yaml # .github/workflows/ci.yml (in a plugin that requires MongoDB) name: CI on: push: branches: [main] pull_request: permissions: contents: read jobs: test: permissions: contents: write pull-requests: write uses: fastify/workflows/.github/workflows/plugins-ci-mongo.yml@v5 with: lint: true node-versions: '["20", "22", "24"]' auto-merge-exclude: 'fastify' # MongoDB is available at mongodb://localhost:27017 ``` -------------------------------- ### CI Workflow with Linter Enabled Source: https://github.com/fastify/workflows/blob/main/README.md Enable the linter job first by setting the `lint` option to `true` when using the basic CI workflow. This is useful for ensuring code quality before other tests run. ```yaml name: CI on: push: branches: - main - next - 'v*' paths-ignore: - 'docs/**' - '*.md' pull_request: paths-ignore: - 'docs/**' - '*.md' permissions: contents: read jobs: test: permissions: contents: write pull-requests: write uses: fastify/workflows/.github/workflows/plugins-ci.yml@v5 with: lint: true ``` -------------------------------- ### CI with Kafka Service Source: https://context7.com/fastify/workflows/llms.txt Provisions a Zookeeper and Kafka pair for integration testing message-queue plugins. Kafka is advertised on 'localhost:9092'. ```yaml # .github/workflows/ci.yml (in a plugin that requires Kafka) name: CI on: push: branches: [main] pull_request: permissions: contents: read jobs: test: permissions: contents: write pull-requests: write uses: fastify/workflows/.github/workflows/plugins-ci-kafka.yml@v5 with: lint: false license-check: false node-versions: '["20", "22", "24"]' auto-merge-exclude: 'fastify' # Zookeeper: localhost:2181 # Kafka bootstrap: localhost:9092 ``` -------------------------------- ### CI with Redis Service Source: https://context7.com/fastify/workflows/llms.txt This workflow tests plugins against multiple Redis versions (5, 6, 7) alongside Node.js versions. Redis is exposed on port 6379. ```yaml # .github/workflows/ci.yml (in a plugin that requires Redis) name: CI on: push: branches: [main] pull_request: permissions: contents: read jobs: test: permissions: contents: write pull-requests: write uses: fastify/workflows/.github/workflows/plugins-ci-redis.yml@v5 with: lint: false license-check: false node-versions: '["20", "22", "24"]' auto-merge-exclude: 'fastify' # Redis matrix: versions 5, 6, 7 × Node.js versions # Connection: redis://localhost:6379 ``` -------------------------------- ### Shared Quality-Gate Workflow Source: https://context7.com/fastify/workflows/llms.txt An internal composite workflow for dependency review, license checking, and linting. It's not meant for direct consumer use but is called by other CI variants. ```yaml # Called internally — example of what the quality-check job does: # # dependency-review (pull_request events only) # uses: actions/dependency-review-action # # license-check (when license-check: true) # npx license-checker --production --onlyAllow= # "0BSD;Apache-2.0;BlueOak-1.0.0;BSD-2-Clause;BSD-3-Clause;ISC;MIT;" # # linter (when lint: true) # npm run lint # To trigger all three gates from the basic workflow: jobs: test: permissions: contents: write pull-requests: write uses: fastify/workflows/.github/workflows/plugins-ci.yml@v5 with: lint: true license-check: true license-check-allowed-additional: 'BlueOak-1.0.0' ``` -------------------------------- ### Automated Semantic Release Workflow Source: https://context7.com/fastify/workflows/llms.txt This YAML workflow automates semantic releases, including version bumping, changelog generation, and tag rebasing. It is triggered manually via `workflow_dispatch` with a `semver` input. ```yaml # Triggered manually from the GitHub Actions UI: # Actions → release → Run workflow → semver: patch | minor | major # # What it does: # 1. Creates a release branch and PR bumping package.json version # 2. On PR merge: publishes GitHub Release + git tag (e.g., v6.0.1) # 3. Rebases floating tags: v6 and v6.0 → new commit # # Consumer repos pinned to @v5 automatically get fixes within the v5.x line. # To adopt a new major, update the uses reference: # uses: fastify/workflows/.github/workflows/plugins-ci.yml@v6 ``` -------------------------------- ### CI with Elasticsearch Service Source: https://context7.com/fastify/workflows/llms.txt Runs Elasticsearch with security disabled and discovery set to single-node. The Elasticsearch version is configurable, defaulting to '9.3.0'. Ports 9200 and 9300 are exposed. ```yaml # .github/workflows/ci.yml (in a plugin that requires Elasticsearch) name: CI on: push: branches: [main] pull_request: permissions: contents: read jobs: test: permissions: contents: write pull-requests: write uses: fastify/workflows/.github/workflows/plugins-ci-elasticsearch.yml@v5 with: elasticsearch-version: '9.3.0' # required; change to pin a different version lint: true license-check: false node-versions: '["20", "22", "24"]' auto-merge-exclude: 'fastify' # Elasticsearch REST API: http://localhost:9200 # Transport port: 9300 ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.