-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #68 from Game-as-a-Service/dev
v0.1.1 Release
- Loading branch information
Showing
88 changed files
with
13,285 additions
and
3,051 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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Vite React CI/CD | ||
|
||
on: | ||
push: | ||
paths: | ||
- Frontend/** | ||
pull_request: | ||
paths: | ||
- Frontend/** | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 20 | ||
|
||
- name: Install dependencies | ||
working-directory: ./Frontend/the-message | ||
run: npm install | ||
|
||
- name: Build Vite app | ||
working-directory: ./Frontend/the-message | ||
run: npm run build | ||
|
||
- name: Run Unit Tests | ||
working-directory: ./Frontend/the-message | ||
run: npm 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,97 @@ | ||
name: ⚙️ Backend CI | ||
|
||
on: | ||
push: | ||
paths: | ||
- Backend/** | ||
- .github/workflows/test-go-unit.yml | ||
pull_request: | ||
paths: | ||
- Backend/** | ||
- .github/workflows/test-go-unit.yml | ||
|
||
env: | ||
GO_VERSION: 1.21 | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
|
||
- name: Env handle | ||
working-directory: ./Backend | ||
run: cp env .env | ||
|
||
- name: Build | ||
working-directory: ./Backend | ||
run: go build -v ./... | ||
|
||
unit_test: | ||
needs: build | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Setup Go environment | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
|
||
- name: 🧪 Test | ||
working-directory: ./Backend | ||
run: go test $(go list ./... | grep -v /tests/) -count=1 -v -coverprofile=unit_test_coverage.out | ||
|
||
- name: Upload unit test coverage report as artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: unit-test-coverage-report | ||
path: ./Backend/unit_test_coverage.out | ||
|
||
acceptance_test: | ||
needs: unit_test | ||
if: github.event_name == 'push' | ||
|
||
services: | ||
mysql: | ||
image: mysql:8.1.0 | ||
env: | ||
MYSQL_ROOT_PASSWORD: ${{ secrets.DB_ROOT_PASSWORD }} | ||
MYSQL_DATABASE: test | ||
MYSQL_USER: user | ||
MYSQL_PASSWORD: ${{ secrets.DB_PASSWORD }} | ||
ports: | ||
- "3306:3306" | ||
|
||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Setup Go environment | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
|
||
- name: Env handle | ||
working-directory: ./Backend | ||
run: cp env .env | ||
|
||
- name: Migration | ||
working-directory: ./Backend | ||
run: go run ./cmd/migrate/migrate.go | ||
- name: 🎯 Acceptance test | ||
working-directory: ./Backend | ||
run: go test ./... -v -count=1 -coverprofile=coverage.out | ||
|
||
- name: Upload acceptance test coverage report as artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: acceptance-test-coverage-report | ||
path: ./Backend/coverage.out |
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,4 @@ | ||
# Backend | ||
|
||
Backend/.env | ||
/.idea/* |
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,52 @@ | ||
{ | ||
"info": { | ||
"_postman_id": "ae98b73f-44dc-4aa3-8288-1c9e7ece3b0a", | ||
"name": "The-Message", | ||
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", | ||
"_exporter_id": "11538572" | ||
}, | ||
"item": [ | ||
{ | ||
"name": "InitialGame", | ||
"event": [ | ||
{ | ||
"listen": "test", | ||
"script": { | ||
"exec": [ | ||
"pm.test(\"Status code is 200\", function () {\r", | ||
" pm.response.to.have.status(200);\r", | ||
"});" | ||
], | ||
"type": "text/javascript" | ||
} | ||
} | ||
], | ||
"request": { | ||
"method": "POST", | ||
"header": [], | ||
"body": { | ||
"mode": "raw", | ||
"raw": "{\n \"players\": [{\n \"id\": \"6497f6f226b40d440b9a90cc\",\n \"name\": \"A\"\n }, {\n \"id\": \"6498112b26b40d440b9a90ce\",\n \"name\": \"B\"\n }, {\n \"id\": \"6499df157fed0c21a4fd0425\",\n \"name\": \"C\"\n }]\n}", | ||
"options": { | ||
"raw": { | ||
"language": "json" | ||
} | ||
} | ||
}, | ||
"url": { | ||
"raw": "localhost:8080/api/v1/games", | ||
"host": [ | ||
"localhost" | ||
], | ||
"port": "8080", | ||
"path": [ | ||
"api", | ||
"v1", | ||
"games" | ||
] | ||
} | ||
}, | ||
"response": [] | ||
} | ||
] | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,13 +1,23 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/Game-as-a-Service/The-Message/config" | ||
"github.com/gin-gonic/gin" | ||
"github.com/Game-as-a-Service/The-Message/app/delivery/game" | ||
|
||
http "github.com/Game-as-a-Service/The-Message/service/delivery/http/v1" | ||
mysqlRepo "github.com/Game-as-a-Service/The-Message/service/repository/mysql" | ||
_ "github.com/joho/godotenv/autoload" | ||
) | ||
|
||
func main() { | ||
router := gin.Default() | ||
router.GET("/gameInit", game.GameInit) | ||
db := config.InitDB() | ||
|
||
engine := gin.Default() | ||
|
||
gameRepo := mysqlRepo.NewGameRepository(db) | ||
playerRepo := mysqlRepo.NewPlayerRepository(db) | ||
|
||
http.NewGameHandler(engine, gameRepo, playerRepo) | ||
|
||
router.Run("0.0.0.0:8080") | ||
engine.Run(":8080") | ||
} |
Oops, something went wrong.