diff --git a/.github/workflows/auto-generated-code-checker.yml b/.github/workflows/auto-generated-code-checker.yml deleted file mode 100644 index 788d85bfc1..0000000000 --- a/.github/workflows/auto-generated-code-checker.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: Auto-Generated Code Checker -on: - push: - tags: - - "*" - branches: - - master - - dev - pull_request: - -jobs: - mock_gen: - name: Mocks - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 - with: - go-version: '~1.21.7' - check-latest: true - - shell: bash - run: scripts/mock.gen.sh - - shell: bash - run: .github/workflows/check-clean-branch.sh diff --git a/.github/workflows/publish_docker.yml b/.github/workflows/publish_docker.yml new file mode 100644 index 0000000000..8a5dfde727 --- /dev/null +++ b/.github/workflows/publish_docker.yml @@ -0,0 +1,20 @@ +name: Publish Docker Image + +on: + workflow_dispatch: + push: + tags: + - "*" + branches: + - master + +jobs: + publish_docker_image: + name: Publish Docker Image + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v4 + - run: echo ${{ secrets.docker_pass }} | docker login --username ${{ secrets.docker_username }} --password-stdin + shell: bash + - run: CURRENT_BRANCH=${{ github.head_ref || github.ref_name }} PUSH_DOCKER_IMAGE=true ./scripts/build_image.sh + shell: bash diff --git a/.github/workflows/ci.yml b/.github/workflows/tests.yml similarity index 89% rename from .github/workflows/ci.yml rename to .github/workflows/tests.yml index 480f3f1b24..2e4d3cf7a4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/tests.yml @@ -1,15 +1,16 @@ -name: Build + Test + Lint +name: Tests on: push: branches: - master tags: - - 'v[0-9]+.[0-9]+.[0-9]+' + - '*' pull_request: env: tmpnet_data_path: ~/.tmpnet/networks/1000 + min_go_version: '~1.21.7' jobs: lint_test: @@ -21,7 +22,7 @@ jobs: shell: bash - uses: actions/setup-go@v5 with: - go-version: '~1.21.7' + go-version: ${{ env.min_go_version }} check-latest: true - name: golangci-lint uses: golangci/golangci-lint-action@v3 @@ -40,7 +41,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: '~1.21.7' + go-version: ${{ env.min_go_version }} check-latest: true - run: go mod download shell: bash @@ -62,7 +63,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: '~1.21.7' + go-version: ${{ env.min_go_version }} check-latest: true - name: Use Node.js uses: actions/setup-node@v4 @@ -104,7 +105,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: '~1.21.7' + go-version: ${{ env.min_go_version }} check-latest: true - name: Use Node.js uses: actions/setup-node@v4 @@ -146,7 +147,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: '~1.21.7' + go-version: ${{ env.min_go_version }} check-latest: true - name: Install AvalancheGo Release shell: bash @@ -164,13 +165,16 @@ jobs: name: load-tmpnet-data path: ${{ env.tmpnet_data_path }} if-no-files-found: error - - build_image: - name: Build Docker Image - runs-on: ubuntu-20.04 + mock_gen: + name: MockGen Check + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - run: echo ${{ secrets.docker_pass }} | docker login --username ${{ secrets.docker_username }} --password-stdin - shell: bash - - run: CURRENT_BRANCH=${{ github.head_ref || github.ref_name }} PUSH_DOCKER_IMAGE=true ./scripts/build_image.sh - shell: bash + - uses: actions/setup-go@v4 + with: + go-version: ${{ env.min_go_version }} + check-latest: true + - shell: bash + run: scripts/mock.gen.sh + - shell: bash + run: .github/workflows/check-clean-branch.sh diff --git a/scripts/build_image.sh b/scripts/build_image.sh index 90ecccd522..fa1b74f87d 100755 --- a/scripts/build_image.sh +++ b/scripts/build_image.sh @@ -16,7 +16,7 @@ source "$SUBNET_EVM_PATH"/scripts/versions.sh # Load the constants source "$SUBNET_EVM_PATH"/scripts/constants.sh -BUILD_IMAGE_ID=${BUILD_IMAGE_ID:-"${AVALANCHE_VERSION}-Subnet-EVM-${CURRENT_BRANCH}"} +BUILD_IMAGE_ID=${BUILD_IMAGE_ID:-"avalanchego-${AVALANCHE_VERSION}-subnet-evm-${CURRENT_BRANCH}"} echo "Building Docker Image: $DOCKERHUB_REPO:$BUILD_IMAGE_ID based of $AVALANCHE_VERSION" docker build -t "$DOCKERHUB_REPO:$BUILD_IMAGE_ID" "$SUBNET_EVM_PATH" -f "$SUBNET_EVM_PATH/Dockerfile" \ @@ -25,5 +25,9 @@ docker build -t "$DOCKERHUB_REPO:$BUILD_IMAGE_ID" "$SUBNET_EVM_PATH" -f "$SUBNET --build-arg CURRENT_BRANCH="$CURRENT_BRANCH" if [[ ${PUSH_DOCKER_IMAGE:-""} == "true" ]]; then + if [[ $CURRENT_BRANCH == "master" ]]; then + echo "Tagging current image as $DOCKERHUB_REPO:latest" + docker tag "$DOCKERHUB_REPO:$BUILD_IMAGE_ID" "$DOCKERHUB_REPO:latest" + fi docker push "$DOCKERHUB_REPO:$BUILD_IMAGE_ID" fi diff --git a/scripts/constants.sh b/scripts/constants.sh index 54fe90b254..32d9699254 100644 --- a/scripts/constants.sh +++ b/scripts/constants.sh @@ -9,7 +9,7 @@ set -euo pipefail GOPATH="$(go env GOPATH)" # Avalabs docker hub -DOCKERHUB_REPO="avaplatform/avalanchego" +DOCKERHUB_REPO="avaplatform/subnet-evm" # if this isn't a git repository (say building from a release), don't set our git constants. if [ ! -d .git ]; then