From df9658897e9153005d8f30adbcb19018a24fb473 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliv=C3=A9r=20Falvai?= Date: Wed, 4 Dec 2024 16:10:28 +0100 Subject: [PATCH] Fix CI; pin Go version explicitly (#1027) --- .tool-versions | 2 +- bitrise.yml | 52 +++++++++++++++++++++++++++++++++----------------- 2 files changed, 35 insertions(+), 19 deletions(-) diff --git a/.tool-versions b/.tool-versions index 463dd776..4e7d6aac 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1 +1 @@ -golang 1.21 +golang 1.21.13 diff --git a/bitrise.yml b/bitrise.yml index 608b021b..939a182f 100644 --- a/bitrise.yml +++ b/bitrise.yml @@ -34,10 +34,12 @@ stages: workflows: run_lint: steps: + - bundle::setup_repo: { } - bundle::run_lint: { } run_unit_tests_macos: steps: + - bundle::setup_repo: { } - bundle::setup_go_junit_report: { } - bundle::run_unit_tests: { } meta: @@ -47,11 +49,13 @@ workflows: run_unit_tests_linux: steps: + - bundle::setup_repo: { } - bundle::setup_go_junit_report: { } - bundle::run_unit_tests: { } run_integration_tests_macos: steps: + - bundle::setup_repo: { } - bundle::setup_go_junit_report: { } - bundle::run_integration_tests: { } meta: @@ -61,22 +65,25 @@ workflows: run_integration_tests_linux: steps: + - bundle::setup_repo: { } - bundle::setup_go_junit_report: { } - bundle::run_integration_tests: { } run_docker_integration_tests_linux: steps: + - bundle::setup_repo: { } - bundle::setup_go_junit_report: { } - bundle::run_docker_integration_tests: envs: - SRC_DIR_IN_GOPATH: $BITRISE_SOURCE_DIR meta: bitrise.io: - machine_type_id: elite-xl + machine_type_id: g2.linux.x-large stack: linux-docker-android-20.04 # TODO: Docker tests are failing on Ubuntu 22.04 test_binary_build_macos: steps: + - bundle::setup_repo: { } - bundle::setup_goreleaser: { } - bundle::test_binary_build: { } meta: @@ -86,6 +93,7 @@ workflows: test_binary_build_linux: steps: + - bundle::setup_repo: { } - bundle::setup_goreleaser: { } - bundle::test_binary_build: { } @@ -168,9 +176,6 @@ workflows: step_bundles: run_lint: steps: - - git-clone@8: - inputs: - - fetch_tags: "yes" - git::https://github.com/bitrise-steplib/steps-check.git: inputs: - workflow: lint @@ -179,9 +184,6 @@ step_bundles: run_unit_tests: steps: - - git-clone@8: - inputs: - - fetch_tags: "yes" - script@1: title: Run unit tests inputs: @@ -218,9 +220,6 @@ step_bundles: run_integration_tests: steps: - - git-clone@8: - inputs: - - fetch_tags: "yes" - script@1: title: Run integration tests inputs: @@ -268,9 +267,6 @@ step_bundles: run_docker_integration_tests: steps: - - git-clone@8: - inputs: - - fetch_tags: "yes" - script@1: title: Run integration tests inputs: @@ -309,13 +305,17 @@ step_bundles: mkdir -p "${test_results_dir}" cp "${ORIG_BITRISE_DEPLOY_DIR}/${linux_only_test_log_file_name}.xml" "${test_results_dir}/${linux_only_test_log_file_name}.xml" echo "${linux_only_test_name_json}" > "${test_results_dir}/test-info.json" + - script: + # The Go + ASDF situation is messed up on the Ubuntu 20 stack. Even though this workflow starts by installing + # the correct Go version with ASDF, the first non-Bash-toolkit step (deploy-to-bitrise-io) will fail, + # probably because the CLI process (which runs the steps) is already running by the time the Go version is set. + title: Ubuntu 20 Go hackery # TODO: remove this once the workflow is migrated to the Ubuntu 22 stack + inputs: + - content: rm ~/.asdf/shims/go - deploy-to-bitrise-io@2: { } test_binary_build: steps: - - git-clone@8: - inputs: - - fetch_tags: "yes" - script@1: title: Create snapshot binaries deps: @@ -329,6 +329,21 @@ step_bundles: goreleaser release --snapshot --rm-dist - deploy-to-bitrise-io@2: { } + setup_repo: + steps: + - git-clone@8: + inputs: + - fetch_tags: "yes" + - script: + title: Setup Go version + inputs: + - content: |- + #!/bin/bash + set -ex + + asdf plugin add golang || true # TODO: can be removed once all workflows are migrated to Ubuntu 22 + asdf install golang + setup_go_junit_report: steps: - script@1: @@ -338,7 +353,7 @@ step_bundles: #!/usr/bin/env bash set -ex go install github.com/jstemmer/go-junit-report/v2@latest - asdf reshim golang || true + asdf reshim golang setup_goreleaser: steps: @@ -353,9 +368,10 @@ step_bundles: sudo dpkg -i /tmp/goreleaser.deb else go install github.com/goreleaser/goreleaser@latest + asdf reshim golang fi meta: bitrise.io: - machine_type_id: elite-xl + machine_type_id: g2.linux.x-large stack: linux-docker-android-22.04