Skip to content

Commit e07c6c6

Browse files
Merge pull request #32 from Shopify/sd.run_ci
Adding CI to repo
2 parents 19590c0 + ad9df2c commit e07c6c6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1483
-928
lines changed

.github/workflows/ci.yml

Lines changed: 218 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,218 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths-ignore:
8+
- '**.md'
9+
- 'docs/**'
10+
pull_request:
11+
paths-ignore:
12+
- '**.md'
13+
- 'docs/**'
14+
15+
concurrency:
16+
group: ci-${{ github.head_ref || github.run_id }}
17+
cancel-in-progress: true
18+
19+
env:
20+
PNPM_VERSION: '10.20.0'
21+
22+
jobs:
23+
lint-and-typecheck:
24+
name: 'Lint & Type-check'
25+
runs-on: ubuntu-latest
26+
timeout-minutes: 10
27+
steps:
28+
- uses: actions/checkout@v4
29+
name: Checkout
30+
31+
- name: Setup Node.js
32+
uses: actions/setup-node@v4
33+
with:
34+
node-version: '20.x'
35+
36+
- name: Setup pnpm
37+
uses: pnpm/action-setup@v4
38+
with:
39+
version: ${{ env.PNPM_VERSION }}
40+
41+
- name: Get pnpm store directory
42+
id: pnpm-cache
43+
shell: bash
44+
run: |
45+
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
46+
47+
- name: Setup pnpm cache
48+
uses: actions/cache@v4
49+
with:
50+
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
51+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
52+
restore-keys: |
53+
${{ runner.os }}-pnpm-store-
54+
55+
- name: Install dependencies
56+
run: pnpm install --frozen-lockfile
57+
58+
- name: Lint
59+
run: pnpm run lint
60+
61+
- name: Build (Type-check)
62+
run: pnpm run build
63+
64+
test:
65+
name: 'Test - Node ${{ matrix.node }} on ${{ matrix.os }}'
66+
runs-on: ${{ matrix.os }}
67+
timeout-minutes: 15
68+
strategy:
69+
fail-fast: false
70+
matrix:
71+
os: [ubuntu-latest, windows-latest, macos-latest]
72+
node: ['20.x', '22.x']
73+
steps:
74+
- uses: actions/checkout@v4
75+
name: Checkout
76+
77+
- name: Setup Node.js
78+
uses: actions/setup-node@v4
79+
with:
80+
node-version: ${{ matrix.node }}
81+
82+
- name: Setup pnpm
83+
uses: pnpm/action-setup@v4
84+
with:
85+
version: ${{ env.PNPM_VERSION }}
86+
87+
- name: Get pnpm store directory
88+
id: pnpm-cache
89+
shell: bash
90+
run: |
91+
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
92+
93+
- name: Setup pnpm cache
94+
uses: actions/cache@v4
95+
with:
96+
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
97+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
98+
restore-keys: |
99+
${{ runner.os }}-pnpm-store-
100+
101+
- name: Install dependencies
102+
run: pnpm install --frozen-lockfile
103+
104+
- name: Run tests
105+
run: pnpm run test
106+
107+
build:
108+
name: 'Build & Package'
109+
runs-on: ubuntu-latest
110+
timeout-minutes: 10
111+
steps:
112+
- uses: actions/checkout@v4
113+
name: Checkout
114+
115+
- name: Setup Node.js
116+
uses: actions/setup-node@v4
117+
with:
118+
node-version: '20.x'
119+
120+
- name: Setup pnpm
121+
uses: pnpm/action-setup@v4
122+
with:
123+
version: ${{ env.PNPM_VERSION }}
124+
125+
- name: Get pnpm store directory
126+
id: pnpm-cache
127+
shell: bash
128+
run: |
129+
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
130+
131+
- name: Setup pnpm cache
132+
uses: actions/cache@v4
133+
with:
134+
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
135+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
136+
restore-keys: |
137+
${{ runner.os }}-pnpm-store-
138+
139+
- name: Install dependencies
140+
run: pnpm install --frozen-lockfile
141+
142+
- name: Build
143+
run: pnpm run build
144+
145+
- name: Create package
146+
run: pnpm pack
147+
148+
integration-tests:
149+
name: 'Integration Tests - Ubuntu'
150+
runs-on: ubuntu-latest
151+
timeout-minutes: 20
152+
steps:
153+
- uses: actions/checkout@v4
154+
name: Checkout
155+
156+
- name: Setup Node.js
157+
uses: actions/setup-node@v4
158+
with:
159+
node-version: '20.x'
160+
161+
- name: Setup Rust
162+
uses: actions-rust-lang/setup-rust-toolchain@v1
163+
with:
164+
toolchain: stable
165+
target: wasm32-wasip1
166+
167+
- name: Setup pnpm
168+
uses: pnpm/action-setup@v4
169+
with:
170+
version: ${{ env.PNPM_VERSION }}
171+
172+
- name: Get pnpm store directory
173+
id: pnpm-cache
174+
shell: bash
175+
run: |
176+
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
177+
178+
- name: Setup pnpm cache
179+
uses: actions/cache@v4
180+
with:
181+
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
182+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
183+
restore-keys: |
184+
${{ runner.os }}-pnpm-store-
185+
186+
- name: Install dependencies
187+
run: pnpm install --frozen-lockfile
188+
189+
- name: Install Shopify CLI
190+
run: npm install -g @shopify/cli@0.0.0-snapshot-20251031143515
191+
192+
- name: Verify CLI installations
193+
run: |
194+
shopify version
195+
196+
- name: Build
197+
run: pnpm run build
198+
199+
- name: Run integration tests
200+
run: |
201+
pnpm --filter cart-validation-js-tests test
202+
pnpm --filter discount-function-rs-tests test
203+
204+
all-checks-pass:
205+
name: 'All Checks Pass'
206+
if: always()
207+
needs: [lint-and-typecheck, test, build, integration-tests]
208+
runs-on: ubuntu-latest
209+
steps:
210+
- name: Check all jobs
211+
run: |
212+
if [[ "${{ needs.lint-and-typecheck.result }}" != "success" ]] || \
213+
[[ "${{ needs.test.result }}" != "success" ]] || \
214+
[[ "${{ needs.build.result }}" != "success" ]] || \
215+
[[ "${{ needs.integration-tests.result }}" != "success" ]]; then
216+
echo "One or more checks failed"
217+
exit 1
218+
fi

.gitignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ node_modules/
33
npm-debug.log*
44
yarn-debug.log*
55
yarn-error.log*
6+
package-lock.json
67

78
# Coverage directory used by tools like istanbul
89
coverage/
@@ -96,3 +97,22 @@ temp/
9697
.Trashes
9798
ehthumbs.db
9899
Thumbs.db
100+
101+
# Discount function Rust
102+
test-app/extensions/discount-function-rs/target/
103+
test-app/extensions/discount-function-rs/Cargo.lock
104+
105+
# Discount function Rust tests
106+
test-app/extensions/discount-function-rs/tests/node_modules/
107+
test-app/extensions/discount-function-rs/tests/package-lock.json
108+
test-app/extensions/discount-function-rs/tests/pnpm-lock.yaml
109+
110+
# Cart validation JS
111+
test-app/extensions/cart-validation-js/node_modules/
112+
test-app/extensions/cart-validation-js/package-lock.json
113+
test-app/extensions/cart-validation-js/pnpm-lock.yaml
114+
115+
# Cart validation JS tests
116+
test-app/extensions/cart-validation-js/tests/node_modules/
117+
test-app/extensions/cart-validation-js/tests/package-lock.json
118+
test-app/extensions/cart-validation-js/tests/pnpm-lock.yaml

0 commit comments

Comments
 (0)