Skip to content

Feat: Added api for transmit intelligence card by #95 #101

Feat: Added api for transmit intelligence card by #95

Feat: Added api for transmit intelligence card by #95 #101

Workflow file for this run

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: Install dependencies
working-directory: ./Backend
run: |
go mod tidy
go mod download
go mod vendor
- 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
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: Wait for MySQL
run: |
wget https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh
chmod +x wait-for-it.sh
./wait-for-it.sh 127.0.0.1:3306 --timeout=60
- name: Migration
working-directory: ./Backend
run: |
go run ./cmd/migrate/migrate.go
go run ./cmd/migrate/game_card_seeder.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