From 3d3c9df5802d01c66862c4ca10f5f2b993f05098 Mon Sep 17 00:00:00 2001 From: Igor Zibarev Date: Wed, 24 Aug 2022 01:48:20 +0300 Subject: [PATCH] ci: move release & test-install to Github Actions --- .circleci/config.yml | 74 --------------------- .github/workflows/main.yml | 8 +++ .github/workflows/release.yml | 13 ++++ .github/workflows/reusable-test-install.yml | 36 ++++++++++ 4 files changed, 57 insertions(+), 74 deletions(-) delete mode 100644 .circleci/config.yml create mode 100644 .github/workflows/reusable-test-install.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 479a971c..00000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,74 +0,0 @@ -# CircleCI configuration file -# Ref: https://circleci.com/docs/2.0/configuration-reference/ -version: 2.1 - -jobs: - dep: - docker: - - image: cimg/go:1.19 - environment: {} - steps: - - checkout - - run: make deps - - persist_to_workspace: - root: . - paths: - - vendor - test-install: - docker: - - image: circleci/buildpack-deps:stretch-curl - working_directory: /tmp - steps: - - run: - name: Install helm - command: | - tar_filename="helm-v3.9.3-linux-amd64.tar.gz" - checksum_filename="helm-v3.9.3-linux-amd64.tar.gz.sha256sum" - curl -sSL https://get.helm.sh/${tar_filename} -O - curl -sSL https://get.helm.sh/${checksum_filename} -O - cat ${checksum_filename} | sha256sum -c - tar xzf ${tar_filename} - sudo mv linux-amd64/helm /usr/local/bin/helm - rm -rf linux-amd64 ${tar_filename} ${checksum_filename} - - run: - name: Install helm-s3 plugin - command: | - sudo apt-get install -y make - - version="${CIRCLE_SHA1}" - export HELM_S3_PLUGIN_NO_INSTALL_HOOK=true - if [ -n "${CIRCLE_TAG}" ]; then - version="${CIRCLE_TAG#v*}" - export HELM_S3_PLUGIN_NO_INSTALL_HOOK= - fi - - echo "Check installation of version ${version}" - helm plugin install https://github.com/hypnoglow/helm-s3.git --version ${version} - -workflows: - version: 2 - # test-pipeline runs on each push and merge, and does not run on tags. - test-pipeline: - jobs: - - dep - - test-install: - filters: - branches: - only: master - # release-pipeline runs only on tags. - release-pipeline: - jobs: - - dep: - filters: - tags: - only: /.*/ - branches: - ignore: /.*/ - - test-install: - requires: - - release - filters: - tags: - only: /.*/ - branches: - ignore: /.*/ diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0966de57..d5a8d6a5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -146,9 +146,17 @@ jobs: go test -v ./tests/e2e/... docker-images: + name: Build Docker images needs: - test-e2e uses: ./.github/workflows/reusable-docker-images.yml secrets: DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} + + test-install: + name: Test plugin installation + needs: + - test-e2e + uses: ./.github/workflows/reusable-test-install.yml + if: github.ref_name == 'master' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bbd0b199..f28768ae 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -35,3 +35,16 @@ jobs: GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GORELEASER_PREVIOUS_TAG: "" + + docker-images: + name: Build Docker images + uses: ./.github/workflows/reusable-docker-images.yml + secrets: + DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} + + test-install: + name: Test plugin installation + needs: + - release + uses: ./.github/workflows/reusable-test-install.yml diff --git a/.github/workflows/reusable-test-install.yml b/.github/workflows/reusable-test-install.yml new file mode 100644 index 00000000..4af59a11 --- /dev/null +++ b/.github/workflows/reusable-test-install.yml @@ -0,0 +1,36 @@ +name: test-install + +on: + workflow_call: + +jobs: + test-install: + name: Test plugin installation + runs-on: ubuntu-latest + steps: + + - name: Install helm + run: | + helm_version="3.9.3" + tar_filename="helm-v${helm_version}-linux-amd64.tar.gz" + checksum_filename="helm-v${helm_version}-linux-amd64.tar.gz.sha256sum" + + curl -sSL https://get.helm.sh/${tar_filename} -O + curl -sSL https://get.helm.sh/${checksum_filename} -O + cat ${checksum_filename} | sha256sum -c + + tar xzf ${tar_filename} + sudo mv linux-amd64/helm /usr/local/bin/helm + rm -rf linux-amd64 ${tar_filename} ${checksum_filename} + + - name: Install helm-s3 plugin + run: | + version="${GITHUB_SHA}" + export HELM_S3_PLUGIN_NO_INSTALL_HOOK=true + if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then + version="${GITHUB_REF_NAME#v*}" + export HELM_S3_PLUGIN_NO_INSTALL_HOOK= + fi + + echo "Check installation of version ${version}" + helm plugin install https://github.com/hypnoglow/helm-s3.git --version ${version}