Skip to content

Commit 9c0592f

Browse files
committed
ci: add build, test, lint, format and example builds with pnpm caching
1 parent 7e4a069 commit 9c0592f

1 file changed

Lines changed: 106 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: ["*"]
8+
9+
concurrency:
10+
group: ci-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
permissions:
14+
contents: read
15+
16+
env:
17+
CI: true
18+
19+
jobs:
20+
build-and-test:
21+
name: Build and Test (Node ${{ matrix.node-version }})
22+
runs-on: ubuntu-latest
23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
node-version: ["18.x", "20.x", "lts/*"]
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v4
30+
31+
- name: Setup Node.js ${{ matrix.node-version }}
32+
uses: actions/setup-node@v4
33+
with:
34+
node-version: ${{ matrix.node-version }}
35+
36+
- name: Setup pnpm 10.11.0
37+
uses: pnpm/action-setup@v4
38+
with:
39+
version: 10.11.0
40+
run_install: false
41+
42+
- name: Install dependencies
43+
run: pnpm install --frozen-lockfile
44+
45+
- name: Build all packages
46+
run: pnpm build
47+
48+
- name: Run all tests
49+
run: pnpm test
50+
51+
lint-and-format:
52+
name: Lint and Format (SDK)
53+
runs-on: ubuntu-latest
54+
steps:
55+
- name: Checkout
56+
uses: actions/checkout@v4
57+
58+
- name: Setup Node.js (LTS)
59+
uses: actions/setup-node@v4
60+
with:
61+
node-version: lts/*
62+
cache: pnpm
63+
cache-dependency-path: pnpm-lock.yaml
64+
65+
- name: Setup pnpm 10.11.0
66+
uses: pnpm/action-setup@v4
67+
with:
68+
version: 10.11.0
69+
run_install: false
70+
71+
- name: Install dependencies
72+
run: pnpm install --frozen-lockfile
73+
74+
- name: Lint SDK package
75+
run: pnpm -F @aptos-labs/script-composer-sdk lint
76+
77+
- name: Format check SDK package
78+
run: pnpm -F @aptos-labs/script-composer-sdk fmt:check
79+
80+
examples-build:
81+
name: Build Example Projects (Next.js & React)
82+
runs-on: ubuntu-latest
83+
steps:
84+
- name: Checkout
85+
uses: actions/checkout@v4
86+
87+
- name: Setup Node.js (LTS)
88+
uses: actions/setup-node@v4
89+
with:
90+
node-version: lts/*
91+
cache: pnpm
92+
cache-dependency-path: pnpm-lock.yaml
93+
94+
- name: Setup pnpm 10.11.0
95+
uses: pnpm/action-setup@v4
96+
with:
97+
version: 10.11.0
98+
run_install: false
99+
100+
- name: Install dependencies
101+
run: pnpm install --frozen-lockfile
102+
103+
- name: Build example projects
104+
run: |
105+
# Build all workspace packages under examples/** that define a "build" script
106+
pnpm -r --filter "./examples/**" run build --if-present

0 commit comments

Comments
 (0)