63 lines
1.3 KiB
YAML
63 lines
1.3 KiB
YAML
image: docker:latest
|
|
|
|
# Define the GitLab CI/CD pipeline
|
|
stages:
|
|
- build
|
|
- test
|
|
|
|
variables:
|
|
POSTGRES_DB: test
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_PASSWORD: ""
|
|
POSTGRES_HOST_AUTH_METHOD: trust
|
|
|
|
# Define the job for building the Go backend application
|
|
backend:
|
|
stage: build
|
|
image: golang:1.17.4-alpine3.14
|
|
script:
|
|
- cd src/backend/cmd
|
|
- go mod download
|
|
- go build -o app
|
|
|
|
frontend:
|
|
stage: build
|
|
image: mcr.microsoft.com/dotnet/sdk:6.0
|
|
script:
|
|
- cd src/PanoptesFrontend
|
|
- dotnet build
|
|
|
|
# Define the job for running the tests
|
|
backend-test:
|
|
stage: test
|
|
image: golang:1.17.4-alpine3.14
|
|
services:
|
|
- postgres:latest
|
|
variables:
|
|
Host: postgres
|
|
User: $POSTGRES_USER
|
|
Password: $POSTGRES_PASSWORD
|
|
Database: $POSTGRES_DB
|
|
POSTGRES_HOST_AUTH_METHOD: trust
|
|
before_script:
|
|
- apk add --no-cache postgresql-client
|
|
- apk add --no-cache gcc musl-dev
|
|
- psql -U "$POSTGRES_USER" -h postgres < ./src/init.sql
|
|
- cd src/backend
|
|
- go mod download
|
|
# set env variables
|
|
- export DB_USER=$POSTGRES_USER
|
|
- export DB_PASSWORD=$POSTGRES_PASSWORD
|
|
- export DB_NAME=$POSTGRES_DB
|
|
script:
|
|
- go test -v ./...
|
|
|
|
frontend-test:
|
|
stage: test
|
|
image: mcr.microsoft.com/dotnet/sdk:6.0
|
|
before_script:
|
|
- cd src/PanoptesTest
|
|
- dotnet restore
|
|
script:
|
|
- dotnet test
|