-
Notifications
You must be signed in to change notification settings - Fork 0
110 lines (92 loc) · 3.19 KB
/
nodejs-multi-ci.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
name: Node CI
on:
push:
branches:
- main
- master
pull_request:
branches:
- main
- master
jobs:
node-ci:
runs-on: ubuntu-latest
strategy:
matrix:
directory: [./.github/scripts/fetch-tomachi-emojis, ./.github/scripts/generate-readme]
fail-fast: false
steps:
- name: 🛎 Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: 🏗 Setup node
uses: actions/setup-node@v4
with:
node-version-file: ${{ matrix.directory }}/.node-version
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
run_install: false
package_json_file: ${{ matrix.directory }}/package.json
- name: 📃 Check package.json definition
id: package-json
working-directory: ${{ matrix.directory }}
run: |
compile=$(jq '.scripts | has("compile")' package.json)
build=$(jq '.scripts | has("build")' package.json)
generate=$(jq '.scripts | has("generate")' package.json)
package=$(jq '.scripts | has("package")' package.json)
lint=$(jq '.scripts | has("lint")' package.json)
test=$(jq '.scripts | has("test")' package.json)
echo "compile: $compile"
echo "build: $build"
echo "generate: $generate"
echo "package: $package"
echo "lint: $lint"
echo "test: $test"
echo "compile=$compile" >> $GITHUB_OUTPUT
echo "build=$build" >> $GITHUB_OUTPUT
echo "generate=$generate" >> $GITHUB_OUTPUT
echo "package=$package" >> $GITHUB_OUTPUT
echo "lint=$lint" >> $GITHUB_OUTPUT
echo "test=$test" >> $GITHUB_OUTPUT
- name: 📂 Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: 📂 Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: 👨🏻💻 Install dependencies
working-directory: ${{ matrix.directory }}
run: |
pnpm install --frozen-lockfile --prefer-frozen-lockfile
- name: 👀 Run linter
if: steps.package-json.outputs.lint == 'true'
working-directory: ${{ matrix.directory }}
run: pnpm run lint
- name: 🎁 Run package
if: steps.package-json.outputs.package == 'true'
working-directory: ${{ matrix.directory }}
run: pnpm run package
- name: 🧪 Run tests
if: steps.package-json.outputs.test == 'true'
working-directory: ${{ matrix.directory }}
run: pnpm run test
- name: ☑️ Check Dependencies
working-directory: ${{ matrix.directory }}
run: npx depcheck
finished-node-ci:
name: Check finished Node CI
runs-on: ubuntu-latest
needs:
- node-ci
steps:
- name: Check finished Node CI
run: echo ok