diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..859d3b1 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,24 @@ +name: ci + +on: + push: + branches: + - '**' + +jobs: + lint_test: + uses: babylonchain/.github/.github/workflows/reusable_go_lint_test.yml@v0.1.0 + with: + run-unit-tests: true + run-integration-tests: true + run-lint: true + integration-tests-command: | + sudo make test-e2e + + docker_pipeline: + uses: babylonchain/.github/.github/workflows/reusable_docker_pipeline.yml@v0.1.0 + secrets: inherit + with: + publish: false + dockerfile: ./contrib/images/babylond/Dockerfile + repoName: babylond \ No newline at end of file diff --git a/.github/workflows/codeql-analizer.yml b/.github/workflows/codeql-analizer.yml deleted file mode 100644 index f0de614..0000000 --- a/.github/workflows/codeql-analizer.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: "Code Scanning - Action" - -on: - pull_request: - paths: - - "**.go" - push: - branches: [ main ] - paths: - - "**.go" - -jobs: - CodeQL-Build: - runs-on: ubuntu-latest - permissions: - actions: read - contents: read - security-events: write - - steps: - - name: Checkout repository - uses: actions/checkout@v3.5.2 - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - languages: 'go' - queries: crypto-com/cosmos-sdk-codeql@main,security-and-quality - - - name: Autobuild - uses: github/codeql-action/autobuild@v2 - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml deleted file mode 100644 index f7b7da0..0000000 --- a/.github/workflows/docker.yaml +++ /dev/null @@ -1,76 +0,0 @@ -name: Docker - -on: - push: - branches: - - main - tags: - - "v*.*.*" - pull_request: - branches: - - main - workflow_dispatch: - inputs: - tags: - description: "Tags to build and push" - required: true - type: string - -permissions: - contents: read - packages: write - -jobs: - build-push: - runs-on: ubuntu-latest - - env: - DOCKER_REGISTRY: ghcr.io - DOCKER_IMAGE: babylonchain/bcd - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup Go - uses: actions/setup-go@v4 - with: - go-version: "1.20" - check-latest: true - - - name: Extract Docker metadata - id: meta - uses: docker/metadata-action@v4 - with: - images: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE }} - tags: | - type=ref,event=branch - type=raw,value=latest,enable={{is_default_branch}} - type=semver,pattern=v{{major}}.{{minor}} - type=semver,pattern={{version}},value=v${{ inputs.tags }},enable=${{ inputs.tags != '' }} - flavor: | - latest=false - - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - - name: Login to Docker Hub - uses: docker/login-action@v1 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Run go vendor - run: | - cd demo/ && go mod vendor - - - name: Publish to GitHub Packages - uses: docker/build-push-action@v4 - with: - platforms: linux/amd64,linux/arm64 - push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.meta.outputs.tags }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..bf4b5ff --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,28 @@ +name: docker_publish + +on: + push: + branches: + - 'main' + - 'dev' + tags: + - '*' + +jobs: + lint_test: + uses: babylonchain/.github/.github/workflows/reusable_go_lint_test.yml@v0.1.0 + with: + run-unit-tests: true + run-integration-tests: true + run-lint: true + integration-tests-command: | + sudo make test-e2e + + docker_pipeline: + uses: babylonchain/.github/.github/workflows/reusable_docker_pipeline.yml@v0.1.0 + needs: ["lint_test"] + secrets: inherit + with: + publish: true + dockerfile: ./Dockerfile + repoName: babylon-sdk \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index baf92d6..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Release babylon-sdk - -on: - push: - tags: - - "v*.*.*" -permissions: - contents: read - -jobs: - release: - permissions: - contents: write # for goreleaser/goreleaser-action to create a GitHub release - runs-on: ubuntu-latest - steps: - - name: Checkout sources - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: Setup Go - uses: actions/setup-go@v4 - with: - go-version: "1.20" - check-latest: true - - name: Build demo app artifact - run: make build-linux-static - - - name: Create release - uses: softprops/action-gh-release@v1 - if: startsWith(github.ref, 'refs/tags/') - id: create_release - with: - draft: false - prerelease: false - body_path: RELEASE_NOTES.md - files: | - demo/build/* - tests/e2e/build/* diff --git a/.github/workflows/starship-e2e-tests.yml b/.github/workflows/starship-e2e-tests.yml deleted file mode 100644 index 92043e2..0000000 --- a/.github/workflows/starship-e2e-tests.yml +++ /dev/null @@ -1,67 +0,0 @@ -name: Starship E2E tests - -on: - push: - branches: - - main - pull_request: - branches: - - main - workflow_dispatch: {} - -jobs: - e2e-test: - runs-on: ubuntu-latest - timeout-minutes: 30 - - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Set up Go 1.x - uses: actions/setup-go@v2 - with: - go-version: ^1.20 - id: go - - - name: Deps - run: | - cd tests/starship/ - go mod tidy - - # Starship Infra setup - # - Connects to k8s cluster with kubeconfig (digital ocean) - # - Creates a new namespace based on the name (deleted in next step) - # - Spins up the infra with the given config file - # - Waits till all nodes are running (timeout 30m) - # - Port forward all ports to localhost for next steps to connect - - name: Setup Test infra - id: starship-action - uses: cosmology-tech/starship-action@0.2.15 - with: - values: tests/starship/configs/ci.yaml - port-forward: true - version: 0.1.48-rc0 - - - name: Run Tests - id: run-tests - continue-on-error: true - run: | - cd tests/starship/ - make test - - - name: Run Tests (retry on failure) - if: failure() && steps.run-tests.outcome == 'failure' - run: | - cd tests/starship/ - make test - - # Starship resource cleanup on cluster - - name: Cleanup cluster - if: always() - run: | - helm delete $DEVNET_NAME --debug --namespace $DEVNET_NAMESPACE --wait || true - kubectl delete namespace $DEVNET_NAMESPACE --wait=true || true - env: - DEVNET_NAME: ${{ steps.starship-action.outputs.name }} - DEVNET_NAMESPACE: ${{ steps.starship-action.outputs.namespace }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml deleted file mode 100644 index dc353de..0000000 --- a/.github/workflows/tests.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: Build and test -on: - pull_request: - branches: - - "**" - push: - branches: - - "main" - - "release/v[0-9]**" - workflow_dispatch: -permissions: - contents: read - -concurrency: - group: ci-${{ github.ref }}-build - cancel-in-progress: true - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Check out repository code - uses: actions/checkout@v3 - - name: Setup Golang - uses: actions/setup-go@v4 - with: - go-version: "^1.20" - - name: Display go version - run: go version - - name: Run all tests - run: make test-all - - uses: technote-space/get-diff-action@v6.1.2 - id: git_diff - with: - PATTERNS: | - **/*.go - go.mod - go.sum - **/go.mod - **/go.sum - **/Makefile - Makefile - ################### - #### Build App #### - ################### - - name: Build demo app # to ensure everything compiles - if: env.GIT_DIFF - run: make build