Skip to content

Preview updates by email #250

Preview updates by email

Preview updates by email #250

Workflow file for this run

name: Build, run all tests
on:
push:
branches:
- main
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Get the version
id: get_version
run: echo ::set-output name=tag::$(echo ${GITHUB_SHA:8})
- name: Set up Go
uses: actions/[email protected]
with:
go-version: ^1.23
id: go
- name: Check out code
uses: actions/checkout@v4
- name: Get and verify dependencies
run: go mod download && go mod verify
- name: Build app to make sure there are zero issues
run: go build -o malak
- name: Install swag
run: go install github.com/swaggo/swag/cmd/swag@latest
- name: Install mockgen
run: go install go.uber.org/mock/mockgen@latest
- name: Run go generate
run: go generate ./...
- name: Check for uncommitted changes
run: |
## binary from the go build step
rm malak
if [[ -n $(git status --porcelain) ]]; then
echo "There are uncommitted changes after running 'go generate':"
echo "Run go generate ./... locally then commit again"
git status
git diff
exit 1
else
echo "No changes detected after running 'go generate'"
fi
- name: Run tests with coverage
## skip generated files, tools/ folder which is really just a bunch of scripts. Also skips package main
run: go test $(go list ./... | grep -v -E '/(mocks|tools|swagger|cmd|deployment)/') -v -tags integration -coverprofile=coverage.txt -covermode=atomic
- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.txt
fail_ci_if_error: true