Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add cicd pipeline to test and deploy the core to the remote server - … #53

Merged
merged 5 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Go

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

env:
TARGET_DIR: /home/${{secrets.SSH_USERNAME}}/apps/event-mgmt-core
DB_DSN: "postgres://${{secrets.DATABASE_USER}}:${{secrets.DATABASE_PASSWORD}}@${{secrets.DATABASE_HOST}}:${{secrets.DATABASE_PORT}}/${{secrets.DATABASE_NAME}}?sslmode=${{secrets.DATABASE_SSL_MODE}}"

jobs:

build:
runs-on: ubuntu-latest
steps:
# Checkout makes source available for remote deploy.
- uses: actions/checkout@v4

# Setup Golang for build and testing.
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.22.3'

# Run tests
- name: Test
run: go test -v ./...

# Deploys all the source (currently).
# Might be better to deploy only the compiled binary and do additional setup.
- name: Remote deploy
uses: cross-the-world/[email protected]
with:
host: ${{secrets.SSH_HOST}}
key: ${{secrets.SSH_KEY}}
user: ${{secrets.SSH_USERNAME}}
first_ssh: |
rm -rf $TARGET_DIR
mkdir -p $TARGET_DIR
scp: |-
"." => $TARGET_DIR
last_ssh: |-
cd $TARGET_DIR
/usr/local/go/bin/go build -o bin/emc main.go
/usr/local/bin/migrate -path=./migrations -database=$DB_DSN up
systemctl --user restart event-mgmt-core

3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Event Management System
# Event Management System
[![Go](https://github.com/BEOpenSourceCollabs/EventManagementCore/actions/workflows/go.yml/badge.svg)](https://github.com/BEOpenSourceCollabs/EventManagementCore/actions/workflows/go.yml)

User management - login / sign up / roles assigned to users ( organisers, admins and normal users)

Expand Down
9 changes: 9 additions & 0 deletions static/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@
"servers": [
{
"url": "http://localhost:8081/api"
},
{
"url": "https://api.event-local.online/api"
},
{
"url": "https://dev-api.event-local.online/api"
},
{
"url": "https://qa-api.event-local.online/api"
}
],
"tags": [
Expand Down
2 changes: 1 addition & 1 deletion static/swagger/swagger-initializer.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ window.onload = function() {

// the following lines will be replaced by docker/configurator, when it runs in a docker-container
window.ui = SwaggerUIBundle({
url: "http://localhost:8081/swagger.json",
url: "/swagger.json",
dom_id: '#swagger-ui',
deepLinking: true,
presets: [
Expand Down
Loading