Skip to content

Commit

Permalink
Update backend (#28)
Browse files Browse the repository at this point in the history
* Initial commit of updating worker to support /posts endpoint

* Working backend api

* working on switching the frontend to use more network calls to load only the data that it needs

* Updating the frontend to request only the data it needs

* working on getting the network_dynamic backend to play nicely. Running into a CORS issue

* Fixing the CORS issue

* We have a working local dynamic network!

* Finally found the option to allow for direct path navigation!

* Adding k6 test to CI

* fix action with actionlint

* fix buildPosts

* Switching to true SPA mode (sigh of relief). SPAs are how my brain work

* Fixing the directory issue with the backend deployments

* Add the checkout step 🤦

* 🤦 fixing the version of k6
  • Loading branch information
joseph-flinn authored Aug 19, 2023
1 parent e34d364 commit 49e9d1b
Show file tree
Hide file tree
Showing 19 changed files with 399 additions and 133 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/build-n-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
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]
Expand All @@ -24,6 +25,7 @@ jobs:
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" == "1" ]]; then
echo "frontend-changed=true" >> $GITHUB_OUTPUT
Expand All @@ -33,6 +35,10 @@ jobs:
echo "data-changed=true" >> $GITHUB_OUTPUT
fi
if [[ "$BACKEND_DIFF" == "1" ]]; then
echo "backend-changed=true" >> $GITHUB_OUTPUT
fi
build-frontend:
name: Build Frontend
Expand Down Expand Up @@ -103,3 +109,21 @@ jobs:
apiToken: ${{ secrets.CF_API_KEY }}
accountId: ${{ secrets.CF_ACCOUNT }}
command: r2 object put flinnlab-blog/rss.xml --file ./data/rss.xml


deploy-backend:
name: Deploy Backend
if: ${{ needs.setup.outputs.backend-changed == 'true' }}
needs: [setup]
runs-on: ubuntu-latest
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 production
21 changes: 21 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,24 @@ jobs:
run: |
npm run build:posts
npm run build:rss
test-backend:
name: Deploy & Test Backend
runs-on: ubuntu-latest
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
82 changes: 41 additions & 41 deletions backend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"private": true,
"scripts": {
"deploy": "wrangler deploy",
"start": "wrangler dev"
"start": "wrangler dev --remote"
},
"devDependencies": {
"wrangler": "^3.0.0"
"wrangler": "^3.5.1"
}
}
}
Loading

0 comments on commit 49e9d1b

Please sign in to comment.