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
128 lines (114 loc) · 3.96 KB
/
Copy pathaction.yml
File metadata and controls
128 lines (114 loc) · 3.96 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
name: Setup Action
description: Checkout, setup node and dependencies
inputs:
node-version:
description: 'The node version to use'
required: false
default: '18'
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: ''
runs:
using: "composite"
steps:
- name: Configure Turborepo
id: turbo
uses: actions/github-script@v6
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 }}
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 } = process.env
core.exportVariable('TURBO_ARGS',
[
'--output-logs=new-only',
`--cache-dir=${CACHE_DIR}`,
`--concurrency=${cpus}`,
`--summarize=${SUMMARIZE}`,
].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: Setup NodeJS ${{ inputs.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
registry-url: ${{ inputs.registry-url }}
- name: Cache node_modules
uses: actions/cache@v3
id: npm-cache
with:
path: ./node_modules
key: ${{ runner.os }}-node-${{ inputs.node-version }}-node-modules-${{ hashFiles('package-lock.json') }}
- name: Install NPM Dependencies
if: steps.npm-cache.outputs.cache-hit != 'true'
run: npm ci --audit=false --fund=false
shell: bash
- name: Get Playwright Version
if: inputs.playwright-enabled == 'true'
shell: bash
id: playwright-version
run: echo "VERSION=$(node -e "console.log($(npm ls @playwright/test --json).dependencies['@playwright/test'].version)")" >> "$GITHUB_OUTPUT"
- name: Cache Playwright Binaries
if: inputs.playwright-enabled == 'true'
uses: actions/cache@v3
id: playwright-cache
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-playwright-${{ steps.playwright-version.outputs.VERSION }}
- name: Install Playwright Browsers
if: inputs.playwright-enabled == 'true' && steps.playwright-cache.outputs.cache-hit != 'true'
shell: bash
run: npx playwright install chromium