-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: add build workflow for backend (#106)
* ci: add build workflow for backend - Implemented a GitHub Actions workflow specifically for building the backend. - Ensures backend changes are validated through automated builds. - Improves reliability and consistency in the backend deployment pipeline. * chore: change branch name from development to develop * chore: change client test branch from main to develop * fix: remove supabase db password env * test: remove all test files
- Loading branch information
1 parent
253b612
commit c7133ce
Showing
13 changed files
with
68 additions
and
490 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
PORT=<PORT> | ||
|
||
SUPABASE_DB_PASSWORD=<SUPABASE_DB_PASSWORD> | ||
SUPABASE_URI=<SUPABASE_URI> | ||
|
||
# true | false | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
name: Client Test Workflow | ||
name: Client Test | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
- develop | ||
|
||
jobs: | ||
test: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: Backend - Build | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- develop | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
name: Build Application | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: ">=1.23" | ||
|
||
- name: Cache Go Modules | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.cache/go-build | ||
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go-build- | ||
- name: Check Go Version | ||
run: go version | ||
|
||
- name: Run Build | ||
env: | ||
PORT: ${{ vars.PORT }} | ||
SUPABASE_URI: ${{ secrets.SUPABASE_URI }} | ||
RUN_MIGRATIONS: ${{ vars.RUN_MIGRATIONS }} | ||
SECRET_KEY: ${{ secrets.SECRET_KEY }} | ||
run: | | ||
if ! go build -tags netgo -ldflags '-s -w' -o app; then | ||
echo "Build failed. Please check the logs." | ||
exit 1 | ||
fi | ||
- name: Upload Build Artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: backend-app | ||
path: app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,23 @@ | ||
package configs | ||
|
||
import ( | ||
"log" | ||
"errors" | ||
"os" | ||
|
||
"github.com/gofiber/fiber/v3" | ||
"github.com/gofiber/fiber/v3/middleware/cors" | ||
) | ||
|
||
func SetupCORS(app *fiber.App) { | ||
func SetupCORS(app *fiber.App) error { | ||
CLIENT_URL := os.Getenv("CLIENT_URL") | ||
if CLIENT_URL == "" { | ||
log.Fatal("CLIENT_URL must be set") | ||
return errors.New("CLIENT_URL must be set") | ||
} | ||
|
||
app.Use(cors.New(cors.Config{ | ||
AllowOrigins: []string{CLIENT_URL}, | ||
AllowCredentials: true, | ||
})) | ||
|
||
return nil | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.