Skip to content

Commit

Permalink
ci: CITGM github workflow (#5233)
Browse files Browse the repository at this point in the history
  • Loading branch information
Uzlopak committed Dec 26, 2023
1 parent 9e0faf7 commit a2088ad
Show file tree
Hide file tree
Showing 2 changed files with 199 additions and 0 deletions.
93 changes: 93 additions & 0 deletions .github/workflows/citgm-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: CITGM Package

on:
workflow_dispatch:
inputs:
package:
description: 'Package to test'
required: true
type: string
node-version:
description: 'Node version to test'
required: true
type: string
default: '20'
os:
description: 'Operating System'
required: false
type: choice
default: 'ubuntu-latest'
options:
- 'ubuntu-latest'
- 'windows-latest'
- 'macos-latest'
workflow_call:
inputs:
package:
description: 'Package to test'
required: true
type: string
node-version:
description: 'Node version to test'
required: true
type: string
default: '20'
os:
description: 'Operating System'
required: false
type: string
default: 'ubuntu-latest'
jobs:
core-plugins:
name: CITGM
runs-on: ${{inputs.os}}
permissions:
contents: read
steps:
- name: Check out Fastify
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
cache: 'npm'
cache-dependency-path: package.json

- name: Install Dependencies for Fastify
run: |
npm install --ignore-scripts
- name: Npm Link Fastify
run: |
npm link
- name: Determine repository URL of ${{inputs.package}}
uses: actions/github-script@v7
id: repository-url
with:
result-encoding: string
script: |
const response = await fetch('https://registry.npmjs.org/${{inputs.package}}')
const data = await response.json()
const repositoryUrl = data.repository.url
const result = repositoryUrl.match( /.*\/([a-zA-Z0-9-_]+\/[a-zA-Z0-9-_]+)\.git/)[1]
return result
- name: Check out ${{inputs.package}}
uses: actions/checkout@v4
with:
repository: ${{ steps.repository-url.outputs.result }}
path: package
persist-credentials: false
- name: Install Dependencies for ${{inputs.package}}
working-directory: package
run: |
npm install
- name: Sym Link Fastify
working-directory: package
run: |
npm link fastify
- name: Run Tests of ${{inputs.package}}
working-directory: package
run: |
npm test
106 changes: 106 additions & 0 deletions .github/workflows/citgm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: CITGM

on:
pull_request:
types: [labeled]

jobs:
core-plugins:
name: CITGM
if: ${{ github.event.label.name == 'citgm-core-plugins' }}
permissions:
contents: read
strategy:
fail-fast: false
matrix:
package:
- '@fastify/accepts'
- '@fastify/accepts-serializer'
- '@fastify/any-schema'
- '@fastify/auth'
- '@fastify/autoload'
- '@fastify/awilix'
- '@fastify/aws-lambda'
- '@fastify/basic-auth'
- '@fastify/bearer-auth'
- '@fastify/caching'
- '@fastify/circuit-breaker'
- '@fastify/compress'
- '@fastify/cookie'
- '@fastify/cors'
- '@fastify/csrf-protection'
- '@fastify/diagnostics-channel'
- '@fastify/early-hints'
# - '@fastify/elasticsearch'
- '@fastify/env'
- '@fastify/etag'
- '@fastify/express'
- '@fastify/flash'
- '@fastify/formbody'
- '@fastify/funky'
- '@fastify/helmet'
- '@fastify/hotwire'
- '@fastify/http-proxy'
- '@fastify/jwt'
# - '@fastify/kafka'
- '@fastify/leveldb'
- '@fastify/middie'
# - '@fastify/mongodb'
- '@fastify/multipart'
# - '@fastify/mysql'
- '@fastify/nextjs'
- '@fastify/oauth2'
- '@fastify/one-line-logger'
- '@fastify/passport'
# - '@fastify/postgres'
# - '@fastify/rate-limit'
# - '@fastify/redis'
- '@fastify/reply-from'
- '@fastify/request-context'
- '@fastify/response-validation'
- '@fastify/routes'
- '@fastify/schedule'
- '@fastify/secure-session'
- '@fastify/sensible'
- '@fastify/session'
- '@fastify/soap-client'
- '@fastify/static'
- '@fastify/swagger'
- '@fastify/swagger-ui'
- '@fastify/throttle'
- '@fastify/type-provider-json-schema-to-ts'
- '@fastify/type-provider-typebox'
- '@fastify/under-pressure'
- '@fastify/url-data'
- '@fastify/view'
# - '@fastify/vite'
- '@fastify/websocket'
- '@fastify/zipkin'
node-version: ['20']
os: [ubuntu-latest]
uses: './.github/workflows/citgm-package.yml'
with:
os: ${{ matrix.os }}
package: ${{ matrix.package }}
node-version: ${{ matrix.node-version }}

remove-label:
if: always()
needs:
- core-plugins
continue-on-error: true
runs-on: ubuntu-latest
steps:
- name: Remove citgm-core-plugins label
uses: octokit/request-action@v2.x
id: remove-label
with:
route: DELETE /repos/{repo}/issues/{issue_number}/labels/{name}
repo: ${{ github.event.pull_request.head.repo.full_name }}
issue_number: ${{ github.event.pull_request.number }}
name: citgm-core-plugins
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: "echo Successfully removed label"
- run: "echo Could not remove label"
if: ${{ failure() }}

0 comments on commit a2088ad

Please sign in to comment.