From 747c856f9294256827670b15b86667ae3851b12a Mon Sep 17 00:00:00 2001 From: shreddedbacon Date: Tue, 30 Apr 2024 09:21:28 +1000 Subject: [PATCH] test: add gh action --- .github/workflows/test-suite.yaml | 61 +++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 .github/workflows/test-suite.yaml diff --git a/.github/workflows/test-suite.yaml b/.github/workflows/test-suite.yaml new file mode 100644 index 0000000..d50641d --- /dev/null +++ b/.github/workflows/test-suite.yaml @@ -0,0 +1,61 @@ +name: Lagoon tests + +on: pull_request + +jobs: + # runs for lagoon-core, lagoon-remote, lagoon-test + test-suite: + runs-on: ubuntu-latest + strategy: + fail-fast: false + + steps: + # Continue after getting a shell via: `touch continue` + - name: Setup tmate session + uses: mxschmitt/action-tmate@v3 + timeout-minutes: 1 + continue-on-error: true + + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: "0" + + - name: Configure kind network + if: | + (contains(github.event.pull_request.labels.*.name, 'needs-testing')) + run: | + docker network create kind + + - name: Create kind cluster + uses: helm/kind-action@v1.9.0 + if: | + (contains(github.event.pull_request.labels.*.name, 'needs-testing')) + with: + version: v0.22.0 + node_image: kindest/node:v1.28.7@sha256:9bc6c451a289cf96ad0bbaf33d416901de6fd632415b076ab05f5fa7e4f65c58 + kubectl_version: v1.28.7 + + + - name: Install gojq + if: | + (steps.list-changed.outputs.changed == 'true') || + (contains(github.event.pull_request.labels.*.name, 'needs-testing')) + run: | + cd /tmp + curl -sSLO https://github.com/itchyny/gojq/releases/download/v0.12.13/gojq_v0.12.13_linux_amd64.tar.gz + tar -xf ./gojq_v0.12.13_linux_amd64.tar.gz + sudo cp /tmp/gojq_v0.12.13_linux_amd64/gojq /usr/local/bin/jq + + - name: Install kubens and kubectl alias + run: | + cd /tmp + curl -sSLO https://github.com/ahmetb/kubectx/releases/download/v0.9.5/kubens_v0.9.5_linux_x86_64.tar.gz + tar -xf ./kubens_v0.9.5_linux_x86_64.tar.gz + sudo cp /tmp/kubens /usr/local/bin/kubens + sudo ln -s $(which kubectl) /usr/local/bin/kc + + - name: Run test-e2e + if: | + (contains(github.event.pull_request.labels.*.name, 'needs-testing')) + run: make test-e2e