-
Notifications
You must be signed in to change notification settings - Fork 131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Config pipeline #1005
Config pipeline #1005
Changes from all commits
90cdc8c
73eb9f6
b853e00
e2f6eae
eced161
abbe773
96dcc99
d85a229
c6b93f3
c4d4fe6
205a77c
955a5f4
15577ae
a214b24
cd816e4
dbf88ed
1aa3480
c9c44af
e7686be
15cc547
d2f3853
37b1053
9b12bb8
682e5ee
89db513
4275549
344cee2
1f53974
4b040e9
a1e10a2
bf55c07
859f11c
27e2569
4e24593
0a5458c
7447607
3fd5cc1
1f070c9
36828ae
1b9fd9f
6eef161
9d3fafd
9554c2f
a5d9d7d
e346a99
945ccd8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,116 @@ | ||
format_version: "11" | ||
--- | ||
format_version: "17" | ||
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git | ||
project_type: other | ||
|
||
app: | ||
envs: | ||
- BIN_NAME: bitrise | ||
trigger_map: | ||
- push_branch: master | ||
pipeline: ci | ||
- pull_request_source_branch: "*" | ||
pipeline: ci | ||
- tag: "*.*.*" | ||
workflow: release | ||
enabled: false | ||
|
||
pipelines: | ||
ci: | ||
stages: | ||
- run_tests: { } | ||
|
||
stages: | ||
run_tests: | ||
workflows: | ||
- run_lint: { } | ||
- run_unit_tests_macos: { } | ||
- run_unit_tests_linux: { } | ||
- run_integration_tests_macos: { } | ||
- run_integration_tests_linux: { } | ||
- run_docker_integration_tests_linux: { } | ||
- test_binary_build_macos: { } | ||
- test_binary_build_linux: { } | ||
|
||
workflows: | ||
check: | ||
run_lint: | ||
steps: | ||
- git::https://github.com/bitrise-steplib/steps-check.git: | ||
inputs: | ||
- workflow: lint | ||
- skip_step_yml_validation: "yes" | ||
- go-list: { } | ||
- script: | ||
title: Go test | ||
inputs: | ||
- content: go test -p 1 $BITRISE_GO_PACKAGES | ||
- bundle::run_lint: { } | ||
|
||
test: | ||
title: Runs tests | ||
after_run: | ||
- check | ||
- integration-test | ||
run_unit_tests_macos: | ||
steps: | ||
- bundle::setup_go_junit_report: { } | ||
- bundle::run_unit_tests: { } | ||
meta: | ||
bitrise.io: | ||
stack: osx-xcode-16.0.x | ||
machine_type_id: g2.mac.large | ||
|
||
integration-test: | ||
title: Runs integration tests | ||
run_unit_tests_linux: | ||
steps: | ||
- script: | ||
title: Run integration tests | ||
inputs: | ||
- content: |- | ||
#!/usr/bin/env bash | ||
set -ex | ||
- bundle::setup_go_junit_report: { } | ||
- bundle::run_unit_tests: { } | ||
meta: | ||
bitrise.io: | ||
machine_type_id: elite-xl | ||
stack: linux-docker-android-22.04 | ||
|
||
current_bitrise="$(pwd)/_tmp/test_bitrise" | ||
export CGO_ENABLED=0 | ||
go build -o "$current_bitrise" | ||
run_integration_tests_macos: | ||
steps: | ||
- bundle::setup_go_junit_report: { } | ||
- bundle::run_integration_tests: { } | ||
meta: | ||
bitrise.io: | ||
stack: osx-xcode-edge | ||
machine_type_id: g2.mac.large | ||
|
||
export PR="" PULL_REQUEST_ID="" | ||
export INTEGRATION_TEST_BINARY_PATH="$current_bitrise" | ||
run_integration_tests_linux: | ||
steps: | ||
- bundle::setup_go_junit_report: { } | ||
- bundle::run_integration_tests: { } | ||
meta: | ||
bitrise.io: | ||
machine_type_id: elite-xl | ||
stack: linux-docker-android-22.04 | ||
|
||
$current_bitrise setup | ||
run_docker_integration_tests_linux: | ||
steps: | ||
- 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 | ||
stack: linux-docker-android-20.04 # TODO: Docker tests are failing on Ubuntu 22.04 | ||
|
||
go test -v ./_tests/integration/ --tags linux_and_mac | ||
test_binary_build_macos: | ||
steps: | ||
- bundle::setup_goreleaser: { } | ||
- bundle::test_binary_build: { } | ||
meta: | ||
bitrise.io: | ||
stack: osx-xcode-16.0.x | ||
machine_type_id: g2.mac.large | ||
|
||
if [ "$(uname)" == "Linux" ]; then | ||
go test -v ./_tests/integration/ --tags linux_only | ||
fi | ||
test_binary_build_linux: | ||
steps: | ||
- bundle::setup_goreleaser: { } | ||
- bundle::test_binary_build: { } | ||
meta: | ||
bitrise.io: | ||
machine_type_id: elite-xl | ||
stack: linux-docker-android-22.04 | ||
|
||
release: | ||
steps: | ||
- trigger-bitrise-workflow@0: | ||
inputs: | ||
- api_token: $CONTROL_CENTER_TRIGGER_KEY | ||
- workflow_id: binary-tool-release | ||
- exported_environment_variable_names: GIT_REPOSITORY_URL | ||
- app_slug: $CONTROL_CENTER_APP_SLUG | ||
meta: | ||
bitrise.io: | ||
machine_type_id: elite-xl | ||
stack: linux-docker-android-22.04 | ||
|
||
create-release: | ||
description: Creates Linux and Darwin binaries, then publishes a GitHub release | ||
|
@@ -59,7 +121,7 @@ workflows: | |
- AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID_PROD | ||
- AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY_PROD | ||
steps: | ||
- script: | ||
- script@1: | ||
title: Fetch GCS bucket credentials | ||
inputs: | ||
- content: |- | ||
|
@@ -69,7 +131,7 @@ workflows: | |
echo "$GCS_BITRISE_CLI_BUCKET_CREDENTIALS" > /tmp/gcs_service_account.json | ||
# Goreleaser expects this env var: | ||
envman add --key GOOGLE_APPLICATION_CREDENTIALS --value /tmp/gcs_service_account.json | ||
- script: | ||
- script@1: | ||
title: Goreleaser (create binaries + publish to GH) | ||
deps: | ||
brew: | ||
|
@@ -81,21 +143,6 @@ workflows: | |
|
||
goreleaser release | ||
|
||
test-binary-build: | ||
description: Tests the release build process by creating a snapshot release (without publishing) | ||
steps: | ||
- script: | ||
title: Goreleaser (create snapshot binaries) | ||
deps: | ||
brew: | ||
- name: goreleaser | ||
inputs: | ||
- content: | | ||
#!/usr/bin/env bash | ||
set -ex | ||
|
||
goreleaser release --snapshot --rm-dist | ||
|
||
noop: | ||
title: Noop | ||
description: Empty workflow for quick testing | ||
|
@@ -131,3 +178,197 @@ workflows: | |
- content: |- | ||
set -ex | ||
exit 0 | ||
|
||
step_bundles: | ||
run_lint: | ||
steps: | ||
- git-clone@8: | ||
inputs: | ||
- fetch_tags: "yes" | ||
- git::https://github.com/bitrise-steplib/steps-check.git: | ||
inputs: | ||
- workflow: lint | ||
- skip_step_yml_validation: "yes" | ||
- deploy-to-bitrise-io@2: { } | ||
|
||
run_unit_tests: | ||
steps: | ||
- git-clone@8: | ||
inputs: | ||
- fetch_tags: "yes" | ||
- script@1: | ||
title: Run unit tests and export results | ||
inputs: | ||
- content: |- | ||
#!/usr/bin/env bash | ||
set -ex | ||
|
||
# Here we save the original test results and deploy directories and later on we recreate them, | ||
# because during the tests these directories are removed. | ||
ORIG_BITRISE_TEST_RESULT_DIR="${BITRISE_TEST_RESULT_DIR}" | ||
ORIG_BITRISE_DEPLOY_DIR="${BITRISE_DEPLOY_DIR}" | ||
|
||
# Setup per OS test name and log file name | ||
if [ "$(uname)" = "Linux" ]; then | ||
test_name_json='{"test-name":"Unit tests (Linux)"}' | ||
test_log_file_name="unit_tests_linux" | ||
else | ||
test_name_json='{"test-name":"Unit tests (macOS)"}' | ||
test_log_file_name="unit_tests_macos" | ||
fi | ||
|
||
# Run tests and generate report | ||
go test -v -p 1 ./... 2>&1 | tee "./${test_log_file_name}.log" | ||
mkdir -p "${ORIG_BITRISE_DEPLOY_DIR}" | ||
cp "./${test_log_file_name}.log" "${ORIG_BITRISE_DEPLOY_DIR}/${test_log_file_name}.log" | ||
go-junit-report -in "./${test_log_file_name}.log" -out "${ORIG_BITRISE_DEPLOY_DIR}/${test_log_file_name}.xml" | ||
|
||
# Export the junit test results | ||
test_results_dir="${ORIG_BITRISE_TEST_RESULT_DIR}/unit_test_results" | ||
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" | ||
- deploy-to-bitrise-io@2: { } | ||
|
||
run_integration_tests: | ||
steps: | ||
- git-clone@8: | ||
inputs: | ||
- fetch_tags: "yes" | ||
- script@1: | ||
title: Run integration tests and export results | ||
inputs: | ||
- content: |- | ||
#!/usr/bin/env bash | ||
set -exo pipefail | ||
|
||
# Here we save the original test results and deploy directories and later on we recreate them, | ||
# because during the tests these directories are removed. | ||
ORIG_BITRISE_TEST_RESULT_DIR="${BITRISE_TEST_RESULT_DIR}" | ||
ORIG_BITRISE_DEPLOY_DIR="${BITRISE_DEPLOY_DIR}" | ||
|
||
# Build and setup the current binary | ||
current_bitrise="$(pwd)/_tmp/test_bitrise" | ||
export CGO_ENABLED=0 | ||
go build -o "$current_bitrise" | ||
|
||
export PR="" PULL_REQUEST_ID="" | ||
export INTEGRATION_TEST_BINARY_PATH="$current_bitrise" | ||
$current_bitrise setup | ||
|
||
# Setup per OS test name and log file name | ||
if [ "$(uname)" = "Linux" ]; then | ||
test_name_json='{"test-name":"Integration tests (Linux)"}' | ||
test_log_file_name="integration_tests_linux" | ||
else | ||
test_name_json='{"test-name":"Integration tests (macOS)"}' | ||
test_log_file_name="integration_tests_macos" | ||
fi | ||
|
||
# Run tests and generate report | ||
go test -v --tags linux_and_mac ./_tests/integration/... 2>&1 | tee "./${test_log_file_name}.log" | ||
|
||
mkdir -p "${ORIG_BITRISE_DEPLOY_DIR}" | ||
cp "./${test_log_file_name}.log" "${ORIG_BITRISE_DEPLOY_DIR}/${test_log_file_name}.log" | ||
|
||
go-junit-report -in "./${test_log_file_name}.log" -out "${ORIG_BITRISE_DEPLOY_DIR}/${test_log_file_name}.xml" | ||
|
||
# Export the junit test results | ||
test_results_dir="${ORIG_BITRISE_TEST_RESULT_DIR}/integration_test_results" | ||
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" | ||
- deploy-to-bitrise-io@2: { } | ||
|
||
run_docker_integration_tests: | ||
steps: | ||
- git-clone@8: | ||
inputs: | ||
- fetch_tags: "yes" | ||
- script@1: | ||
title: Run integration tests and export results | ||
inputs: | ||
- content: |- | ||
#!/usr/bin/env bash | ||
set -exo pipefail | ||
|
||
# Here we save the original test results and deploy directories and later on we recreate them, | ||
# because during the tests these directories are removed. | ||
ORIG_BITRISE_TEST_RESULT_DIR="${BITRISE_TEST_RESULT_DIR}" | ||
ORIG_BITRISE_DEPLOY_DIR="${BITRISE_DEPLOY_DIR}" | ||
|
||
# Build and setup the current binary | ||
current_bitrise="$(pwd)/_tmp/test_bitrise" | ||
export CGO_ENABLED=0 | ||
go build -o "$current_bitrise" | ||
|
||
export PR="" PULL_REQUEST_ID="" | ||
export INTEGRATION_TEST_BINARY_PATH="$current_bitrise" | ||
$current_bitrise setup | ||
|
||
# Setup per OS test name and log file name | ||
linux_only_test_name_json='{"test-name":"Linux only integration tests"}' | ||
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" | ||
|
||
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" | ||
|
||
go-junit-report -in "./${linux_only_test_log_file_name}.log" -out "${ORIG_BITRISE_DEPLOY_DIR}/${linux_only_test_log_file_name}.xml" | ||
|
||
# Export the junit test results | ||
test_results_dir="${ORIG_BITRISE_TEST_RESULT_DIR}/linux_only_integration_test_results" | ||
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" | ||
|
||
test_binary_build: | ||
steps: | ||
- git-clone@8: | ||
inputs: | ||
- fetch_tags: "yes" | ||
- script@1: | ||
title: Create snapshot binaries | ||
deps: | ||
brew: | ||
- name: goreleaser | ||
inputs: | ||
- content: | | ||
#!/usr/bin/env bash | ||
set -ex | ||
|
||
goreleaser release --snapshot --rm-dist | ||
- deploy-to-bitrise-io@2: { } | ||
|
||
setup_go_junit_report: | ||
steps: | ||
- script@1: | ||
title: Setup JUnit XML converter | ||
inputs: | ||
- content: |- | ||
#!/usr/bin/env bash | ||
set -ex | ||
go install github.com/jstemmer/go-junit-report/v2@latest | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: would be good to pin the version There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, do we want to pin an exact version? Currently, we pin the major version 2 ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, that could be enough, but I also don't see any reason not to pin an exact version. A commit hash won't disappear from GitHub (well, it could be force-pushed, but let's hope it never happens) |
||
asdf reshim golang || true | ||
|
||
setup_goreleaser: | ||
steps: | ||
- script@1: | ||
inputs: | ||
- content: |- | ||
#!/bin/bash | ||
set -ex | ||
|
||
if [ "$(uname)" = "Linux" ]; then | ||
wget -O /tmp/goreleaser.deb https://github.com/goreleaser/goreleaser/releases/download/v1.19.2/goreleaser_1.19.2_amd64.deb | ||
sudo dpkg -i /tmp/goreleaser.deb | ||
else | ||
go install github.com/goreleaser/goreleaser@latest | ||
fi | ||
|
||
meta: | ||
bitrise.io: | ||
machine_type_id: elite-xl | ||
stack: linux-docker-android-22.04 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK, we have a ticket for this in the BE backlog