Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .changelog/v0.3.x.md → .changelog/v0.3.21.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Release v0.3.x - SQLite Storage Layer & Migration Framework
# Release v0.3.21 - SQLite Storage Layer & Migration Framework

Released: YYYY-MM-DD

Expand Down Expand Up @@ -160,4 +160,4 @@ pm2 restart ecosystem.config.cjs

## 🔗 Full Changelog

**Full Diff**: https://github.com/atomantic/SparseTree/compare/v0.2.11...v0.3.x
**Full Diff**: https://github.com/atomantic/SparseTree/compare/v0.2.11...v0.3.21
159 changes: 123 additions & 36 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,72 +1,166 @@
name: CI

on:
pull_request:
branches: [main, dev]
push:
branches: [dev]
pull_request:
branches: [main]

# Cancel duplicate runs for the same branch/PR
concurrency:
group: ci-${{ github.head_ref || github.ref }}
cancel-in-progress: true

permissions:
contents: write

jobs:
test:
build:
name: Build
runs-on: ubuntu-latest
# Skip if commit message contains [skip ci]
if: "!contains(github.event.head_commit.message, '[skip ci]')"

strategy:
matrix:
node-version: [20.x]
steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Build all packages
run: npm run build

- name: Cache build artifacts
uses: actions/cache/save@v4
with:
path: |
server/dist
client/dist
shared/types
key: build-${{ github.sha }}

unit-tests:
name: Unit Tests
runs-on: ubuntu-latest
needs: build
if: "!contains(github.event.head_commit.message, '[skip ci]')"

steps:
- uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
node-version: '20'
cache: 'npm'

- name: Install all dependencies
run: npm run install:all
- name: Install dependencies
run: npm ci

- name: Restore build artifacts
uses: actions/cache/restore@v4
with:
path: |
server/dist
client/dist
shared/types
key: build-${{ github.sha }}

- name: Run unit tests
run: npm run test:unit

- name: Upload coverage
uses: codecov/codecov-action@v4
if: always()
with:
files: ./coverage/lcov.info
fail_ci_if_error: false

integration-tests:
name: Integration Tests
runs-on: ubuntu-latest
needs: build
if: "!contains(github.event.head_commit.message, '[skip ci]')"

- name: Build shared types
run: npm run build -w shared
steps:
- uses: actions/checkout@v4

- name: Build server
run: npm run build -w server
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'

- name: Build client
run: npm run build -w client
- name: Install dependencies
run: npm ci

lint:
- name: Restore build artifacts
uses: actions/cache/restore@v4
with:
path: |
server/dist
client/dist
shared/types
key: build-${{ github.sha }}

- name: Run integration tests
run: npm run test:integration

scraper-tests:
name: Scraper Tests
runs-on: ubuntu-latest
needs: build
if: "!contains(github.event.head_commit.message, '[skip ci]')"

steps:
- uses: actions/checkout@v4

- name: Use Node.js 20.x
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x
node-version: '20'
cache: 'npm'

- name: Install dependencies
run: npm run install:all
run: npm ci

- name: Restore build artifacts
uses: actions/cache/restore@v4
with:
path: |
server/dist
client/dist
shared/types
key: build-${{ github.sha }}

- name: Build shared types
run: npm run build -w shared
- name: Install Playwright browsers
run: npx playwright install chromium

- name: Check for TypeScript errors
run: npm run build -w server && npm run build -w client
- name: Run scraper tests
run: npm run test:scraper

bump-build:
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: scraper-test-results
path: test-results/
retention-days: 7

bump-version:
name: Bump Version
runs-on: ubuntu-latest
needs: [test, lint]
# Only run on push to dev (not PRs), and skip if already a version bump commit
if: github.event_name == 'push' && github.ref == 'refs/heads/dev' && !contains(github.event.head_commit.message, '[skip ci]')
needs: [unit-tests, integration-tests, scraper-tests]
# Only on push to dev, not PRs, and only if all tests passed
if: |
github.event_name == 'push' &&
github.ref == 'refs/heads/dev' &&
!contains(github.event.head_commit.message, '[skip ci]')

steps:
- uses: actions/checkout@v4
Expand All @@ -80,25 +174,18 @@ jobs:

- name: Bump patch version
run: |
# Get current version
CURRENT_VERSION=$(node -p "require('./package.json').version")

# Split into parts
MAJOR=$(echo $CURRENT_VERSION | cut -d. -f1)
MINOR=$(echo $CURRENT_VERSION | cut -d. -f2)
PATCH=$(echo $CURRENT_VERSION | cut -d. -f3)

# Increment patch
NEW_PATCH=$((PATCH + 1))
NEW_VERSION="$MAJOR.$MINOR.$NEW_PATCH"

# Update package.json files
npm version $NEW_VERSION --no-git-tag-version
cd shared && npm version $NEW_VERSION --no-git-tag-version && cd ..
cd client && npm version $NEW_VERSION --no-git-tag-version && cd ..
cd server && npm version $NEW_VERSION --no-git-tag-version && cd ..

# Commit and push
git add package.json package-lock.json shared/package.json client/package.json server/package.json
git commit -m "build: bump version to $NEW_VERSION [skip ci]"
git push
5 changes: 4 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,12 @@ jobs:
git commit -m "docs: archive changelog for v${CURRENT_VERSION} [skip ci]"
git push origin dev

# Store the changelog commit SHA before switching branches
CHANGELOG_COMMIT=$(git rev-parse HEAD)

# Merge changelog back to main (without triggering CI)
git checkout main
git cherry-pick HEAD~1
git cherry-pick "$CHANGELOG_COMMIT"
git push origin main
git checkout dev
fi
Expand Down
100 changes: 0 additions & 100 deletions .github/workflows/test.yml

This file was deleted.

2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@fsf/client",
"version": "0.3.21",
"version": "0.3.24",
"type": "module",
"scripts": {
"dev": "vite --port 6373",
Expand Down
Loading