Skip to content

Commit

Permalink
Improve the workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
Dlurak committed Mar 28, 2024
1 parent 2210cb3 commit 897f80e
Show file tree
Hide file tree
Showing 16 changed files with 421 additions and 270 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/biome.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Linting & formatting using biome

on:
push:
branches: ["master", "actions"]
workflow_dispatch:

jobs:
formatting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Setup bun
uses: oven-sh/setup-bun@v1
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Start EdgeDB
uses: edgedb/setup-edgedb@v1
- name: Generate Query Builder
run: bunx @edgedb/generate edgeql-js

- name: Format code
run: bun check:apply

- name: Check for Changes
id: check_changes
run: |
git diff --exit-code || echo "::set-output name=changes::true"
- name: Commit Changes
if: steps.check_changes.outputs.changes == 'true'
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add .
git commit -m "Auto-format code"
- name: Push Changes
if: steps.check_changes.outputs.changes == 'true'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref_name }}
34 changes: 34 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Tests
on:
push:
branches:
- master

jobs:
Lint:
name: Tests
runs-on: ubuntu-latest
env:
# Please never use this password in production
# Here it is only in a temp databse
DATABASE_URL: ws://127.0.0.1:8000
DATABASE_ACCOUNT: root
DATABASE_PASSWORD: root
JWT_SECRET: "long_string"
PORT: "3000"
ENV: "test"

steps:
- uses: actions/checkout@v3

- name: Setup bun
uses: oven-sh/setup-bun@v1
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Start EdgeDB
uses: edgedb/setup-edgedb@v1
- name: Generate Query Builder
run: bunx @edgedb/generate edgeql-js

- name: Run Tests
run: bun test
15 changes: 15 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "https://biomejs.dev/schemas/1.4.1/schema.json",
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
},
"files": {
"ignore": ["dist/**", "coverage/**", "docs/**", "dbschema/**"]
}
}
Binary file modified bun.lockb
Binary file not shown.
45 changes: 23 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
{
"name": "backend_v2",
"version": "1.0.50",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "bun run --watch src/index.ts"
},
"dependencies": {
"@sinclair/typebox": "^0.32.20",
"edgedb": "^1.4.1",
"elysia": "latest",
"elysia-http-status-code": "^1.0.9",
"jsonwebtoken": "^9.0.2",
"passport-local": "^1.0.0",
"zod": "^3.22.4"
},
"devDependencies": {
"@edgedb/generate": "^0.4.1",
"@types/jsonwebtoken": "^9.0.6",
"bun-types": "latest"
},
"module": "src/index.js"
}
"name": "backend_v2",
"version": "1.0.50",
"scripts": {
"dev": "bun run --watch src/index.ts",

"check": "biome check .",
"check:apply": "biome check --apply ."
},
"dependencies": {
"edgedb": "^1.4.1",
"elysia": "latest",
"elysia-http-status-code": "^1.0.9",
"jsonwebtoken": "^9.0.2",
"zod": "^3.22.4"
},
"devDependencies": {
"@biomejs/biome": "1.6.3",
"@edgedb/generate": "^0.4.1",
"@types/jsonwebtoken": "^9.0.6",
"bun-types": "latest"
},
"module": "src/index.js"
}
20 changes: 10 additions & 10 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { Elysia } from "elysia";
import { router } from "./routes/auth";
import { edgedb } from "../dbschema/edgeql-js/imports";
import { router } from "./routes/auth";

export const client = edgedb.createClient()
export const client = edgedb.createClient();

const app = new Elysia()
.use(router)
.get("/", () => ({
name: "Dlool",
isDlool: true,
version: "a2.0.0",
}))
.listen(3000);
.use(router)
.get("/", () => ({
name: "Dlool",
isDlool: true,
version: "a2.0.0",
}))
.listen(3000);

console.log(
`🦊 Elysia is running at ${app.server?.hostname}:${app.server?.port}`,
`🦊 Elysia is running at ${app.server?.hostname}:${app.server?.port}`,
);
Loading

0 comments on commit 897f80e

Please sign in to comment.