From b8afca8243e283faa07dffded724b565199306fd Mon Sep 17 00:00:00 2001 From: phm07 <22707808+phm07@users.noreply.github.com> Date: Wed, 18 Sep 2024 14:40:00 +0200 Subject: [PATCH] ci: separate unit & e2e tests --- .github/workflows/ci.yml | 2 -- .github/workflows/e2e_test.yml | 33 ++++++++++++++++++++++++++++++++ e2e_test/combined_test.go | 2 ++ e2e_test/datacenter_test.go | 2 ++ e2e_test/e2e_test.go | 2 ++ e2e_test/firewall_test.go | 2 ++ e2e_test/floatingip_test.go | 2 ++ e2e_test/network_test.go | 2 ++ e2e_test/placement_group_test.go | 2 ++ e2e_test/server_test.go | 2 ++ 10 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/e2e_test.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e7ca7965..784e341f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,8 +44,6 @@ jobs: with: go-version: "1.23" - - uses: hetznercloud/tps-action@main - - name: Run tests run: go test -coverpkg=./... -coverprofile=coverage.txt -v -race ./... diff --git a/.github/workflows/e2e_test.yml b/.github/workflows/e2e_test.yml new file mode 100644 index 00000000..eec4c56f --- /dev/null +++ b/.github/workflows/e2e_test.yml @@ -0,0 +1,33 @@ +name: E2E Tests + +on: + push: + branches: [main] + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + permissions: + id-token: write + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: "1.23" + + - uses: hetznercloud/tps-action@main + + - name: Run tests + run: go test -tags e2e -coverpkg=./... -coverprofile=coverage.txt -v -race ./e2e_test + + - name: Upload coverage reports to Codecov + if: > + !startsWith(github.head_ref, 'renovate/') && + !startsWith(github.head_ref, 'release-please--') + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/e2e_test/combined_test.go b/e2e_test/combined_test.go index d9c56944..daf52d2b 100644 --- a/e2e_test/combined_test.go +++ b/e2e_test/combined_test.go @@ -1,3 +1,5 @@ +//go:build e2e + package e2e_test import ( diff --git a/e2e_test/datacenter_test.go b/e2e_test/datacenter_test.go index d3dcdf3b..10ba8359 100644 --- a/e2e_test/datacenter_test.go +++ b/e2e_test/datacenter_test.go @@ -1,3 +1,5 @@ +//go:build e2e + package e2e_test import ( diff --git a/e2e_test/e2e_test.go b/e2e_test/e2e_test.go index 34ce59ca..6f16384c 100644 --- a/e2e_test/e2e_test.go +++ b/e2e_test/e2e_test.go @@ -1,3 +1,5 @@ +//go:build e2e + package e2e_test import ( diff --git a/e2e_test/firewall_test.go b/e2e_test/firewall_test.go index 3ac36d99..0420bf3b 100644 --- a/e2e_test/firewall_test.go +++ b/e2e_test/firewall_test.go @@ -1,3 +1,5 @@ +//go:build e2e + package e2e_test import ( diff --git a/e2e_test/floatingip_test.go b/e2e_test/floatingip_test.go index 63dcde24..fc8d89e7 100644 --- a/e2e_test/floatingip_test.go +++ b/e2e_test/floatingip_test.go @@ -1,3 +1,5 @@ +//go:build e2e + package e2e_test import ( diff --git a/e2e_test/network_test.go b/e2e_test/network_test.go index ae0229ed..241b9bc4 100644 --- a/e2e_test/network_test.go +++ b/e2e_test/network_test.go @@ -1,3 +1,5 @@ +//go:build e2e + package e2e_test import ( diff --git a/e2e_test/placement_group_test.go b/e2e_test/placement_group_test.go index 3858f6f8..d98c2d3a 100644 --- a/e2e_test/placement_group_test.go +++ b/e2e_test/placement_group_test.go @@ -1,3 +1,5 @@ +//go:build e2e + package e2e_test import ( diff --git a/e2e_test/server_test.go b/e2e_test/server_test.go index 37e164f8..ab5eedee 100644 --- a/e2e_test/server_test.go +++ b/e2e_test/server_test.go @@ -1,3 +1,5 @@ +//go:build e2e + package e2e_test import (