Skip to content

Commit

Permalink
Merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
Alder Whiteford authored and Alder Whiteford committed Jun 11, 2024
2 parents 84c1e5b + 2c32868 commit 737c486
Show file tree
Hide file tree
Showing 25 changed files with 108 additions and 411 deletions.
32 changes: 21 additions & 11 deletions .github/workflows/backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,22 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: "1.22"
- name: Cache Go Modules
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
${{ runner.os }}-go
- name: Install gofumpt
run: go install mvdan.cc/gofumpt@latest
- name: templ
run: go install github.com/a-h/templ/cmd/templ@latest && templ generate
- name: Check code formatting
run: |
unformatted_files=$(gofumpt -l ./backend/)
Expand All @@ -49,13 +51,21 @@ jobs:
pull-requests: read
checks: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: "1.22"
cache: false
- name: Cache Go Modules
uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go
- name: templ
run: go install github.com/a-h/templ/cmd/templ@latest && templ generate
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v4
with:
version: latest
working-directory: ./backend/
Expand All @@ -74,20 +84,20 @@ jobs:
- 5432:5432
steps:
- name: Checkout Repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: "1.22"
- name: Cache Go Modules
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go
- name: Install Dependencies
run: cd ./backend/ && go get ./...
run: cd ./backend/ && go install github.com/a-h/templ/cmd/templ@latest && templ generate && go get ./...
- name: Increase max_connections in PostgreSQL
run: |
CONTAINER_ID=$(docker ps --filter "publish=5432" --format "{{.ID}}")
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/backend_codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: "1.22"
- name: Initialize CodeQL
Expand All @@ -32,7 +32,7 @@ jobs:
queries: security-and-quality
- name: Build
run: |
cd ./backend/ && go build -o backend main.go
go install github.com/a-h/templ/cmd/templ@latest && templ generate && cd ./backend/ && go build -o backend main.go
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: "1.22"
- name: Cache Go Modules
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
Expand All @@ -49,13 +49,13 @@ jobs:
pull-requests: read
checks: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: "1.22"
cache: false
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v4
with:
version: latest
working-directory: ./cli/
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cli_codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: "1.22"
- name: Initialize CodeQL
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/dashboard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18.x
cache: yarn
Expand All @@ -34,9 +34,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18.x
cache: yarn
Expand All @@ -54,9 +54,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18.x
cache: yarn
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/frontend_lib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18.x
cache: yarn
Expand All @@ -34,9 +34,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18.x
cache: yarn
Expand All @@ -54,9 +54,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18.x
cache: yarn
Expand All @@ -74,15 +74,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout current branch
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Get new version of package.json
id: get_new_version
run: |
echo "new_version=$(jq -r '.version' frontend/lib/package.json)" >> $GITHUB_OUTPUT
- name: Checkout main
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: main

Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/mobile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18.x
cache: yarn
Expand All @@ -34,9 +34,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18.x
cache: yarn
Expand All @@ -54,9 +54,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18.x
cache: yarn
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18.x
cache: yarn
Expand All @@ -34,9 +34,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18.x
cache: yarn
Expand All @@ -54,9 +54,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18.x
cache: yarn
Expand Down
10 changes: 3 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,27 +1,23 @@
# MacOS
.DS_Store

# Cli
sac

# VSCode
.vscode
.trunk

# Node modules
node_modules

# Environment files
.env
.env.dev
.env.prod

# Debug files
backend/tests/api/__debug_*
.env.prod

frontend/mobile/ios/
frontend/mobile/android/
tmp/
ios
android
.idea/modules.xml

*_templ.go
4 changes: 3 additions & 1 deletion backend/.dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
tests/
docs/
docs/
*.md
*.templ
21 changes: 12 additions & 9 deletions backend/Dockerfile.server
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
# syntax=docker/dockerfile:1

FROM golang:1.22.2
FROM golang:1.22-alpine as builder

WORKDIR /app
RUN apk add --no-cache git

COPY go.mod go.sum ./

COPY *.go ./
COPY . ./
RUN go install github.com/a-h/templ/cmd/templ@latest
RUN templ generate
RUN go get ./...
RUN go mod tidy
RUN go mod download
RUN go build -tags prod -o bin/sac main.go

RUN CGO_ENABLED=0 GOOS=linux go build -v -o ./sac
FROM scratch
COPY --from=builder /app/bin/sac /sac

EXPOSE 8080

CMD ["/sac"]
ENTRYPOINT [ "./sac" ]
Loading

0 comments on commit 737c486

Please sign in to comment.