From a0fc4e8fe908ecb67c9b121beaaa32e53524cc01 Mon Sep 17 00:00:00 2001 From: Bastian Krol Date: Wed, 15 May 2024 06:46:44 +0200 Subject: [PATCH] ci: add github action --- .github/workflows/verify.yaml | 69 +++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 .github/workflows/verify.yaml diff --git a/.github/workflows/verify.yaml b/.github/workflows/verify.yaml new file mode 100644 index 00000000..8f7ac6ea --- /dev/null +++ b/.github/workflows/verify.yaml @@ -0,0 +1,69 @@ +name: verify + +on: + push: + branches: + - 'main' + tags: + - 'v*' + pull_request: + workflow_dispatch: + +jobs: + verify: + runs-on: ubuntu-latest + name: Build & Test + + steps: + - uses: actions/checkout@v4 + with: + submodules: true + + - uses: actions/setup-go@v5 + with: + go-version: ~1.22 + cache: true + + - name: go version + run: | + go version + + - name: build + run: | + make + + - name: verify that generated code is up-to-date + run: | + # make (which we ran in the previous step) will implicitly also run the targets manifests & generate, which + # could potentially modify code that is under version control, if changes have been comitted that would have + # required updating manifests or generated code and these updates have not been done. + git diff --exit-code + + - name: lint + run: | + make lint + + - name: test + run: | + make test + + # Instead of running make docker-build, we run docker build via a dedicated action, which enables Docker layer + # caching. + - uses: docker/setup-buildx-action@v3 + # - uses: docker/login-action@v3 + # with: + # username: ${{ secrets.DOCKERHUB_USERNAME }} + # password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: build container image + uses: docker/build-push-action@v5 + with: + context: . + push: false + tags: dash0-operator-controller:latest + cache-from: type=gha + cache-to: type=gha,mode=max + + # TODO look into https://github.com/helm/kind-action and run e2e test in GH action + # - name: end-to-end test + # run: | + # make test-e2e \ No newline at end of file