From 6e69256e2af8d01e0dca5a2a04c72b4eca9c071e Mon Sep 17 00:00:00 2001 From: Damien Grisonnet Date: Mon, 9 Aug 2021 18:24:48 +0200 Subject: [PATCH 1/2] ci: replace travis CI by github actions Signed-off-by: Damien Grisonnet --- .github/workflows/ci.yaml | 58 +++++++++++++++++++++++++++++++++++++++ .travis.yml | 21 -------------- 2 files changed, 58 insertions(+), 21 deletions(-) create mode 100644 .github/workflows/ci.yaml delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 00000000..bb4459d0 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,58 @@ +name: ci +on: + - push + - pull_request +env: + golang-version: '1.15' + kind-version: 'v0.11.1' +jobs: + generate: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + - macos-latest + - ubuntu-latest + name: Generate + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-go@v2 + with: + go-version: ${{ env.golang-version }} + - run: make --always-make generate && git diff --exit-code + unit-tests: + runs-on: ubuntu-latest + name: Unit tests + steps: + - uses: actions/checkout@v2 + - run: make --always-make test + e2e-tests: + name: E2E tests + runs-on: ubuntu-latest + strategy: + matrix: + kind-image: + - 'kindest/node:v1.18.19' + steps: + - uses: actions/checkout@v2 + - name: Start KinD + uses: engineerd/setup-kind@v0.5.0 + with: + version: ${{ env.kind-version }} + image: ${{ matrix.kind-image }} + - name: Wait for cluster to finish bootstraping + run: | + until [ "$(kubectl get pods --all-namespaces --no-headers | grep -cEv '([0-9]+)/\1')" -eq 0 ]; do + sleep 5s + done + kubectl cluster-info + kubectl get pods -A + - name: Create kube-prometheus stack + run: | + kubectl create -f manifests/setup + until kubectl get servicemonitors --all-namespaces ; do date; sleep 1; echo ""; done + kubectl create -f manifests/ + - name: Run tests + run: | + export KUBECONFIG="${HOME}/.kube/config" + make test-e2e diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 67340358..00000000 --- a/.travis.yml +++ /dev/null @@ -1,21 +0,0 @@ -sudo: required -dist: xenial -language: go - -go: -- "1.13.x" -go_import_path: github.com/coreos/kube-prometheus - -cache: - directories: - - $GOCACHE - - $GOPATH/pkg/mod - -jobs: - include: - - name: Check generated files - script: make --always-make generate && git diff --exit-code - - name: Run tests - script: make --always-make test - - name: Run e2e tests - script: ./tests/e2e/travis-e2e.sh From 1dcc2116e9b1768a187407e2292f2e496924d515 Mon Sep 17 00:00:00 2001 From: Philip Gough Date: Mon, 5 Jul 2021 09:56:28 +0100 Subject: [PATCH 2/2] ci: Harden action to wait for kind cluster readiness --- .github/workflows/ci.yaml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index bb4459d0..e92d58b2 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -40,13 +40,9 @@ jobs: with: version: ${{ env.kind-version }} image: ${{ matrix.kind-image }} + wait: 300s - name: Wait for cluster to finish bootstraping - run: | - until [ "$(kubectl get pods --all-namespaces --no-headers | grep -cEv '([0-9]+)/\1')" -eq 0 ]; do - sleep 5s - done - kubectl cluster-info - kubectl get pods -A + run: kubectl wait --for=condition=Ready pods --all --all-namespaces --timeout=300s - name: Create kube-prometheus stack run: | kubectl create -f manifests/setup