From 91a7491dcb3974f41315f19f4810d9e474a0be4b Mon Sep 17 00:00:00 2001 From: Friedrich Wilken Date: Wed, 17 Jan 2024 13:20:21 +0100 Subject: [PATCH] add a reusable unit test github action workflow --- .github/workflows/unit-test-reusable.yml | 26 ++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/workflows/unit-test-reusable.yml diff --git a/.github/workflows/unit-test-reusable.yml b/.github/workflows/unit-test-reusable.yml new file mode 100644 index 0000000..79276f7 --- /dev/null +++ b/.github/workflows/unit-test-reusable.yml @@ -0,0 +1,26 @@ +# This workflow defines a reusable Go unit test flow, that relies on the existence of the make target "test". + +name: Unit Test (reusable) + +on: + workflow_call: + +jobs: + unit: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version-file: "go.mod" # This uses the Go version defined in the mod file, in contrast to setting a defined version. + + - name: Sync Go dependencies + run: | + go mod vendor + + - name: Run tests + run: | + make test