Skip to content

Commit 20919fc

Browse files
authored
ci: configure main workflow (#3)
1 parent f3c43d7 commit 20919fc

File tree

7 files changed

+110
-92
lines changed

7 files changed

+110
-92
lines changed

.github/actions/setup/action.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Setup node and pnpm
2+
description: |
3+
Configures Node, pnpm, cache, performs pnpm install
4+
5+
inputs:
6+
node-version:
7+
description: Node.js version
8+
required: true
9+
default: 22.6.0
10+
pnpm-version:
11+
description: Pnpm version
12+
required: true
13+
default: 9.7.1
14+
pnpm-run-install:
15+
description: Whether to run pnpm install
16+
required: false
17+
default: true
18+
pnpm-restore-cache:
19+
description: Whether to restore cache
20+
required: false
21+
default: true
22+
pnpm-install-cache-key:
23+
description: The cache key for the pnpm install cache
24+
default: pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
25+
26+
outputs:
27+
pnpm-store-path:
28+
description: The resolved pnpm store path
29+
pnpm-install-cache-key:
30+
description: The cache key used for pnpm install cache
31+
32+
runs:
33+
using: composite
34+
steps:
35+
# https://github.com/actions/virtual-environments/issues/1187
36+
- name: tune linux network
37+
shell: bash
38+
run: sudo ethtool -K eth0 tx off rx off
39+
40+
- name: Setup Node@${{ inputs.node-version }}
41+
uses: actions/setup-node@v4
42+
with:
43+
node-version: ${{ inputs.node-version }}
44+
45+
- name: Install pnpm
46+
uses: pnpm/action-setup@v4
47+
with:
48+
version: ${{ inputs.pnpm-version }}
49+
run_install: false
50+
51+
- name: Get pnpm store path
52+
shell: bash
53+
run: |
54+
STORE_PATH=$(pnpm store path --silent)
55+
echo "STORE_PATH=$STORE_PATH" >> $GITHUB_ENV
56+
echo "Pnpm store path resolved to: $STORE_PATH"
57+
58+
- name: Restore pnpm install cache
59+
if: ${{ inputs.pnpm-restore-cache == 'true' }}
60+
uses: actions/cache@v4
61+
with:
62+
path: ${{ env.STORE_PATH }}
63+
key: ${{ inputs.pnpm-install-cache-key }}
64+
restore-keys: |
65+
pnpm-store-${{ inputs.pnpm-version }}-
66+
pnpm-store-
67+
68+
- name: Run pnpm install
69+
if: ${{ inputs.pnpm-run-install == 'true' }}
70+
shell: bash
71+
run: pnpm install
72+
73+
# Set the cache key output
74+
- run: |
75+
echo "pnpm-install-cache-key=${{ inputs.pnpm-install-cache-key }}" >> $GITHUB_ENV
76+
shell: bash

.github/workflows/main.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: test
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- reopened
8+
- synchronize
9+
push:
10+
branches:
11+
- main
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: true
16+
17+
env:
18+
NODE_VERSION: 22.6.0
19+
PNPM_VERSION: 9.7.1
20+
21+
jobs:
22+
test:
23+
runs-on: ubuntu-24.04
24+
25+
steps:
26+
- uses: actions/checkout@v4
27+
28+
- name: Node setup
29+
uses: ./.github/actions/setup
30+
with:
31+
node-version: ${{ env.NODE_VERSION }}
32+
pnpm-version: ${{ env.PNPM_VERSION }}
33+
34+
- run: pnpm test

.github/workflows/node-aught.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.

.github/workflows/node-pretest.yml

Lines changed: 0 additions & 10 deletions
This file was deleted.

.github/workflows/node-tens.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.

.github/workflows/rebase.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

.github/workflows/require-allow-edits.yml

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)