diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 485db950..00000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,128 +0,0 @@ -version: 2.1 - -orbs: - go: circleci/go@1.7.3 - aws-ecr: circleci/aws-ecr@8.2.1 - -jobs: - check-mock-gen: - machine: - image: ubuntu-2204:2024.01.1 - steps: - - checkout - - go/install: - version: "1.21.4" - - go/load-cache: - key: go-mod-v6-{{ checksum "go.sum" }} - - go/mod-download - - go/save-cache: - key: go-mod-v6-{{ checksum "go.sum" }} - path: "/home/circleci/.go_workspace/pkg/mod" - - run: - name: Run make mock-gen - command: | - make mock-gen - - run: - name: Check for uncommitted changes - command: | - if ! git diff --exit-code; then - echo "Uncommitted changes detected. Please run 'make mock-gen' before committing." - exit 1 - fi - - build_lint_test: - machine: - image: ubuntu-2204:2024.01.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 - - go/save-cache: - key: go-mod-v6-{{ checksum "go.sum" }} - path: "/home/circleci/.go_workspace/pkg/mod" - - run: - name: Build cli app - 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 --timeout 5m0s - - run: - name: Run tests - command: | - make test - - run: - name: Run integration tests - command: | - make test-e2e - - build_docker: - machine: - image: ubuntu-2204:2024.01.1 - resource_class: large - steps: - - checkout - - aws-ecr/build-image: - push-image: false - dockerfile: Dockerfile - path: ./ - build-path: ./ - tag: "$CIRCLE_SHA1,$CIRCLE_TAG" - repo: "$CIRCLE_PROJECT_REPONAME" - - run: - name: Save Docker image to export it to workspace - command: | - docker save $(docker image ls --format '{{.Repository}}:{{.Tag}}') > /tmp/finality-provider.tar - - persist_to_workspace: - root: /tmp - paths: - - finality-provider.tar - - push_docker: - machine: - image: ubuntu-2204:2024.01.1 - resource_class: large - steps: - - attach_workspace: - at: /tmp - - run: - name: Load Docker image from workspace - command: | - docker load -i /tmp/finality-provider.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: "$CIRCLE_PROJECT_REPONAME" - tag: "$CIRCLE_SHA1,$CIRCLE_TAG" - -workflows: - CI: - jobs: - - check-mock-gen - - 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..cd23d116 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,20 @@ +name: ci + +on: + pull_request: + branches: + - '**' + +jobs: + lint_test: + uses: babylonlabs-io/.github/.github/workflows/reusable_go_lint_test.yml@v0.1.0 + with: + run-unit-tests: true + run-integration-tests: true + run-lint: true + + docker_pipeline: + uses: babylonlabs-io/.github/.github/workflows/reusable_docker_pipeline.yml@v0.1.0 + secrets: inherit + with: + publish: false diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..9fa69f46 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,24 @@ +name: docker_publish + +on: + push: + branches: + - 'main' + - 'dev' + tags: + - '*' + +jobs: + lint_test: + uses: babylonlabs-io/.github/.github/workflows/reusable_go_lint_test.yml@v0.1.0 + with: + run-unit-tests: true + run-integration-tests: true + run-lint: true + + docker_pipeline: + needs: ["lint_test"] + uses: babylonlabs-io/.github/.github/workflows/reusable_docker_pipeline.yml@v0.1.0 + secrets: inherit + with: + publish: true