-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Thanh Nguyen
committed
Nov 23, 2022
1 parent
b029564
commit 2fdf556
Showing
8 changed files
with
262 additions
and
23 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
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 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 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 |
---|---|---|
|
@@ -14,4 +14,3 @@ git commit -m "$1" | |
git tag -f -a "$1" -m "$1" | ||
git push origin "$1" -f | ||
git push | ||
|
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,223 @@ | ||
name: myapp | ||
|
||
on: | ||
push: | ||
branches-ignore: [ 'azure-pipelines' ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
env: | ||
FE_ROOT: './fe-gui' | ||
BE_ROOT: './be-api' | ||
BE_GO_TEST_PATH: './src/gvabe/bov2/user ./src/gvabe/bov2/blog' | ||
|
||
jobs: | ||
testWithDynamoDb: | ||
name: Test with AWS DynamoDB | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Go env | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: "1.17" | ||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
- name: Start AWS DynamoDB server | ||
run: docker run -d --name dynamodb -p 8000:8000 amazon/dynamodb-local -jar DynamoDBLocal.jar -inMemory -sharedDb | ||
- name: Test | ||
run: | | ||
export TIMEZONE="Asia/Ho_Chi_Minh" | ||
export AWS_REGION="us-west-2" | ||
export AWS_ACCESS_KEY_ID="DUMMY" | ||
export AWS_SECRET_ACCESS_KEY="DUMMY" | ||
export AWS_DYNAMODB_ENDPOINT="http://localhost:8000" | ||
cd $BE_ROOT | ||
go test -v -count 1 -p 1 -cover -coverprofile=coverage_dynamodb.txt $BE_GO_TEST_PATH | ||
- name: Codecov | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
flags: dynamodb | ||
name: dynamodb | ||
|
||
testWithMongoStandalone: | ||
name: Test with MongoDB (Standalone) | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Go env | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: "1.17" | ||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
- name: Start MongoDB Standalone server | ||
run: docker run -d --name mongodb -e MONGO_INITDB_ROOT_USERNAME=test -e MONGO_INITDB_ROOT_PASSWORD=test -e MONGO_INITDB_DATABASE=test -p 27017:27017 mongo:4.2 | ||
- name: Test | ||
run: | | ||
export TIMEZONE="Asia/Ho_Chi_Minh" | ||
export MONGO_DB="test" | ||
export MONGO_URL="mongodb://test:test@localhost:27017/?authSource=admin" | ||
cd $BE_ROOT | ||
go test -v -count 1 -p 1 -cover -coverprofile=coverage_mongo_standalone.txt $BE_GO_TEST_PATH | ||
- name: Codecov | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
flags: mongo_standalone | ||
name: mongo_standalone | ||
|
||
testWithMongoReplicaSet: | ||
name: Test with MongoDB (ReplicaSet) | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Go env | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: "1.17" | ||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
- name: Start MongoDB Standalone server | ||
run: docker run -d --name mongodb-replset -e MONGODB_REPLICA_SET_MODE=primary -e MONGODB_REPLICA_SET_KEY=myreplset -e MONGODB_ADVERTISED_HOSTNAME=localhost -e MONGODB_PRIMARY_PORT_NUMBER=27017 -e MONGODB_ROOT_PASSWORD=test -e MONGODB_DATABASE=test -p 27017:27017 bitnami/mongodb:4.2 | ||
- name: Test | ||
run: | | ||
export TIMEZONE="Asia/Ho_Chi_Minh" | ||
export MONGO_DB="test" | ||
export MONGO_URL="mongodb://root:test@localhost:27017/?authSource=admin&replicaSet=replicaset" | ||
cd $BE_ROOT | ||
go test -v -count 1 -p 1 -cover -coverprofile=coverage_mongo_replicaset.txt $BE_GO_TEST_PATH | ||
- name: Codecov | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
flags: mongo_replicaset | ||
name: mongo_replicaset | ||
|
||
testWithMySQL: | ||
name: Test with MySQL | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Go env | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: "1.17" | ||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
- name: Start MySQL server | ||
run: docker run -d --name mysql -e MYSQL_ROOT_PASSWORD=test -e MYSQL_DATABASE=test -e MYSQL_USER=test -e MYSQL_PASSWORD=test -p 3306:3306 mysql:8 | ||
- name: Test (parseTime=false) | ||
run: | | ||
export TIMEZONE="Asia/Ho_Chi_Minh" | ||
export MYSQL_DRIVER="mysql" | ||
export MYSQL_URL="test:test@tcp(localhost:3306)/test?charset=utf8mb4,utf8&parseTime=false&loc=\${loc}" | ||
cd $BE_ROOT | ||
go test -v -count 1 -p 1 -cover -coverprofile=coverage_mysql.txt $BE_GO_TEST_PATH | ||
- name: Test (parseTime=true) | ||
run: | | ||
export TIMEZONE="Asia/Ho_Chi_Minh" | ||
export MYSQL_DRIVER="mysql" | ||
export MYSQL_URL="test:test@tcp(localhost:3306)/test?charset=utf8mb4,utf8&parseTime=true&loc=\${loc}" | ||
cd $BE_ROOT | ||
go test -v -count 1 -p 1 -cover -coverprofile=coverage_mysql_parsetime.txt $BE_GO_TEST_PATH | ||
- name: Codecov | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
flags: mysql | ||
name: mysql | ||
|
||
testWithPostgreSQL: | ||
name: Test with PostgreSQL | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Go env | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: "1.17" | ||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
- name: Start PostgreSQL server | ||
run: docker run -d --name postgres -e POSTGRES_DB=test -e POSTGRES_USER=test -e POSTGRES_PASSWORD=test -p 5432:5432 postgres:11 | ||
- name: Test | ||
run: | | ||
export TIMEZONE="Asia/Ho_Chi_Minh" | ||
export PGSQL_DRIVER="pgx" | ||
export PGSQL_URL="postgres://test:test@localhost:5432/test?sslmode=disable&client_encoding=UTF-8&application_name=godal" | ||
cd $BE_ROOT | ||
go test -v -count 1 -p 1 -cover -coverprofile=coverage_pgsql.txt $BE_GO_TEST_PATH | ||
- name: Codecov | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
flags: pgsql | ||
name: pgsql | ||
|
||
testWithSqlite: | ||
name: Test with SQLite | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Go env | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: "1.17" | ||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
- name: Test | ||
run: | | ||
export TIMEZONE="Asia/Ho_Chi_Minh" | ||
cd $BE_ROOT | ||
mkdir -p ./temp | ||
export SQLITE_DRIVER="sqlite3" | ||
export SQLITE_URL="$(pwd)/temp/temp.db" | ||
go test -v -count 1 -p 1 -cover -coverprofile=coverage_sqlite.txt $BE_GO_TEST_PATH | ||
- name: Codecov | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
flags: sqlite | ||
name: sqlite | ||
|
||
testWithCosmosDbSql: | ||
name: Test with Azure Cosmos DB (SQL API) | ||
runs-on: windows-latest | ||
steps: | ||
- name: Set up Go env | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: "1.17" | ||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
- name: Test | ||
run: | | ||
choco install azure-cosmosdb-emulator | ||
& "C:\Program Files\Azure Cosmos DB Emulator\Microsoft.Azure.Cosmos.Emulator.exe" | ||
Start-Sleep -s 120 | ||
try { Invoke-RestMethod -Method GET https://127.0.0.1:8081/ } catch {} | ||
netstat -nt | ||
$env:COSMOSDB_DRIVER='gocosmos' | ||
$env:COSMOSDB_URL='AccountEndpoint=https://127.0.0.1:8081/;AccountKey=C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==' | ||
$env:TIMEZONE='Asia/Ho_Chi_Minh' | ||
cd $env:BE_ROOT | ||
go test -v -count 1 -p 1 -cover -coverprofile="coverage_cosmosdb_sql.txt" ./src/gvabe/bov2/user ./src/gvabe/bov2/blog | ||
- name: Codecov | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
flags: cosmosdb_sql | ||
name: cosmosdb_sql | ||
|
||
testDockerBuild: | ||
name: Test with Docker build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Go env | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: "1.17" | ||
- name: Set up NodeJS env | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: "12" | ||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
- name: Build FE | ||
run: | | ||
cd $GITHUB_WORKSPACE/fe-gui && npm install && npm run build | ||
- name: Build BE | ||
run: | | ||
cd $GITHUB_WORKSPACE/be-api && go build -tags netgo -a | ||
- name: Build Docker image | ||
run: | | ||
cd $GITHUB_WORKSPACE && docker build -t 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,16 @@ | ||
#!/bin/sh | ||
|
||
## Utility script to release project with a tag | ||
## Usage: | ||
## ./release.sh <tag-name> | ||
|
||
if [ "$1" == "" ]; then | ||
echo "Usage: $0 tag-name" | ||
exit -1 | ||
fi | ||
|
||
echo "$1" | ||
git commit -m "$1" | ||
git tag -f -a "$1" -m "$1" | ||
git push origin "$1" -f | ||
git push |