Skip to content

Commit

Permalink
Merge branch 'main' into next-unkey-netlify-starter
Browse files Browse the repository at this point in the history
  • Loading branch information
glamboyosa committed Dec 8, 2023
2 parents 490bf7a + b57bcfb commit 9aeea31
Show file tree
Hide file tree
Showing 387 changed files with 6,056 additions and 15,782 deletions.
64 changes: 11 additions & 53 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,48 +21,6 @@ jobs:
steps:
- run: true


test_agent:
needs: authorize
name: Unit Test Agent
runs-on: ubuntu-latest

services:
mysql:
image: mysql:latest
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: unkey
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha || github.ref }}

- name: Load Schema into MySQL
run: mysql -h 127.0.0.1 --port 3306 -uroot unkey < ./apps/agent/pkg/database/schema.sql

- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: ^1.20.0

- name: Set up gotestfmt
run: go install github.com/gotesttools/gotestfmt/v2/cmd/gotestfmt@latest

- name: Install dependencies
run: go mod download
working-directory: apps/agent

- name: Test
run: go test -p 4 -v -json -shuffle=on --race ./... | gotestfmt
working-directory: apps/agent
env:
DATABASE_DSN: root@tcp(localhost:3306)/unkey

test_api_worker:
needs: authorize
name: Unit Test API
Expand Down Expand Up @@ -122,7 +80,7 @@ jobs:


- name: Test
run: bun test src/routes --coverage --timeout 10000
run: bun test src/routes --coverage --timeout 10000 --rerun-each 3
working-directory: apps/api
- name: Delete planetscale branch
if: always()
Expand Down Expand Up @@ -193,16 +151,16 @@ jobs:
env:
NUXT_TEST_KEY: ${{secrets.NUXT_TEST_KEY}}

tinybird:
needs: authorize
name: Tinybird CI
concurrency: tinybird
uses: tinybirdco/ci/.github/workflows/ci.yml@v1.1.8
with:
data_project_dir: ./internal/tinybird
secrets:
admin_token: ${{ secrets.TINYBIRD_ADMIN_TOKEN }} # set admin token associated to an account in GitHub secrets
tb_host: https://api.tinybird.co
# tinybird:
# needs: authorize
# name: Tinybird CI
# concurrency: tinybird
# uses: tinybirdco/ci/.github/workflows/ci.yml@v2.4.0
# with:
# data_project_dir: ./internal/tinybird
# secrets:
# tb_admin_token: ${{ secrets.TINYBIRD_ADMIN_TOKEN }} # set admin token associated to an account in GitHub secrets
# tb_host: https://api.tinybird.co

build_packages:
needs: authorize
Expand Down
181 changes: 0 additions & 181 deletions .github/workflows/deploy-agent.yaml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
name: Deploy

on:
push:
branches:
- main

release:
types:
- published

concurrency: "only one deploy at a time"

Expand All @@ -15,6 +14,7 @@ jobs:
name: Preview
steps:
- uses: actions/checkout@v3

- uses: pnpm/action-setup@v2.2.4
with:
version: latest
Expand All @@ -34,16 +34,39 @@ jobs:
run: pnpm turbo run build --filter='./apps/api'

- name: Deploy
run: wrangler deploy --env=preview
run: wrangler deploy --env=preview --var VERSION:${GITHUB_REF#refs/*/}
working-directory: apps/api
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}

preview-tests:
environment: Preview
needs: preview
name: End to End Test Preview
runs-on: ubuntu-latest


steps:
- uses: actions/checkout@v3

- uses: pnpm/action-setup@v2
with:
version: latest

- name: Install dependencies
run: |
pnpm install
npm i -g bun
- name: Test
run: bun test src/integration --timeout 10000 --rerun-each 10
working-directory: apps/api
env:
UNKEY_BASE_URL: https://preview-api.unkey.dev
UNKEY_ROOT_KEY: ${{ secrets.PREVIEW_ROOT_KEY }}

canary:
needs:
- preview
needs: preview-tests
environment: Canary
runs-on: ubuntu-latest
name: Deploy Canary
Expand All @@ -68,12 +91,13 @@ jobs:
run: pnpm turbo run build --filter='./apps/api'

- name: Deploy
run: wrangler deploy --env=canary
run: wrangler deploy --env=canary --var VERSION:${GITHUB_REF#refs/*/}
working-directory: apps/api
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}

canary-tests:
environment: Canary
needs: canary
name: End to End Test Canary
runs-on: ubuntu-latest
Expand All @@ -92,10 +116,10 @@ jobs:
npm i -g bun
- name: Test
run: bun test src/integration --timeout 10000
run: bun test src/integration --timeout 10000 --rerun-each 10
working-directory: apps/api
env:
UNKEY_BASE_URL: https://canary.unkey.app
UNKEY_BASE_URL: https://canary.unkey.dev
UNKEY_ROOT_KEY: ${{ secrets.CANARY_ROOT_KEY }}

production:
Expand Down Expand Up @@ -126,7 +150,7 @@ jobs:
run: pnpm turbo run build --filter='./apps/api'

- name: Deploy
run: wrangler deploy --env=production
run: wrangler deploy --env=production --var VERSION:${GITHUB_REF#refs/*/}
working-directory: apps/api
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
18 changes: 0 additions & 18 deletions .github/workflows/tinybird_cd.yml

This file was deleted.

Loading

0 comments on commit 9aeea31

Please sign in to comment.