diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 056f687..bc13f0c 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -4,16 +4,20 @@ on: push: branches: - main + issue_comment: + types: [created, edited] env: REGISTRY: docker.io IMAGE_NAME: spyduck/cluster-api-provider-proxmox + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} jobs: # add public code coverage reports coverage: name: unit test coverage runs-on: ubuntu-latest + if: github.event_name == "push" || contains(github.event.comment.body, "/unit-test") steps: - uses: actions/checkout@master - run: "make unit-test-cover" @@ -23,6 +27,7 @@ jobs: build: name: docker build & push runs-on: ubuntu-latest + if: github.event_name == "push" || contains(github.event.comment.body, "/buid-push") steps: - name: Checkout repository uses: actions/checkout@v4 @@ -33,5 +38,15 @@ jobs: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} + # platform = linux/amd64,linux/arm64 - name: Build and push Docker image - run: "make docker-build docker-push IMG=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${GITHUB_SHA::7}" \ No newline at end of file + run: "make docker-buildx IMG=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${GITHUB_SHA::7}" + + # report result to pr comment if event is pr comment + result: + name: report to pr comment + runs-on: ubunt-latest + if: github.event_name == "issue_comment" && ${{ github.event.issue.pull_request }} + steps: + - run: | + gh pr comment ${{ github.event.issue.number }} -b "[Actions: CI] Check result [here](https://github.com/sp-yduck/cluster-api-provider-proxmox/actions/runs/${{ github.run_number }})" \ No newline at end of file diff --git a/Makefile b/Makefile index edc7c00..a986f95 100644 --- a/Makefile +++ b/Makefile @@ -143,7 +143,7 @@ run: manifests generate fmt vet ## Run a controller from your host. # (i.e. docker build --platform linux/arm64 ). However, you must enable docker buildKit for it. # More info: https://docs.docker.com/develop/develop-images/build_enhancements/ .PHONY: docker-build -docker-build: # test ## Build docker image with the manager. +docker-build: unit-test ## Build docker image with the manager. docker build -t ${IMG} . .PHONY: docker-push @@ -156,9 +156,9 @@ docker-push: ## Push docker image with the manager. # - have enable BuildKit, More info: https://docs.docker.com/develop/develop-images/build_enhancements/ # - be able to push the image for your registry (i.e. if you do not inform a valid value via IMG=> then the export will fail) # To properly provided solutions that supports more than one platform you should use this option. -PLATFORMS ?= linux/arm64,linux/amd64,linux/s390x,linux/ppc64le +PLATFORMS ?= linux/arm64,linux/amd64 #,linux/s390x,linux/ppc64le .PHONY: docker-buildx -docker-buildx: test ## Build and push docker image for the manager for cross-platform support +docker-buildx: ## Build and push docker image for the manager for cross-platform support # copy existing Dockerfile and insert --platform=${BUILDPLATFORM} into Dockerfile.cross, and preserve the original Dockerfile sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' Dockerfile > Dockerfile.cross - docker buildx create --name project-v3-builder