Skip to content

Commit

Permalink
refactor: mega cleanup, monorepo setup, better workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
enisdenjo committed Nov 23, 2023
1 parent 98d2e85 commit dae725d
Show file tree
Hide file tree
Showing 129 changed files with 8,482 additions and 86,052 deletions.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
# Allow files and directories
!go.mod
!go.sum
!.yarnrc.yml
!.yarn/releases
!yarn.lock
!package.json
!tsconfig.json
!/database/**
!/graphql/**
!/server/**
Expand Down
82 changes: 0 additions & 82 deletions .github/workflows/app.yml

This file was deleted.

33 changes: 33 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: CI

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
check:
strategy:
fail-fast: false
matrix:
check:
- format
- type
- graphql
name: Check ${{ matrix.check }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
cache: yarn
- name: Install
run: yarn install
- name: Check
run: yarn check:${{ matrix.check }}
10 changes: 4 additions & 6 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
name: "CodeQL analysis"
name: 'CodeQL analysis'

on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
branches:
- main
schedule:
- cron: "0 23 * * 0"
- cron: '0 23 * * 0'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[skip ci]')"
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Initialize
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v2
with:
languages: go, javascript
- name: Perform analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v2
28 changes: 1 addition & 27 deletions .github/workflows/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,16 @@ on:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
branches:
- main

jobs:
init-check:
name: Init check
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[skip ci]')"
services:
postgres:
image: postgres:14
image: postgres:16
env:
POSTGRES_PASSWORD: wowmuchsecret
ports:
Expand All @@ -37,27 +35,3 @@ jobs:
PGPASSWORD: wowmuchsecret
POSTGRES_DB: heltin
run: database/init.sh
release:
name: Release
if: github.ref == 'refs/heads/main'
needs: [init-check]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/bake-action@v2
with:
set: |
*.cache-from=type=gha
*.cache-to=type=gha,mode=max
targets: database
push: true
84 changes: 0 additions & 84 deletions .github/workflows/graphql.yml

This file was deleted.

29 changes: 16 additions & 13 deletions .github/workflows/server.yml → .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
name: Server
name: Release

on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
branches:
- main

# TODO: make sure database sql is valid before releasing

jobs:
# TODO: only release if app checks pass
release:
name: Release
if: "!contains(github.event.head_commit.message, '[skip ci]') && github.ref == 'refs/heads/main'"
strategy:
fail-fast: false
matrix:
target:
- database
- graphql
- server
name: Release ${{ matrix.target }}
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -22,19 +25,19 @@ jobs:
id: shortsha
run: echo "shortsha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/bake-action@v2
- name: Build and Push
uses: docker/bake-action@v4
with:
set: |
*.cache-from=type=gha
*.cache-to=type=gha,mode=max
server.args.VITE_APP_VER=${{ steps.shortsha.outputs.shortsha }}
targets: server
targets: ${{ matrix.target }}
push: true
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v21
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.graphql*
.yarn/*
*/build/*
5 changes: 2 additions & 3 deletions app/.prettierrc → .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"printWidth": 100,
"singleQuote": true,
"trailingComma": "all",
"plugins": ["@ianvs/prettier-plugin-sort-imports"],
"importOrder": [
"^react",
"<THIRD_PARTY_MODULES>",
Expand All @@ -11,7 +12,5 @@
"^modules/(.*)$",
"^assets/(.*)$",
"^[./]"
],
"importOrderSeparation": true,
"importOrderSortSpecifiers": true
]
}
Loading

0 comments on commit dae725d

Please sign in to comment.