forked from fastify/fastify
-
Notifications
You must be signed in to change notification settings - Fork 0
93 lines (90 loc) · 2.61 KB
/
citgm-package.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
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