From 2bf50bc20587fe685a8ca7cd5096dcfdd044772e Mon Sep 17 00:00:00 2001 From: Kristoffer Dalby Date: Tue, 18 Oct 2022 12:03:51 +0200 Subject: [PATCH] Add new integration tests to ci Signed-off-by: Kristoffer Dalby --- .../workflows/test-integration-v2-general.yml | 40 +++++++++++++++++++ Makefile | 10 +++++ 2 files changed, 50 insertions(+) create mode 100644 .github/workflows/test-integration-v2-general.yml diff --git a/.github/workflows/test-integration-v2-general.yml b/.github/workflows/test-integration-v2-general.yml new file mode 100644 index 00000000..b76cc466 --- /dev/null +++ b/.github/workflows/test-integration-v2-general.yml @@ -0,0 +1,40 @@ +name: CI + +on: [pull_request] + +jobs: + integration-test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 2 + + - name: Set Swap Space + uses: pierotofy/set-swap-space@master + with: + swap-size-gb: 10 + + - name: Get changed files + id: changed-files + uses: tj-actions/changed-files@v14.1 + with: + files: | + *.nix + go.* + **/*.go + integration_test/ + config-example.yaml + + - uses: cachix/install-nix-action@v16 + if: steps.changed-files.outputs.any_changed == 'true' + + - name: Run general integration tests + if: steps.changed-files.outputs.any_changed == 'true' + uses: nick-fields/retry@v2 + with: + timeout_minutes: 240 + max_attempts: 5 + retry_on: error + command: nix develop --command -- make test_integration_v2_general diff --git a/Makefile b/Makefile index c5a2d88c..de890d20 100644 --- a/Makefile +++ b/Makefile @@ -66,6 +66,16 @@ test_integration_oidc: -v /var/run/docker.sock:/var/run/docker.sock golang:1 \ go test -failfast -timeout 30m -count=1 -run IntegrationOIDC ./... +test_integration_v2_general: + docker run \ + -it --rm \ + -v ~/.cache/hs-integration-go:/go \ + --name headscale-test-suite \ + -v $$PWD:$$PWD -w $$PWD \ + -v /var/run/docker.sock:/var/run/docker.sock \ + golang:1 \ + go test ./... -timeout 15m -v + coverprofile_func: go tool cover -func=coverage.out