Skip to content

[post] scalable dev practices client configuration #58

[post] scalable dev practices client configuration

[post] scalable dev practices client configuration #58

Workflow file for this run

---
name: CI
on:
workflow_dispatch:
inputs: {}
pull_request:
branches:
- main
jobs:
setup:
name: Deploy Setup
runs-on: ubuntu-latest
outputs:
frontend-changed: ${{ steps.changes.outputs.frontend-changed }}
data-changed: ${{ steps.changes.outputs.data-changed }}
backend-changed: ${{ steps.changes.outputs.backend-changed }}
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Detect Changes
id: changes
run: |
FRONTEND_DIFF=$(git diff --name-only origin/main -- frontend/* | wc -l | xargs)
DATA_DIFF=$(git diff --name-only origin/main -- data/* | wc -l | xargs)
BACKEND_DIFF=$(git diff --name-only origin/main -- backend/* | wc -l | xargs)
if [[ "$FRONTEND_DIFF" != "0" ]]; then
echo "frontend-changed=true" >> $GITHUB_OUTPUT
fi
if [[ "$DATA_DIFF" != "0" ]]; then
echo "data-changed=true" >> $GITHUB_OUTPUT
fi
if [[ "$BACKEND_DIFF" != "0" ]]; then
echo "backend-changed=true" >> $GITHUB_OUTPUT
fi
build-frontend:
name: Build Frontend
if: ${{ needs.setup.outputs.frontend-changed == 'true' }}
runs-on: ubuntu-latest
needs: [setup]
steps:
- name: Checkout
uses: actions/[email protected]
- name: Build Site
run: |
cd frontend
npm ci
echo "{}" > src/posts.json
npm run build
build-data:
name: Build Data
if: ${{ needs.setup.outputs.data-changed == 'true' }}
runs-on: ubuntu-latest
needs: [setup]
steps:
- name: Checkout
uses: actions/[email protected]
- name: Build data
working-directory: data
run: |
npm run build:posts
npm run build:rss
test-backend:
name: Deploy & Test Backend
if: ${{ needs.setup.outputs.backend-changed == 'true' }}
runs-on: ubuntu-latest
needs: [setup]
steps:
- name: Checkout
uses: actions/[email protected]
- name: Deploy backend
uses: cloudflare/[email protected]
with:
apiToken: ${{ secrets.CF_API_KEY }}
accountId: ${{ secrets.CF_ACCOUNT }}
workingDirectory: backend
command: deploy --env staging
- name: Run Integration Tests
uses: grafana/[email protected]
with:
filename: backend/test/script.js