Skip to content

Commit 038af09

Browse files
authored
Merge pull request #3 from atomantic/dev
fix: CI workflow issues for scraper tests and release cherry-pick
2 parents 0604ab0 + 3483e70 commit 038af09

11 files changed

Lines changed: 176 additions & 220 deletions

File tree

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Release v0.3.x - SQLite Storage Layer & Migration Framework
1+
# Release v0.3.21 - SQLite Storage Layer & Migration Framework
22

33
Released: YYYY-MM-DD
44

@@ -160,4 +160,4 @@ pm2 restart ecosystem.config.cjs
160160

161161
## 🔗 Full Changelog
162162

163-
**Full Diff**: https://github.com/atomantic/SparseTree/compare/v0.2.11...v0.3.x
163+
**Full Diff**: https://github.com/atomantic/SparseTree/compare/v0.2.11...v0.3.21

.github/workflows/ci.yml

Lines changed: 123 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,166 @@
11
name: CI
22

33
on:
4-
pull_request:
5-
branches: [main, dev]
64
push:
75
branches: [dev]
6+
pull_request:
7+
branches: [main]
8+
9+
# Cancel duplicate runs for the same branch/PR
10+
concurrency:
11+
group: ci-${{ github.head_ref || github.ref }}
12+
cancel-in-progress: true
813

914
permissions:
1015
contents: write
1116

1217
jobs:
13-
test:
18+
build:
19+
name: Build
1420
runs-on: ubuntu-latest
15-
# Skip if commit message contains [skip ci]
1621
if: "!contains(github.event.head_commit.message, '[skip ci]')"
1722

18-
strategy:
19-
matrix:
20-
node-version: [20.x]
23+
steps:
24+
- uses: actions/checkout@v4
25+
26+
- name: Setup Node.js
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: '20'
30+
cache: 'npm'
31+
32+
- name: Install dependencies
33+
run: npm ci
34+
35+
- name: Build all packages
36+
run: npm run build
37+
38+
- name: Cache build artifacts
39+
uses: actions/cache/save@v4
40+
with:
41+
path: |
42+
server/dist
43+
client/dist
44+
shared/types
45+
key: build-${{ github.sha }}
46+
47+
unit-tests:
48+
name: Unit Tests
49+
runs-on: ubuntu-latest
50+
needs: build
51+
if: "!contains(github.event.head_commit.message, '[skip ci]')"
2152

2253
steps:
2354
- uses: actions/checkout@v4
2455

25-
- name: Use Node.js ${{ matrix.node-version }}
56+
- name: Setup Node.js
2657
uses: actions/setup-node@v4
2758
with:
28-
node-version: ${{ matrix.node-version }}
59+
node-version: '20'
2960
cache: 'npm'
3061

31-
- name: Install all dependencies
32-
run: npm run install:all
62+
- name: Install dependencies
63+
run: npm ci
64+
65+
- name: Restore build artifacts
66+
uses: actions/cache/restore@v4
67+
with:
68+
path: |
69+
server/dist
70+
client/dist
71+
shared/types
72+
key: build-${{ github.sha }}
73+
74+
- name: Run unit tests
75+
run: npm run test:unit
76+
77+
- name: Upload coverage
78+
uses: codecov/codecov-action@v4
79+
if: always()
80+
with:
81+
files: ./coverage/lcov.info
82+
fail_ci_if_error: false
83+
84+
integration-tests:
85+
name: Integration Tests
86+
runs-on: ubuntu-latest
87+
needs: build
88+
if: "!contains(github.event.head_commit.message, '[skip ci]')"
3389

34-
- name: Build shared types
35-
run: npm run build -w shared
90+
steps:
91+
- uses: actions/checkout@v4
3692

37-
- name: Build server
38-
run: npm run build -w server
93+
- name: Setup Node.js
94+
uses: actions/setup-node@v4
95+
with:
96+
node-version: '20'
97+
cache: 'npm'
3998

40-
- name: Build client
41-
run: npm run build -w client
99+
- name: Install dependencies
100+
run: npm ci
42101

