From 5634c088aee328eb2629951ddf8f681c0dc25361 Mon Sep 17 00:00:00 2001 From: Pierre-Henri Symoneaux Date: Mon, 18 Nov 2024 18:15:27 +0100 Subject: [PATCH] test: call venom tests in github-action CI Signed-off-by: Pierre-Henri Symoneaux --- .github/workflows/tests.yaml | 51 ++++++++++++++++++++++++++++++++++++ tests/Makefile | 6 +++++ 2 files changed, 57 insertions(+) create mode 100644 .github/workflows/tests.yaml create mode 100644 tests/Makefile diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml new file mode 100644 index 0000000..2169c7b --- /dev/null +++ b/.github/workflows/tests.yaml @@ -0,0 +1,51 @@ +name: test + +on: + push: + branches: ["main"] + pull_request: + branches: ["main"] + workflow_call: {} + + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/setup-build-env + - run: go build -cover ./cmd/okms + - name: Setup Venom + run: | + wget https://github.com/ovh/venom/releases/download/v1.2.0/venom.linux-amd64 + mv venom.linux-amd64 venom + chmod +x venom + - run: | + echo "${{secrets.CERTIFICATE}}" > tls.crt + echo "${{secrets.PRIVATE_KEY}}" > tls.key + + cat > okms.yaml <<-EOF + version: 1 + profile: default + profiles: + default: # default profile + http: + endpoint: ${{secrets.KMS_HTTP_ENDPOINT}} + auth: + type: mtls + cert: $(pwd)/tls.crt + key: $(pwd)/tls.key + EOF + - run: ./okms keys ls -d -c okms.yaml + continue-on-error: true + - name: Execute tests + run: make -C tests + - uses: actions/upload-artifact@v4 + with: + name: test_results + path: | + ./tests/out/test_results.html + ./tests/out/venom.log + retention-days: 5 + if: always() + \ No newline at end of file diff --git a/tests/Makefile b/tests/Makefile new file mode 100644 index 0000000..0424e2d --- /dev/null +++ b/tests/Makefile @@ -0,0 +1,6 @@ +test: + rm -Rf out + ../venom run --html-report --output-dir=out --var-from-file cfg/vars.yaml -vv . + go tool covdata percent -i out/coverage + go tool covdata textfmt -i out/coverage -o out/coverage.txt + go tool cover -html out/coverage.txt -o out/coverage.html \ No newline at end of file