new/unit-tests #1

Merged
jake merged 3 commits from new/unit-tests into main 2025-05-17 15:47:24 +00:00
2 changed files with 40 additions and 1 deletions
Showing only changes of commit 3782a1c863 - Show all commits

View File

@ -1,9 +1,20 @@
name: "donotpassgo"
description: "general go code checks"
inputs:
test:
description: "runs unit tests with specified library"
required: false
default: "none"
runs:
using: "composite"
steps:
- name: "install go packages"
- name: "run unit tests"
shell: bash
run: test.sh
env:
LIBRARY: ${{ inputs.test }}
- name: "install govulncheck"
run: |
go install golang.org/x/vuln/cmd/govulncheck@latest

28
test.sh Normal file
View File

@ -0,0 +1,28 @@
#!/bin/bash
if [[ "$LIBRARY" == "none" ]]; then
echo "Test flag not set, skipping unit tests."
exit 0
fi
if [[ "$LIBRARY" == "standard" ]]; then
echo "Running unit tests with standard library"
if go test ./...; then
echo "Tests passed!"
exit 0
else
echo "Tests failed!"
exit 1
fi
fi
if [[ "$LIBRARY" == "ginkgo" ]]; then
echo "Running unit tests with ginkgo"
go install github.com/onsi/ginkgo/v2/ginkgo@v2.23.4
if ginkgo ./...; then
echo "Tests passed!"
exit 0
else
echo "Tests failed!"
exit 1
fi
fi