Skip to content

[merge] pull request #13 from akrck02/dependabot/go_modules/golang.or… #35

[merge] pull request #13 from akrck02/dependabot/go_modules/golang.or…

[merge] pull request #13 from akrck02/dependabot/go_modules/golang.or… #35

Workflow file for this run

# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
name: testing
on:
[push,pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
# Get values for cache paths to be used in later steps
- id: go-cache-paths
run: |
echo "::set-output name=go-build::$(go env GOCACHE)"
echo "::set-output name=go-mod::$(go env GOMODCACHE)"
- name: Checkout
uses: actions/checkout@v3
# Cache go build cache, used to speedup go test
- name: Go Build Cache
uses: actions/cache@v2
with:
path: ${{ steps.go-cache-paths.outputs.go-build }}
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
# Cache go mod cache, used to speedup builds
- name: Go Mod Cache
uses: actions/cache@v2
with:
path: ${{ steps.go-cache-paths.outputs.go-mod }}
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
- uses: actions/setup-go@v3
with:
go-version: 1.21.8
cache-dependency-path: api/go.sum
# In this step, this action saves a list of existing images,
# the cache is created without them in the post run.
# It also restores the cache if it exists.
- uses: satackey/[email protected]
# Ignore the failure of a step and avoid terminating the job.
continue-on-error: true
- name: Set database running
uses: supercharge/[email protected]
with:
mongodb-username: admin
mongodb-password: p4ssw0rd
mongodb-db: valhalla-test
mongodb-port: 27017
- name: Create env file
run: echo "IP=127.0.0.1 \n PORT=3333 \n SECRET=secret \n GIN_MODE=release \n IP_MONGODB=172.0.0.1" > .env
- name: Run tests
run: go test -v ./...