43-
lint:
102+
- name: Restore build artifacts
103+
uses: actions/cache/restore@v4
104+
with:
105+
path: |
106+
server/dist
107+
client/dist
108+
shared/types
109+
key: build-${{ github.sha }}
110+
111+
- name: Run integration tests
112+
run: npm run test:integration
113+
114+
scraper-tests:
115+
name: Scraper Tests
44116
runs-on: ubuntu-latest
117+
needs: build
45118
if: "!contains(github.event.head_commit.message, '[skip ci]')"
46119

47120
steps:
48121
- uses: actions/checkout@v4
49122

50-
- name: Use Node.js 20.x
123+
- name: Setup Node.js
51124
uses: actions/setup-node@v4
52125
with:
53-
node-version: 20.x
126+
node-version: '20'
54127
cache: 'npm'
55128

56129
- name: Install dependencies
57-
run: npm run install:all
130+
run: npm ci
131+
132+
- name: Restore build artifacts
133+
uses: actions/cache/restore@v4
134+
with:
135+
path: |
136+
server/dist
137+
client/dist
138+
shared/types
139+
key: build-${{ github.sha }}
58140

59-
- name: Build shared types
60-
run: npm run build -w shared
141+
- name: Install Playwright browsers
142+
run: npx playwright install chromium
61143

62-
- name: Check for TypeScript errors
63-
run: npm run build -w server && npm run build -w client
144+
- name: Run scraper tests
145+
run: npm run test:scraper
64146

65-
bump-build:
147+
- name: Upload test results
148+
uses: actions/upload-artifact@v4
149+
if: always()
150+
with:
151+
name: scraper-test-results
152+
path: test-results/
153+
retention-days: 7
154+
155+
bump-version:
156+
name: Bump Version
66157
runs-on: ubuntu-latest
67-
needs: [test, lint]
68-
# Only run on push to dev (not PRs), and skip if already a version bump commit
69-
if: github.event_name == 'push' && github.ref == 'refs/heads/dev' && !contains(github.event.head_commit.message, '[skip ci]')
158+
needs: [unit-tests, integration-tests, scraper-tests]
159+
# Only on push to dev, not PRs, and only if all tests passed
160+
if: |
161+
github.event_name == 'push' &&
162+
github.ref == 'refs/heads/dev' &&
163+
!contains(github.event.head_commit.message, '[skip ci]')
70164
71165
steps:
72166
- uses: actions/checkout@v4
@@ -80,25 +174,18 @@ jobs:
80174
81175
- name: Bump patch version
82176
run: |
83-
# Get current version
84177
CURRENT_VERSION=$(node -p "require('./package.json').version")
85-
86-
# Split into parts
87178
MAJOR=$(echo $CURRENT_VERSION | cut -d. -f1)
88179
MINOR=$(echo $CURRENT_VERSION | cut -d. -f2)
89180
PATCH=$(echo $CURRENT_VERSION | cut -d. -f3)
90-
91-
# Increment patch
92181
NEW_PATCH=$((PATCH + 1))
93182
NEW_VERSION="$MAJOR.$MINOR.$NEW_PATCH"
94183
95-
# Update package.json files
96184
npm version $NEW_VERSION --no-git-tag-version
97185
cd shared && npm version $NEW_VERSION --no-git-tag-version && cd ..
98186
cd client && npm version $NEW_VERSION --no-git-tag-version && cd ..
99187
cd server && npm version $NEW_VERSION --no-git-tag-version && cd ..
100188
101-
# Commit and push
102189
git add package.json package-lock.json shared/package.json client/package.json server/package.json
103190
git commit -m "build: bump version to $NEW_VERSION [skip ci]"
104191
git push

.github/workflows/release.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,12 @@ jobs:
134134
git commit -m "docs: archive changelog for v${CURRENT_VERSION} [skip ci]"
135135
git push origin dev
136136
137+
# Store the changelog commit SHA before switching branches
138+
CHANGELOG_COMMIT=$(git rev-parse HEAD)
139+
137140
# Merge changelog back to main (without triggering CI)
138141
git checkout main
139-
git cherry-pick HEAD~1
142+
git cherry-pick "$CHANGELOG_COMMIT"
140143
git push origin main
141144
git checkout dev
142145
fi

.github/workflows/test.yml

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

client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@fsf/client",
3-
"version": "0.3.21",
3+
"version": "0.3.24",
44
"type": "module",
55
"scripts": {
66
"dev": "vite --port 6373",

0 commit comments

Comments
 (0)