Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ _bin
_FAKE_HOME/
.gows.user.yml
.DS_Store
.vscode
.idea/
dist/
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"go.testTags": "linux_and_mac",
"go.buildTags": "linux_and_mac"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without these tags, the Go LSP doesn't handle the integration test files (since most of them are explicitly tagged with this)

}
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# this is intended to be used only for local testing of container related integration tests
# everything else CI related is in the bitrise.yml

DOCKER_COMPOSE_FILE=_tests/integration/local_docker_test_environment/docker-compose.yml
DOCKER_COMPOSE_FILE=integrationtests/docker/local_docker_test_environment/docker-compose.yml
SRC_DIR_IN_GOPATH=/bitrise/src
DOCKERCOMPOSE=$(shell which docker-compose 2> /dev/null || echo '')

docker-test: setup-test-environment
docker exec -it bitrise-main-container bash -c "export INTEGRATION_TEST_BINARY_PATH=\$$PWD/bitrise-cli; go test ./_tests/integration -tags linux_only"
docker exec -it bitrise-main-container bash -c "export INTEGRATION_TEST_BINARY_PATH=\$$PWD/bitrise-cli; go test ./integrationtests/docker -tags linux_only"

setup-test-environment: build-main-container
docker exec -it bitrise-main-container bash -c "go build -o bitrise-cli"
Expand Down
9 changes: 0 additions & 9 deletions _tests/Dockerfile-min-env-debian

This file was deleted.

9 changes: 0 additions & 9 deletions _tests/Dockerfile-min-env-ubuntu

This file was deleted.

82 changes: 0 additions & 82 deletions _tests/bitrise.json

This file was deleted.

61 changes: 0 additions & 61 deletions _tests/bitrise.yml

This file was deleted.

65 changes: 0 additions & 65 deletions _tests/brew_publish.yml

This file was deleted.

23 changes: 0 additions & 23 deletions _tests/integration/toolprovider_test.go

This file was deleted.

19 changes: 15 additions & 4 deletions bitrise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,11 @@ step_bundles:
fi

# Run tests and generate report
go test -v --tags linux_and_mac ./_tests/integration/... 2>&1 | tee "./${test_log_file_name}.log"
set +e # Temporarily disable exit on error
# Note about `-p 1`: `bitrise run` is not parallelizable and has some race conditions, we need to execute tests sequentially
cd ./integrationtests && go test -v --tags linux_and_mac -p 1 ./... 2>&1 | tee "./${test_log_file_name}.log"
test_exit_code=$?
set -e # Re-enable exit on error

mkdir -p "${ORIG_BITRISE_DEPLOY_DIR}"
cp "./${test_log_file_name}.log" "${ORIG_BITRISE_DEPLOY_DIR}/${test_log_file_name}.log"
Expand All @@ -283,6 +287,8 @@ step_bundles:
mkdir -p "${test_results_dir}"
cp "${ORIG_BITRISE_DEPLOY_DIR}/${test_log_file_name}.xml" "${test_results_dir}/${test_log_file_name}.xml"
echo "${test_name_json}" > "${test_results_dir}/test-info.json"

exit $test_exit_code
- deploy-to-bitrise-io@2: { }

run_system_asdf_integration_tests:
Expand All @@ -298,7 +304,7 @@ step_bundles:
export TOOLPROVIDER_TEST_USE_SYSTEM_ASDF=1
# We test the system bitrise executable, not one built from source
export INTEGRATION_TEST_BINARY_PATH="$(which bitrise)"
go test -v --tags linux_and_mac ./_tests/integration/toolprovider/asdf/... -timeout 360s
cd integrationtests && go test -v --tags linux_and_mac ./toolprovider/asdf/... -timeout 360s

run_docker_integration_tests:
steps:
Expand Down Expand Up @@ -333,7 +339,10 @@ step_bundles:
linux_only_test_log_file_name="linux_only_integration_tests"

# Run tests and generate report
go test -v --tags linux_only ./_tests/integration/... 2>&1 | tee "./${linux_only_test_log_file_name}.log"
set +e # Temporarily disable exit on error
cd ./integrationtests && go test -v -p 1 --tags linux_only ./... 2>&1 | tee "./${linux_only_test_log_file_name}.log"
test_exit_code=$?
set -e # Re-enable exit on error

mkdir -p "${ORIG_BITRISE_DEPLOY_DIR}"
cp "./${linux_only_test_log_file_name}.log" "${ORIG_BITRISE_DEPLOY_DIR}/${linux_only_test_log_file_name}.log"
Expand All @@ -345,6 +354,9 @@ 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"

# Exit with the original test exit code
exit $test_exit_code
- deploy-to-bitrise-io@2: { }

test_binary_build:
Expand Down Expand Up @@ -398,7 +410,6 @@ step_bundles:
go install github.com/goreleaser/goreleaser/v2@latest
asdf reshim golang


meta:
bitrise.io:
machine_type_id: g2.linux.x-large
Expand Down
2 changes: 1 addition & 1 deletion cli/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func run(c *cli.Context) error {

agentConfig, err := setupAgentConfig()
if err != nil {
failf("Failed to process agent config: %w", err)
failf("Failed to process agent config: %s", err)
}
if agentConfig != nil && os.Getenv(analytics.StepExecutionIDEnvKey) != "" {
// Edge case: this Bitrise process was started by a script step running `bitrise run x`.
Expand Down
2 changes: 1 addition & 1 deletion cli/run_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -1202,7 +1202,7 @@ func prepareAnalyticsStepInfo(step stepmanModels.StepModel, stepInfoPtr stepmanM
func collectToolVersions(tracker analytics.Tracker) {
userHomeDir, err := os.UserHomeDir()
if err != nil {
log.Warnf("user home dir not found: %w", err)
log.Warnf("user home dir not found: %s", err)
}

logger := log.NewLogger(log.GetGlobalLoggerOpts())
Expand Down
2 changes: 1 addition & 1 deletion cli/trigger.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ func trigger(c *cli.Context) error {
}
agentConfig, err := setupAgentConfig()
if err != nil {
failf("Failed to process agent config: %w", err)
failf("Failed to process agent config: %s", err)
}

runner := NewWorkflowRunner(runConfig, agentConfig)
Expand Down
Loading