Skip to content

fix: address PR review feedback round 7 #152

fix: address PR review feedback round 7

fix: address PR review feedback round 7 #152

Workflow file for this run

name: CI
on:
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:
build:
name: Build
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[skip ci]')"
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: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- 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]')"
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: 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: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- 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: Install Playwright browsers
run: npx playwright install chromium
- name: Run scraper tests
run: npm run test:scraper
- 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: [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
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Configure git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Bump patch version
run: |
CURRENT_VERSION=$(node -p "require('./package.json').version")
MAJOR=$(echo $CURRENT_VERSION | cut -d. -f1)
MINOR=$(echo $CURRENT_VERSION | cut -d. -f2)
PATCH=$(echo $CURRENT_VERSION | cut -d. -f3)
NEW_PATCH=$((PATCH + 1))
NEW_VERSION="$MAJOR.$MINOR.$NEW_PATCH"
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 ..
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