open-vault/.github/workflows/test-run-go-tests-for-path.yml

33 lines
1.1 KiB
YAML
Raw Normal View History

name: test-run-go-tests-for-path
on:
workflow_call:
inputs:
name:
description: 'The name to use that will appear in the output log file artifact'
required: true
type: string
path:
description: 'The path to the test without the precedeing "./" or following "/..." e.g. go test -v ./$path/...'
required: true
type: string
# We will need to add the capacity for receiving passed secrets once we get to the tests that require API credentials
jobs:
go-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- id: get-metadata
run: echo "go-version=$(cat ./.go-version)" >> $GITHUB_OUTPUT
- name: Set Up Go
uses: actions/setup-go@v3
with:
go-version: ${{ steps.get-metadata.outputs.go-version }}
- run: go test -v ./${{ inputs.path }}/... 2>&1 | tee ${{ inputs.name }}.txt
- uses: actions/upload-artifact@v3
with:
name: ${{ inputs.name }}-output
path: ${{ inputs.name }}.txt
retention-days: 2