forked from clerk/javascript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
142 lines (127 loc) · 4.19 KB
/
Copy pathaction.yml
File metadata and controls
142 lines (127 loc) · 4.19 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
name: Setup Action (Blacksmith)
description: Checkout, setup node and dependencies for Blacksmith
inputs:
node-version:
description: 'The node version to use'
required: false
default: '22'
playwright-enabled:
description: 'Enable Playwright?'
required: false
default: 'false'
turbo-summarize:
description: 'The token to use for Turbo task summaries'
required: false
default: 'false'
turbo-enabled:
description: 'Enable Turbo?'
required: false
default: 'true'
turbo-cache-dir:
description: 'The cache dir to use for Turbo'
required: false
default: './.turbo-cache'
turbo-signature:
description: 'The signature to use for Turbo'
required: false
turbo-remote-only:
description: 'Only use remote cache?'
required: false
default: 'true'
turbo-team:
description: 'The team to use for Turbo remote auth'
required: true
turbo-token:
description: 'The token to use for Turbo remote auth'
required: true
registry-url:
description: 'The registry the packages will be published to'
required: false
default: ''
verbose:
description: 'Enable verbose output'
required: false
default: 'false'
runs:
using: 'composite'
steps:
- name: Configure Turborepo
id: turbo
uses: actions/github-script@v7
env:
# envs are required to pass inputs to the script
ENABLED: ${{ inputs.turbo-enabled }}
CACHE_DIR: ${{ inputs.turbo-cache-dir }}
REMOTE_ONLY: ${{ inputs.turbo-remote-only }}
SIGNATURE: ${{ inputs.turbo-signature }}
SUMMARIZE: ${{ inputs.turbo-summarize }}
TEAM: ${{ inputs.turbo-team }}
TOKEN: ${{ inputs.turbo-token }}
VERBOSE: ${{ inputs.verbose }}
with:
script: |
const os = require('os')
const cpus =
typeof os.availableParallelism === "function"
? os.availableParallelism()
: os.cpus().length;
const { ENABLED, CACHE_DIR, SIGNATURE, REMOTE_ONLY, SUMMARIZE, TEAM, TOKEN, VERBOSE } = process.env
const ARGS = [
`--cache-dir=${CACHE_DIR}`,
`--concurrency=${cpus}`,
`--summarize=${SUMMARIZE}`,
]
if (VERBOSE === 'true') {
ARGS.push('--verbosity=2')
ARGS.push('--log-order=stream')
ARGS.push('--output-logs=full')
} else {
ARGS.push('--output-logs=new-only')
}
core.exportVariable('TURBO_ARGS',
ARGS.join(' ')
)
if (ENABLED === 'true') {
core.exportVariable('TURBO_TEAM', TEAM)
core.exportVariable('TURBO_TOKEN', TOKEN)
core.exportVariable('TURBO_REMOTE_ONLY', REMOTE_ONLY)
}
if (SIGNATURE && SIGNATURE !== '') {
core.exportVariable('TURBO_REMOTE_CACHE_SIGNATURE_KEY', SIGNATURE)
}
core.exportVariable('FORCE_COLOR', '1')
- name: Turborepo CLI Args
shell: bash
run: echo $TURBO_ARGS
- name: Install PNPM
uses: pnpm/action-setup@v4
- name: Setup NodeJS ${{ inputs.node-version }}
uses: useblacksmith/setup-node@v5
with:
cache: pnpm
node-version: ${{ inputs.node-version }}
registry-url: ${{ inputs.registry-url }}
- name: Install PNPM Dependencies
env:
CYPRESS_INSTALL_BINARY: 0
run: pnpm install
shell: bash
- name: Get Playwright Version
if: inputs.playwright-enabled == 'true'
shell: bash
id: playwright-version
run: |
VERSION=$(node -p "require('@playwright/test/package.json').version")
echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT"
- name: Cache Playwright Binaries
if: inputs.playwright-enabled == 'true'
uses: useblacksmith/cache@v5
id: playwright-cache
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-playwright-${{ steps.playwright-version.outputs.VERSION }}-v2
- name: Install Playwright Browsers
if: inputs.playwright-enabled == 'true' && steps.playwright-cache.outputs.cache-hit != 'true'
shell: bash
run: |
pnpm playwright install chromium