From f244e28121ff96adc090332b8662540dd01bc1e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damien=20Pl=C3=A9nard?= Date: Thu, 27 Jun 2024 22:55:18 +0200 Subject: [PATCH 1/5] ci: remove unused platforms to reduce build time --- .promu.yml | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/.promu.yml b/.promu.yml index 58890dd..4574c08 100644 --- a/.promu.yml +++ b/.promu.yml @@ -21,24 +21,6 @@ crossbuild: - linux/amd64 - linux/386 - darwin/amd64 - - darwin/386 - darwin/arm64 - - windows/amd64 - - windows/386 - - freebsd/amd64 - - freebsd/386 - - openbsd/amd64 - - openbsd/386 - - netbsd/amd64 - - netbsd/386 - - dragonfly/amd64 - linux/arm - linux/arm64 - - freebsd/arm - - openbsd/arm - - netbsd/arm - - linux/ppc64 - - linux/ppc64le - - linux/mips64 - - linux/mips64le - - linux/s390x From 65194bfd13a0185254eb9099f72745d4811a11b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damien=20Pl=C3=A9nard?= Date: Thu, 27 Jun 2024 22:51:14 +0200 Subject: [PATCH 2/5] ci: crossbuild on Github Actions instead of CircleCI --- .github/workflows/publish.yml | 47 +++++++++++++++++++++++++++++++++++ .github/workflows/release.yml | 42 +++++++++++++++++++++++++++++++ 2 files changed, 89 insertions(+) create mode 100644 .github/workflows/publish.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..7575ef8 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,47 @@ +--- +name: Publish +on: + push: + branches: + - main + release: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4.1.6 + - uses: actions/setup-go@v5 + with: + go-version: '^1.22.2' + - run: make promu + - run: promu crossbuild -v + - name: Store binaries artifacts + uses: actions/upload-artifact@v4 + with: + name: build + path: .build + + publish: + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4.1.6 + - name: Download binaries artifacts + uses: actions/download-artifact@v4 + with: + name: build + path: .build + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - run: make docker DOCKER_IMAGE_TAG="${{ github.ref_name }}" + - run: make docker-publish DOCKER_IMAGE_TAG="${{ github.ref_name }}" + - run: make docker-manifest DOCKER_IMAGE_TAG="${{ github.ref_name }}" + - if: startsWith(github.ref, 'refs/tags/v') + run: | + make docker-tag-latest DOCKER_IMAGE_TAG="${{ github.ref_name }}" + make docker-publish DOCKER_IMAGE_TAG="latest" + make docker-manifest DOCKER_IMAGE_TAG="latest" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..be39c3e --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,42 @@ +--- +name: Release +on: + push: + branches: + - main + - use-gha + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4.1.6 + - uses: actions/setup-go@v5 + with: + go-version: '^1.22.2' + - run: make promu + - run: promu crossbuild -v + - name: Store binaries artifacts + uses: actions/upload-artifact@v4 + with: + name: build + path: .build + + publish: + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4.1.6 + - name: Download binaries artifacts + uses: actions/download-artifact@v4 + with: + name: build + path: .build + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - run: make docker DOCKER_REPO=docker.io/damoun + - run: make docker-publish DOCKER_REPO=docker.io/damoun + - run: make docker-manifest DOCKER_REPO=docker.io/damoun From b513bbf4a3607b0ecd2f668d7c3c9acd6b27c9f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damien=20Pl=C3=A9nard?= Date: Thu, 27 Jun 2024 23:41:27 +0200 Subject: [PATCH 3/5] ci: build on new pull request to main --- .github/workflows/build.yml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..829e761 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,34 @@ +--- +name: Build +on: + pull_request: + branches: + - main + +jobs: + golang: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4.1.6 + - uses: actions/setup-go@v5 + with: + go-version: '^1.22.2' + - run: make promu + - run: promu crossbuild -v + - name: Store binaries + uses: actions/upload-artifact@v4 + with: + name: build + path: .build + + docker: + needs: golang + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4.1.6 + - name: Download binaries artifacts + uses: actions/download-artifact@v4 + with: + name: build + path: .build + - run: make docker From f309893536b314e55f68d0cce6b7163e5e5c89d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damien=20Pl=C3=A9nard?= Date: Thu, 27 Jun 2024 23:42:09 +0200 Subject: [PATCH 4/5] ci: remove CircleCI config --- .circleci/config.yml | 178 ------------------------------------------- 1 file changed, 178 deletions(-) delete mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index c2c8719..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,178 +0,0 @@ ---- -version: 2.1 - -executors: - golang: - description: > - Golang container executor - parameters: - version: - description: Go version - type: string - resource_class: - description: Resource class - type: string - - resource_class: << parameters.resource_class >> - docker: - - image: circleci/golang:<< parameters.version >> - -commands: - setup_environment: - description: > - Setup the minimal environment for the CI. - steps: - - checkout - - run: make promu - - setup_build_environment: - description: > - Setup the environment for building the container images. - steps: - - setup_environment - - setup_remote_docker: - version: 18.06.0-ce - - run: docker run --privileged linuxkit/binfmt:v0.6 - - attach_workspace: - at: . - - publish_images: - description: > - Build and publish images to a container image registry. - parameters: - registry: - description: Registry address - type: string - organization: - description: Registry organization - type: string - login_variable: - description: Environment variable holding the registry login - type: env_var_name - password_variable: - description: Environment variable holding the registry password - type: env_var_name - - steps: - - run: make docker DOCKER_REPO=<< parameters.registry >>/<< parameters.organization >> - - run: docker images - - run: docker login -u $<< parameters.login_variable >> -p $<< parameters.password_variable >> << parameters.registry >> - - run: make docker-publish DOCKER_REPO=<< parameters.registry >>/<< parameters.organization >> - - run: make docker-manifest DOCKER_REPO=<< parameters.registry >>/<< parameters.organization >> - - store_artifact: - description: > - Store a file as a build artifact. - parameters: - file: - description: source file - type: string - directory: - description: destination directory - type: string - default: /build - - steps: - - store_artifacts: - path: << parameters.file >> - destination: << parameters.directory >>/<< parameters.file >> - - run: rm -v << parameters.file >> - - publish_release_images: - description: > - Build and publish release images to a container image registry. - parameters: - registry: - description: Registry address - type: string - organization: - description: Registry organization - type: string - login_variable: - description: Environment variable holding the registry login - type: env_var_name - password_variable: - description: Environment variable holding the registry password - type: env_var_name - - steps: - - run: make docker DOCKER_IMAGE_TAG="$CIRCLE_TAG" DOCKER_REPO=<< parameters.registry >>/<< parameters.organization >> - - run: docker images - - run: docker login -u $<< parameters.login_variable >> -p $<< parameters.password_variable >> << parameters.registry >> - - run: make docker-publish DOCKER_IMAGE_TAG="$CIRCLE_TAG" DOCKER_REPO=<< parameters.registry >>/<< parameters.organization >> - - run: make docker-manifest DOCKER_IMAGE_TAG="$CIRCLE_TAG" DOCKER_REPO=<< parameters.registry >>/<< parameters.organization >> - - run: | - if [[ "$CIRCLE_TAG" =~ ^v[0-9]+(\.[0-9]+){2}$ ]]; then - make docker-tag-latest DOCKER_IMAGE_TAG="$CIRCLE_TAG" DOCKER_REPO=<< parameters.registry >>/<< parameters.organization >> - make docker-publish DOCKER_IMAGE_TAG="latest" DOCKER_REPO=<< parameters.registry >>/<< parameters.organization >> - make docker-manifest DOCKER_IMAGE_TAG="latest" DOCKER_REPO=<< parameters.registry >>/<< parameters.organization >> - fi - -jobs: - build: - machine: - enabled: true - - steps: - - setup_environment - - run: promu crossbuild -v - - persist_to_workspace: - root: . - paths: - - .build - - store_artifacts: - path: .build - destination: /build - - publish_master: - docker: - - image: circleci/golang - - steps: - - setup_build_environment - - publish_images: - registry: docker.io - organization: damoun - login_variable: DOCKER_LOGIN - password_variable: DOCKER_PASSWORD - - publish_release: - docker: - - image: circleci/golang - - steps: - - setup_build_environment - - run: promu crossbuild tarballs - - run: promu checksum .tarballs - - run: promu release .tarballs - - store_artifacts: - path: .tarballs - destination: releases - - publish_release_images: - registry: docker.io - organization: damoun - login_variable: DOCKER_LOGIN - password_variable: DOCKER_PASSWORD - -workflows: - version: 2 - prometheus: - jobs: - - build: - filters: - tags: - only: /.*/ - - publish_master: - requires: - - build - filters: - branches: - only: master - - publish_release: - requires: - - build - filters: - tags: - only: /^v[0-9]+(\.[0-9]+){2}(-.+|[^-.]*)$/ - branches: - ignore: /.*/ From a20feb378f2c5aae0b4706ef6a89f97a0c6000ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damien=20Pl=C3=A9nard?= Date: Thu, 27 Jun 2024 23:46:00 +0200 Subject: [PATCH 5/5] ci: remove release GHA workflows --- .github/workflows/release.yml | 42 ----------------------------------- 1 file changed, 42 deletions(-) delete mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index be39c3e..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,42 +0,0 @@ ---- -name: Release -on: - push: - branches: - - main - - use-gha - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4.1.6 - - uses: actions/setup-go@v5 - with: - go-version: '^1.22.2' - - run: make promu - - run: promu crossbuild -v - - name: Store binaries artifacts - uses: actions/upload-artifact@v4 - with: - name: build - path: .build - - publish: - needs: build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4.1.6 - - name: Download binaries artifacts - uses: actions/download-artifact@v4 - with: - name: build - path: .build - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - run: make docker DOCKER_REPO=docker.io/damoun - - run: make docker-publish DOCKER_REPO=docker.io/damoun - - run: make docker-manifest DOCKER_REPO=docker.io/damoun