From d931b2c30466c55a966095cf42bb282af883bfe3 Mon Sep 17 00:00:00 2001 From: KonradStaniec Date: Wed, 7 Aug 2024 16:49:53 +0200 Subject: [PATCH] switch to gh actions (#5) --- .circleci/config.yml | 105 ---------------------------------- .github/workflows/ci.yml | 21 +++++++ .github/workflows/publish.yml | 25 ++++++++ 3 files changed, 46 insertions(+), 105 deletions(-) delete mode 100644 .circleci/config.yml create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/publish.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 7f90a64e..00000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,105 +0,0 @@ -version: 2.1 - -orbs: - go: circleci/go@1.9.0 - aws-ecr: circleci/aws-ecr@8.2.1 - -jobs: - build_lint_test: - machine: - image: ubuntu-2204:2022.10.1 - resource_class: large - steps: - - go/install: - version: "1.21.4" - - checkout - - run: - name: Print Go environment - command: "go env" - - go/load-cache: - key: go-mod-v6-{{ checksum "go.sum" }} - - go/mod-download - - run: - name: Install Dependencies - command: sudo apt-get install libzmq3-dev - - go/save-cache: - key: go-mod-v6-{{ checksum "go.sum" }} - path: "/home/circleci/.go_workspace/pkg/mod" - - run: - name: Build vigilante - command: make build - - run: - name: Lint - command: | - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.55.2 - ./bin/golangci-lint run - - run: - name: Run tests - command: | - make test - - run: - name: Run integration tests - command: | - make test-e2e - - build_docker: - machine: - image: ubuntu-2204:2022.10.1 - resource_class: large - steps: - - checkout - - aws-ecr/build-image: - push-image: false - dockerfile: Dockerfile - path: ./ - build-path: ./ - tag: "$CIRCLE_SHA1,$CIRCLE_TAG" - repo: "vigilante" - - run: - name: Save Docker image to export it to workspace - command: | - docker save $(docker image ls --format '{{.Repository}}:{{.Tag}}') > /tmp/vigilante.tar - - persist_to_workspace: - root: /tmp - paths: - - vigilante.tar - - push_docker: - machine: - image: ubuntu-2204:2022.10.1 - resource_class: large - steps: - - attach_workspace: - at: /tmp - - run: - name: Load Docker image from workspace - command: | - docker load -i /tmp/vigilante.tar - - aws-ecr/ecr-login: - aws-access-key-id: AWS_ACCESS_KEY_ID - aws-secret-access-key: AWS_SECRET_ACCESS_KEY - region: "$AWS_REGION" - - aws-ecr/push-image: - registry-id: AWS_ECR_REGISTRY_ID - region: "$AWS_REGION" - repo: "vigilante" - tag: "$CIRCLE_SHA1,$CIRCLE_TAG" - -workflows: - CI: - jobs: - - build_lint_test - - build_docker: - filters: - tags: - only: /.*/ - - push_docker: - requires: - - build_docker - filters: - tags: - only: /.*/ - branches: - only: - - main - - dev diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..4d1c9f0f --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,21 @@ +name: ci + +on: + pull_request: + branches: + - '**' + +jobs: + lint_test: + uses: babylonlabs-io/.github/.github/workflows/reusable_go_lint_test.yml@v0.3.1 + with: + run-unit-tests: true + run-integration-tests: true + run-lint: true + install-dependencies-command: sudo apt-get install libzmq3-dev + + docker_pipeline: + uses: babylonlabs-io/.github/.github/workflows/reusable_docker_pipeline.yml@v0.3.1 + secrets: inherit + with: + publish: false diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..8af43ef7 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,25 @@ +name: docker_publish + +on: + push: + branches: + - 'main' + - 'dev' + tags: + - '*' + +jobs: + lint_test: + uses: babylonlabs-io/.github/.github/workflows/reusable_go_lint_test.yml@v0.3.1 + with: + run-unit-tests: true + run-integration-tests: true + run-lint: true + install-dependencies-command: sudo apt-get install libzmq3-dev + + docker_pipeline: + needs: ["lint_test"] + uses: babylonlabs-io/.github/.github/workflows/reusable_docker_pipeline.yml@v0.3.1 + secrets: inherit + with: + publish: true