Skip to content

Commit

Permalink
Update GHA workflows, move migrations to db/migrations and update wra…
Browse files Browse the repository at this point in the history
…ngler config
  • Loading branch information
sergiodxa committed Nov 16, 2024
1 parent d99eab6 commit c12ceff
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 55 deletions.
62 changes: 36 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,54 @@
name: CI

on: [push]
# We run CI on every push
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize]

jobs:
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 1
steps:
- uses: actions/checkout@v3
- uses: oven-sh/setup-bun@v1
- run: bun install
- run: bun run build
# Automatically cancel running workflows when there's a new one
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

permissions:
contents: read
packages: read

jobs:
typecheck:
name: Typechecker
runs-on: ubuntu-latest
timeout-minutes: 1
steps:
- uses: actions/checkout@v3
- uses: oven-sh/setup-bun@v1
- run: bun install
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
- uses: actions/setup-node@v4
with:
node-version: 20
- run: bun install --frozen-lockfile
- run: bun run build
# - run: bun run rr:typegen
- run: bun run typecheck

test:
tests:
name: Tests
runs-on: ubuntu-latest
timeout-minutes: 1
steps:
- uses: actions/checkout@v3
- uses: oven-sh/setup-bun@v1
- run: bun install
- run: bun run test:coverage
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
- run: bun install --frozen-lockfile
- run: bun run test

quality:
name: Code Quality
runs-on: ubuntu-latest
timeout-minutes: 1
steps:
- uses: actions/checkout@v3
- uses: oven-sh/setup-bun@v1
- run: bun install
- run: bun run check
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
- run: bun install --frozen-lockfile
- run: bun run quality
44 changes: 27 additions & 17 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,35 @@
name: Deploy

on: [push, workflow_dispatch]
on:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

permissions:
contents: read
deployments: write
packages: read

jobs:
website:
name: Website
deploy:
name: "Deploy to Cloudflare Workers"
timeout-minutes: 10
runs-on: ubuntu-latest
permissions:
contents: read
deployments: write
steps:
- uses: actions/checkout@v3

- uses: oven-sh/setup-bun@v1
- run: bun install
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
- uses: actions/setup-node@v4
with:
node-version: 20
- run: bun install --frozen-lockfile
- run: bun run build

- uses: cloudflare/pages-action@v1
- uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
accountId: ${{ secrets.CF_ACCOUNT_ID }}
projectName: sergiodxa
directory: public
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
preCommands: |
bun run db:migrate ${{ secrets.CLOUDFLARE_DATABASE_NAME }} --remote
File renamed without changes.
22 changes: 10 additions & 12 deletions wrangler.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
name = "sergiodxa"
compatibility_date = "2023-06-22"
node_compat = true

# Update the compatibility date to the date you want to lock to
compatibility_date = "2024-10-11"

# This is needed for AsyncLocalStorage to work
compatibility_flags = ["nodejs_compat_v2"]

# Set the development port to be 3000
dev.port = 3000

kv_namespaces = [
{ binding = "cache", id = "597a3ce0108c42798aeac0044a566e31", preview_id = "cache" },
Expand All @@ -16,13 +23,4 @@ r2_buckets = [
binding = "DB"
database_name = "db"
database_id = "f6bb2533-9284-4427-83e6-ea12c6630026"

# [[services]]
# binding = "SVG_GENERATOR"
# service = "svg-generator"
# environment = "production"

# [[services]]
# binding = "SVG_TO_PNG"
# service = "svg-to-png"
# environment = "production"
migrations_dir = "./db/migrations"

0 comments on commit c12ceff

Please sign in to comment.