Skip to content

Typed attributes

Typed attributes #670

Workflow file for this run

# This workflow will build the golang project, create a Mongo database and test it
name: 🕵️‍♂️ API Unit Tests
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
paths:
- API/**
jobs:
api-unit-test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./API
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.21
- name: Install gotestsum
run: go install gotest.tools/gotestsum@latest
- name: Create MongoDB Container
run: cd ../deploy/docker && make test_api
- name: Build
run: make
- name: Test
run: gotestsum --junitfile tests-api.xml -- -coverpkg=./... -coverprofile=coverage_api.out -p 1 ./...
- name: Log Test Coverage
run: go tool cover -func coverage_api.out | grep total
- name: Test Report
uses: dorny/test-reporter@v1
if: always() # run this step even if previous steps failed
with:
name: API Tests Report # Name of the check run which will be created
path: ./API/tests-api.xml # Path to test results
reporter: java-junit # Format of test results
- uses: actions/upload-artifact@v3
with:
name: coverage
path: ./API/coverage_api.out