-
Notifications
You must be signed in to change notification settings - Fork 0
109 lines (109 loc) · 3.5 KB
/
pull-request-react.yml
File metadata and controls
109 lines (109 loc) · 3.5 KB
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
name: Build and test (React/TypeScript)
on:
workflow_call:
inputs:
runner-size:
required: false
type: string
description: "Runner to use for the job (normal, or large)"
default: "normal"
architecture:
required: false
type: string
description: "Runner architecture (x64 or arm64)"
default: "x64"
node-version:
required: false
type: string
default: 'lts/jod'
description: "Node.js version to use"
pnpm-version:
required: false
type: string
default: ''
description: "pnpm version to use (leave empty to use packageManager from package.json)"
working-directory:
required: false
type: string
default: '.'
description: "Working directory for frontend code"
build-timeout-minutes:
required: false
type: number
description: "Timeout for the build job in minutes"
default: 15
lint-command:
required: false
type: string
default: 'pnpm run lint'
description: "Command to run for linting"
build-command:
required: false
type: string
default: 'pnpm run build'
description: "Command to run for building"
test-command:
required: false
type: string
default: 'pnpm run test'
description: "Command to run for testing (optional)"
format-command:
required: false
type: string
default: 'pnpm run format:check'
description: "Command to run for format checking (optional)"
jobs:
setup:
name: Setup
runs-on: linux-arm64
timeout-minutes: 5
outputs:
runner-name: ${{ steps.runner.outputs.runner-name }}
steps:
- name: Check PR title
uses: monta-app/github-workflows/.github/actions/pr-title-check@main
- name: Get runner name
id: runner
uses: monta-app/github-workflows/.github/actions/runner-size-converter@main
with:
runner-size: ${{ inputs.runner-size }}
architecture: ${{ inputs.architecture }}
lint-build-test:
name: Lint & Build & Test
needs: setup
runs-on: ${{ needs.setup.outputs.runner-name }}
timeout-minutes: ${{ inputs.build-timeout-minutes }}
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: ${{ inputs.pnpm-version || null }}
run_install: false
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
cache: pnpm
cache-dependency-path: ${{ inputs.working-directory }}
- name: Install dependencies
working-directory: ${{ inputs.working-directory }}
run: pnpm install
- name: Lint check
working-directory: ${{ inputs.working-directory }}
run: ${{ inputs.lint-command }}
- name: Format check
if: ${{ inputs.format-command != '' }}
working-directory: ${{ inputs.working-directory }}
run: ${{ inputs.format-command }}
- name: Run tests
if: ${{ inputs.test-command != '' }}
working-directory: ${{ inputs.working-directory }}
run: ${{ inputs.test-command }}
- name: Build check
working-directory: ${{ inputs.working-directory }}
run: ${{ inputs.build-command }}