From 898ebd02a74a52cffb0d5a04125ee7deadf7b197 Mon Sep 17 00:00:00 2001 From: Attila Varga Date: Thu, 12 Dec 2024 11:03:07 +0100 Subject: [PATCH 01/37] Add empty yml. --- .bitrise/bitrise.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .bitrise/bitrise.yml diff --git a/.bitrise/bitrise.yml b/.bitrise/bitrise.yml new file mode 100644 index 0000000000..d5af4d2ac8 --- /dev/null +++ b/.bitrise/bitrise.yml @@ -0,0 +1,13 @@ +--- +format_version: '13' +default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git +project_type: ios +meta: + bitrise.io: + stack: osx-xcode-16.0.x + machine_type_id: g2-m1.8core +app: + envs: + - BITRISE_PROJECT_PATH: Canvas.xcworkspace + opts: + is_expand: false From 465017d72e066d7ea624933e07be4564dd4a0034 Mon Sep 17 00:00:00 2001 From: Attila Varga Date: Thu, 12 Dec 2024 11:26:24 +0100 Subject: [PATCH 02/37] Add common workflows and a dedicated yml for adhoc builds. --- .bitrise/bitrise.yml | 67 +++++++++++++++++++++++++++ .bitrise/bitrise_adhoc.yml | 93 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 160 insertions(+) create mode 100644 .bitrise/bitrise_adhoc.yml diff --git a/.bitrise/bitrise.yml b/.bitrise/bitrise.yml index d5af4d2ac8..d68b277b4b 100644 --- a/.bitrise/bitrise.yml +++ b/.bitrise/bitrise.yml @@ -2,6 +2,73 @@ format_version: '13' default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git project_type: ios +include: + - path: .bitrise/bitrise_adhoc.yml +workflows: + _common_prepare_workspace: + steps: + - script@1: + inputs: + - content: |- + #!/usr/bin/env bash + # fail if any commands fails + set -e + # debug log + set -x + + # write your script here + sudo systemsetup -settimezone America/Denver + title: Set System Time to America + - activate-ssh-key: {} + - git::https://github.com/instructure/steps-verify-pr.git@master: + title: Verify PR + - git-clone: + inputs: + - reset_repository: 'Yes' + - script: + inputs: + - content: |- + #!/usr/bin/env bash + sudo systemsetup -settimezone America/Denver + envman add --key BITRISE_CONFIGURATION --value Adhoc + envman add --key BITRISE_SCHEME --value Student + title: Update timezone to MST + - git::git@github.com:instructure/steps-canvas-ios-secrets.git@master: + title: Canvas iOS Secrets + - script@1: + title: Install XcodeGen + inputs: + - content: |- + #!/usr/bin/env bash + # fail if any commands fails + set -ex + # make pipelines' return status equal the last command to exit with a non-zero status, or zero if all commands exit successfully + set -o pipefail + + cd $BITRISE_SOURCE_DIR + make provision-ci + - script@1: + title: Run make sync + inputs: + - content: |- + #!/usr/bin/env bash + # fail if any commands fails + set -ex + # make pipelines' return status equal the last command to exit with a non-zero status, or zero if all commands exit successfully + set -o pipefail + + cd $BITRISE_SOURCE_DIR + make sync-ci + - restore-spm-cache@2: {} + triggers: {} + summary: 'This step contains all the necessary steps to prepare the Xcode workspace + for building/testing.' + _common_save_spm_cache: + steps: + - save-spm-cache@1: {} + summary: This workflow's only task is to save resolved SPM dependencies to the + cache to be re-used later by other workflows (mainly the _common_prepare_workspace + one). meta: bitrise.io: stack: osx-xcode-16.0.x diff --git a/.bitrise/bitrise_adhoc.yml b/.bitrise/bitrise_adhoc.yml new file mode 100644 index 0000000000..d21da42164 --- /dev/null +++ b/.bitrise/bitrise_adhoc.yml @@ -0,0 +1,93 @@ +--- +format_version: '13' +workflows: + pr_adhoc_builds: + _pr_adhoc_build: + steps: + - set-xcode-build-number@1: + inputs: + - plist_path: "$INST_XCODE_SCHEME/$INST_XCODE_SCHEME/Resources/Info.plist" + - bitrise-step-stamp-appicon-with-version-number@1: + inputs: + - stamp_version: PR + - stamp_build_number: "$PR_NUMBER" + - stamp_path_to_icons: "$INST_XCODE_SCHEME/$INST_XCODE_SCHEME/Resources/Assets.xcassets/AppIcon.appiconset" + - xcode-archive@5: + inputs: + - distribution_method: ad-hoc + - perform_clean_action: 'yes' + - automatic_code_signing: api-key + - icloud_container_environment: Production + - scheme: "$INST_XCODE_SCHEME" + - deploy-to-bitrise-io@2: + inputs: + - notify_user_groups: none + - create-install-page-qr-code@1: {} + - comment-on-github-pull-request@0: + inputs: + - body: | +
$INST_XCODE_SCHEME Build QR Code + +
+ - update_comment_tag: "$INST_XCODE_SCHEME_Build" + - personal_access_token: "$DANGER_GITHUB_API_TOKEN" + is_always_run: false + summary: This workflow stamps the app icon and creates a QR code installable ad-hoc + build used for pull request testing. + description: "This step expects the following environment variable: \n$INST_XCODE_SCHEME + (e.g., Horizon)" + _pr_adhoc_build_discovery: + steps: + - script@1: + inputs: + - content: |- + #!/usr/bin/env bash + # fail if any commands fails + set -e + # debug log + set -x + + # Assuming our commit message is in the correct format, we decide which tests to go on with + # $GIT_CLONE_COMMIT_MESSAGE_BODY + echo "Git msg: ${GIT_CLONE_COMMIT_MESSAGE_BODY}" + echo "Bitrise Pull Request: " + echo $BITRISE_PULL_REQUEST + echo "Bitrise Git Message: " + echo $BITRISE_GIT_MESSAGE + + if [[ ! -z $BITRISE_PULL_REQUEST ]]; then + envman add --key PR_NUMBER --value $BITRISE_PULL_REQUEST + else + envman add --key PR_NUMBER --value "NOT_PR" + fi + if [[ $BITRISE_GIT_MESSAGE == *"Student"* ]]; then + envman add --key REQUIRE_STUDENT --value "true" + fi + + if [[ $BITRISE_GIT_MESSAGE == *"Teacher"* ]]; then + envman add --key REQUIRE_TEACHER --value "true" + fi + + if [[ $BITRISE_GIT_MESSAGE == *"Parent"* ]]; then + envman add --key REQUIRE_PARENT --value "true" + fi + + if [[ $BITRISE_GIT_MESSAGE == *"Horizon"* ]]; then + envman add --key REQUIRE_HORIZON --value "true" + fi + + if [[ $BITRISE_GIT_MESSAGE == *"affects: All"* ]]; then + envman add --key REQUIRE_PARENT --value "true" && + envman add --key REQUIRE_TEACHER --value "true" && + envman add --key REQUIRE_STUDENT --value "true" && + envman add --key REQUIRE_HORIZON --value + fi + title: Discover Which Apps To Build + summary: |- + This step analyzes the pull request's description and decides which apps to build. + + Outputs if conditions are met for each app: + - $REQUIRE_PARENT=true + - $REQUIRE_TEACHER=true + - $REQUIRE_STUDENT=true + - $REQUIRE_HORIZON=true \ No newline at end of file From 051827177efb0c71936bfcadea0c145bc8b62f53 Mon Sep 17 00:00:00 2001 From: Attila Varga Date: Thu, 12 Dec 2024 11:27:40 +0100 Subject: [PATCH 03/37] Remove include. --- .bitrise/bitrise.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.bitrise/bitrise.yml b/.bitrise/bitrise.yml index d68b277b4b..7c6de0d532 100644 --- a/.bitrise/bitrise.yml +++ b/.bitrise/bitrise.yml @@ -2,8 +2,6 @@ format_version: '13' default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git project_type: ios -include: - - path: .bitrise/bitrise_adhoc.yml workflows: _common_prepare_workspace: steps: From cb0b901469bc3164b62b556c124b134859fb646c Mon Sep 17 00:00:00 2001 From: Attila Varga Date: Thu, 12 Dec 2024 11:33:05 +0100 Subject: [PATCH 04/37] Remove adhoc workflows, re-add include. --- .bitrise/bitrise.yml | 2 + .bitrise/bitrise_adhoc.yml | 92 +------------------------------------- 2 files changed, 3 insertions(+), 91 deletions(-) diff --git a/.bitrise/bitrise.yml b/.bitrise/bitrise.yml index 7c6de0d532..d68b277b4b 100644 --- a/.bitrise/bitrise.yml +++ b/.bitrise/bitrise.yml @@ -2,6 +2,8 @@ format_version: '13' default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git project_type: ios +include: + - path: .bitrise/bitrise_adhoc.yml workflows: _common_prepare_workspace: steps: diff --git a/.bitrise/bitrise_adhoc.yml b/.bitrise/bitrise_adhoc.yml index d21da42164..a4aa221248 100644 --- a/.bitrise/bitrise_adhoc.yml +++ b/.bitrise/bitrise_adhoc.yml @@ -1,93 +1,3 @@ --- format_version: '13' -workflows: - pr_adhoc_builds: - _pr_adhoc_build: - steps: - - set-xcode-build-number@1: - inputs: - - plist_path: "$INST_XCODE_SCHEME/$INST_XCODE_SCHEME/Resources/Info.plist" - - bitrise-step-stamp-appicon-with-version-number@1: - inputs: - - stamp_version: PR - - stamp_build_number: "$PR_NUMBER" - - stamp_path_to_icons: "$INST_XCODE_SCHEME/$INST_XCODE_SCHEME/Resources/Assets.xcassets/AppIcon.appiconset" - - xcode-archive@5: - inputs: - - distribution_method: ad-hoc - - perform_clean_action: 'yes' - - automatic_code_signing: api-key - - icloud_container_environment: Production - - scheme: "$INST_XCODE_SCHEME" - - deploy-to-bitrise-io@2: - inputs: - - notify_user_groups: none - - create-install-page-qr-code@1: {} - - comment-on-github-pull-request@0: - inputs: - - body: | -
$INST_XCODE_SCHEME Build QR Code - -
- - update_comment_tag: "$INST_XCODE_SCHEME_Build" - - personal_access_token: "$DANGER_GITHUB_API_TOKEN" - is_always_run: false - summary: This workflow stamps the app icon and creates a QR code installable ad-hoc - build used for pull request testing. - description: "This step expects the following environment variable: \n$INST_XCODE_SCHEME - (e.g., Horizon)" - _pr_adhoc_build_discovery: - steps: - - script@1: - inputs: - - content: |- - #!/usr/bin/env bash - # fail if any commands fails - set -e - # debug log - set -x - - # Assuming our commit message is in the correct format, we decide which tests to go on with - # $GIT_CLONE_COMMIT_MESSAGE_BODY - echo "Git msg: ${GIT_CLONE_COMMIT_MESSAGE_BODY}" - echo "Bitrise Pull Request: " - echo $BITRISE_PULL_REQUEST - echo "Bitrise Git Message: " - echo $BITRISE_GIT_MESSAGE - - if [[ ! -z $BITRISE_PULL_REQUEST ]]; then - envman add --key PR_NUMBER --value $BITRISE_PULL_REQUEST - else - envman add --key PR_NUMBER --value "NOT_PR" - fi - if [[ $BITRISE_GIT_MESSAGE == *"Student"* ]]; then - envman add --key REQUIRE_STUDENT --value "true" - fi - - if [[ $BITRISE_GIT_MESSAGE == *"Teacher"* ]]; then - envman add --key REQUIRE_TEACHER --value "true" - fi - - if [[ $BITRISE_GIT_MESSAGE == *"Parent"* ]]; then - envman add --key REQUIRE_PARENT --value "true" - fi - - if [[ $BITRISE_GIT_MESSAGE == *"Horizon"* ]]; then - envman add --key REQUIRE_HORIZON --value "true" - fi - - if [[ $BITRISE_GIT_MESSAGE == *"affects: All"* ]]; then - envman add --key REQUIRE_PARENT --value "true" && - envman add --key REQUIRE_TEACHER --value "true" && - envman add --key REQUIRE_STUDENT --value "true" && - envman add --key REQUIRE_HORIZON --value - fi - title: Discover Which Apps To Build - summary: |- - This step analyzes the pull request's description and decides which apps to build. - - Outputs if conditions are met for each app: - - $REQUIRE_PARENT=true - - $REQUIRE_TEACHER=true - - $REQUIRE_STUDENT=true - - $REQUIRE_HORIZON=true \ No newline at end of file +workflows: \ No newline at end of file From 583d46e3c13be84f456b47a6a38fee1c3e4d1022 Mon Sep 17 00:00:00 2001 From: Attila Varga Date: Thu, 12 Dec 2024 11:35:51 +0100 Subject: [PATCH 05/37] Add empty workflow to adhoc yml. --- .bitrise/bitrise_adhoc.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.bitrise/bitrise_adhoc.yml b/.bitrise/bitrise_adhoc.yml index a4aa221248..8f2974092a 100644 --- a/.bitrise/bitrise_adhoc.yml +++ b/.bitrise/bitrise_adhoc.yml @@ -1,3 +1,5 @@ --- format_version: '13' -workflows: \ No newline at end of file +workflows: + _pr_adhoc_build: + steps: \ No newline at end of file From 70bcc23a8ce463d28834868f6b8af21005e5f899 Mon Sep 17 00:00:00 2001 From: Attila Varga Date: Thu, 12 Dec 2024 11:37:42 +0100 Subject: [PATCH 06/37] Add discovery workflow. --- .bitrise/bitrise_adhoc.yml | 57 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 55 insertions(+), 2 deletions(-) diff --git a/.bitrise/bitrise_adhoc.yml b/.bitrise/bitrise_adhoc.yml index 8f2974092a..602dd38ada 100644 --- a/.bitrise/bitrise_adhoc.yml +++ b/.bitrise/bitrise_adhoc.yml @@ -1,5 +1,58 @@ --- format_version: '13' workflows: - _pr_adhoc_build: - steps: \ No newline at end of file + _pr_adhoc_build_discovery: + steps: + - script@1: + inputs: + - content: |- + #!/usr/bin/env bash + # fail if any commands fails + set -e + # debug log + set -x + + # Assuming our commit message is in the correct format, we decide which tests to go on with + # $GIT_CLONE_COMMIT_MESSAGE_BODY + echo "Git msg: ${GIT_CLONE_COMMIT_MESSAGE_BODY}" + echo "Bitrise Pull Request: " + echo $BITRISE_PULL_REQUEST + echo "Bitrise Git Message: " + echo $BITRISE_GIT_MESSAGE + + if [[ ! -z $BITRISE_PULL_REQUEST ]]; then + envman add --key PR_NUMBER --value $BITRISE_PULL_REQUEST + else + envman add --key PR_NUMBER --value "NOT_PR" + fi + if [[ $BITRISE_GIT_MESSAGE == *"Student"* ]]; then + envman add --key REQUIRE_STUDENT --value "true" + fi + + if [[ $BITRISE_GIT_MESSAGE == *"Teacher"* ]]; then + envman add --key REQUIRE_TEACHER --value "true" + fi + + if [[ $BITRISE_GIT_MESSAGE == *"Parent"* ]]; then + envman add --key REQUIRE_PARENT --value "true" + fi + + if [[ $BITRISE_GIT_MESSAGE == *"Horizon"* ]]; then + envman add --key REQUIRE_HORIZON --value "true" + fi + + if [[ $BITRISE_GIT_MESSAGE == *"affects: All"* ]]; then + envman add --key REQUIRE_PARENT --value "true" && + envman add --key REQUIRE_TEACHER --value "true" && + envman add --key REQUIRE_STUDENT --value "true" && + envman add --key REQUIRE_HORIZON --value + fi + title: Discover Which Apps To Build + summary: |- + This step analyzes the pull request's description and decides which apps to build. + + Outputs if conditions are met for each app: + - $REQUIRE_PARENT=true + - $REQUIRE_TEACHER=true + - $REQUIRE_STUDENT=true + - $REQUIRE_HORIZON=true \ No newline at end of file From af1c60fe894051b6168d4ae6963f3a5e8ad88803 Mon Sep 17 00:00:00 2001 From: Attila Varga Date: Thu, 12 Dec 2024 11:38:41 +0100 Subject: [PATCH 07/37] Add adhoc utility step. --- .bitrise/bitrise_adhoc.yml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/.bitrise/bitrise_adhoc.yml b/.bitrise/bitrise_adhoc.yml index 602dd38ada..ea4f95dbb5 100644 --- a/.bitrise/bitrise_adhoc.yml +++ b/.bitrise/bitrise_adhoc.yml @@ -1,6 +1,40 @@ --- format_version: '13' workflows: + _pr_adhoc_build: + steps: + - set-xcode-build-number@1: + inputs: + - plist_path: "$INST_XCODE_SCHEME/$INST_XCODE_SCHEME/Resources/Info.plist" + - bitrise-step-stamp-appicon-with-version-number@1: + inputs: + - stamp_version: PR + - stamp_build_number: "$PR_NUMBER" + - stamp_path_to_icons: "$INST_XCODE_SCHEME/$INST_XCODE_SCHEME/Resources/Assets.xcassets/AppIcon.appiconset" + - xcode-archive@5: + inputs: + - distribution_method: ad-hoc + - perform_clean_action: 'yes' + - automatic_code_signing: api-key + - icloud_container_environment: Production + - scheme: "$INST_XCODE_SCHEME" + - deploy-to-bitrise-io@2: + inputs: + - notify_user_groups: none + - create-install-page-qr-code@1: {} + - comment-on-github-pull-request@0: + inputs: + - body: | +
$INST_XCODE_SCHEME Build QR Code + +
+ - update_comment_tag: "$INST_XCODE_SCHEME_Build" + - personal_access_token: "$DANGER_GITHUB_API_TOKEN" + is_always_run: false + summary: This workflow stamps the app icon and creates a QR code installable ad-hoc + build used for pull request testing. + description: "This step expects the following environment variable: \n$INST_XCODE_SCHEME + (e.g., Horizon)" _pr_adhoc_build_discovery: steps: - script@1: From 083b1434839d3c116894a6951f85483467ae8a7f Mon Sep 17 00:00:00 2001 From: Attila Varga Date: Thu, 12 Dec 2024 11:48:23 +0100 Subject: [PATCH 08/37] Remove unnecessary trigger. --- .bitrise/bitrise.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.bitrise/bitrise.yml b/.bitrise/bitrise.yml index d68b277b4b..8b3f41550e 100644 --- a/.bitrise/bitrise.yml +++ b/.bitrise/bitrise.yml @@ -60,7 +60,6 @@ workflows: cd $BITRISE_SOURCE_DIR make sync-ci - restore-spm-cache@2: {} - triggers: {} summary: 'This step contains all the necessary steps to prepare the Xcode workspace for building/testing.' _common_save_spm_cache: From ca157c87199947d6a31def703074e934a713fe7c Mon Sep 17 00:00:00 2001 From: Attila Varga Date: Thu, 12 Dec 2024 11:49:36 +0100 Subject: [PATCH 09/37] Rename adhoc yml. --- .bitrise/bitrise.yml | 2 +- .bitrise/{bitrise_adhoc.yml => bitrise_pr_adhoc.yml} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename .bitrise/{bitrise_adhoc.yml => bitrise_pr_adhoc.yml} (100%) diff --git a/.bitrise/bitrise.yml b/.bitrise/bitrise.yml index 8b3f41550e..e3a8201c79 100644 --- a/.bitrise/bitrise.yml +++ b/.bitrise/bitrise.yml @@ -3,7 +3,7 @@ format_version: '13' default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git project_type: ios include: - - path: .bitrise/bitrise_adhoc.yml + - path: .bitrise/bitrise_pr_adhoc.yml workflows: _common_prepare_workspace: steps: diff --git a/.bitrise/bitrise_adhoc.yml b/.bitrise/bitrise_pr_adhoc.yml similarity index 100% rename from .bitrise/bitrise_adhoc.yml rename to .bitrise/bitrise_pr_adhoc.yml From 9b83dd383c61aaf7d5292adcc5f6539c4ade5b29 Mon Sep 17 00:00:00 2001 From: Attila Varga Date: Thu, 12 Dec 2024 12:15:18 +0100 Subject: [PATCH 10/37] Add build triggers to each app. --- .bitrise/bitrise_pr_adhoc.yml | 51 +++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/.bitrise/bitrise_pr_adhoc.yml b/.bitrise/bitrise_pr_adhoc.yml index ea4f95dbb5..194b0359c6 100644 --- a/.bitrise/bitrise_pr_adhoc.yml +++ b/.bitrise/bitrise_pr_adhoc.yml @@ -1,6 +1,57 @@ --- format_version: '13' workflows: + pr_adhoc_builds: + before_run: + - _common_prepare_workspace + - _pr_adhoc_build_discovery + after_run: + - _common_save_spm_cache + steps: + - set-env-var@0: + inputs: + - destination_keys: INST_XCODE_SCHEME + - value: Student + title: Setup Student Scheme + - bitrise-run@0: + inputs: + - bitrise_config_path: ./.bitrise/bitrise_pr_adhoc.yml + - workflow_id: _pr_adhoc_build + run_if: '{{enveq "REQUIRE_STUDENT" "true"}}' + title: Build Student + - set-env-var@0: + inputs: + - destination_keys: INST_XCODE_SCHEME + - value: Teacher + title: Setup Teacher Scheme + - bitrise-run@0: + inputs: + - bitrise_config_path: ./.bitrise/bitrise_pr_adhoc.yml + - workflow_id: _pr_adhoc_build + run_if: '{{enveq "REQUIRE_TEACHER" "true"}}' + title: Build Teacher + - set-env-var@0: + inputs: + - destination_keys: INST_XCODE_SCHEME + - value: Parent + title: Setup Parent Scheme + - bitrise-run@0: + inputs: + - bitrise_config_path: ./.bitrise/bitrise_pr_adhoc.yml + - workflow_id: _pr_adhoc_build + run_if: '{{enveq "REQUIRE_PARENT" "true"}}' + title: Build Parent + - set-env-var@0: + inputs: + - destination_keys: INST_XCODE_SCHEME + - value: Horizon + title: Setup Horizon Scheme + - bitrise-run@0: + inputs: + - bitrise_config_path: ./.bitrise/bitrise_pr_adhoc.yml + - workflow_id: _pr_adhoc_build + run_if: '{{enveq "REQUIRE_HORIZON" "true"}}' + title: Build Horizon _pr_adhoc_build: steps: - set-xcode-build-number@1: From cefe8186d6839e5db33cefb14ae22dc4064e68d1 Mon Sep 17 00:00:00 2001 From: Attila Varga Date: Thu, 12 Dec 2024 13:59:47 +0100 Subject: [PATCH 11/37] Move comment to main workflow. --- .bitrise/bitrise_pr_adhoc.yml | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/.bitrise/bitrise_pr_adhoc.yml b/.bitrise/bitrise_pr_adhoc.yml index 194b0359c6..57827b3310 100644 --- a/.bitrise/bitrise_pr_adhoc.yml +++ b/.bitrise/bitrise_pr_adhoc.yml @@ -52,6 +52,18 @@ workflows: - workflow_id: _pr_adhoc_build run_if: '{{enveq "REQUIRE_HORIZON" "true"}}' title: Build Horizon + - comment-on-github-pull-request@0: + inputs: + - body: | +

Builds

+ +
+
$INST_XCODE_SCHEME Build QR Code + +
+ - update_comment_tag: "$INST_XCODE_SCHEME_Build" + - personal_access_token: "$DANGER_GITHUB_API_TOKEN" + is_always_run: false _pr_adhoc_build: steps: - set-xcode-build-number@1: @@ -73,15 +85,6 @@ workflows: inputs: - notify_user_groups: none - create-install-page-qr-code@1: {} - - comment-on-github-pull-request@0: - inputs: - - body: | -
$INST_XCODE_SCHEME Build QR Code - -
- - update_comment_tag: "$INST_XCODE_SCHEME_Build" - - personal_access_token: "$DANGER_GITHUB_API_TOKEN" - is_always_run: false summary: This workflow stamps the app icon and creates a QR code installable ad-hoc build used for pull request testing. description: "This step expects the following environment variable: \n$INST_XCODE_SCHEME From a18f195e908079667945cd1f11e6f32098a1c842 Mon Sep 17 00:00:00 2001 From: Attila Varga Date: Thu, 12 Dec 2024 15:08:57 +0100 Subject: [PATCH 12/37] Extract QR code based on the built scheme. --- .bitrise/bitrise_pr_adhoc.yml | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/.bitrise/bitrise_pr_adhoc.yml b/.bitrise/bitrise_pr_adhoc.yml index 57827b3310..9df23e2bff 100644 --- a/.bitrise/bitrise_pr_adhoc.yml +++ b/.bitrise/bitrise_pr_adhoc.yml @@ -65,30 +65,42 @@ workflows: - personal_access_token: "$DANGER_GITHUB_API_TOKEN" is_always_run: false _pr_adhoc_build: + description: "This step expects the following environment variable: \n$INST_XCODE_SCHEME (e.g., Horizon)\n\nThe output will be an environment variable called BITRISE_PUBLIC_INSTALL_PAGE_QR_CODE_IMAGE_URL_$INST_XCODE_SCHEME that'll contain the image url of the QR code pointing to the created application." steps: - set-xcode-build-number@1: inputs: - - plist_path: "$INST_XCODE_SCHEME/$INST_XCODE_SCHEME/Resources/Info.plist" + - plist_path: $INST_XCODE_SCHEME/$INST_XCODE_SCHEME/Resources/Info.plist - bitrise-step-stamp-appicon-with-version-number@1: inputs: - stamp_version: PR - - stamp_build_number: "$PR_NUMBER" - - stamp_path_to_icons: "$INST_XCODE_SCHEME/$INST_XCODE_SCHEME/Resources/Assets.xcassets/AppIcon.appiconset" + - stamp_build_number: $PR_NUMBER + - stamp_path_to_icons: $INST_XCODE_SCHEME/$INST_XCODE_SCHEME/Resources/Assets.xcassets/AppIcon.appiconset - xcode-archive@5: inputs: - distribution_method: ad-hoc - - perform_clean_action: 'yes' + - perform_clean_action: "yes" - automatic_code_signing: api-key - icloud_container_environment: Production - - scheme: "$INST_XCODE_SCHEME" + - scheme: $INST_XCODE_SCHEME - deploy-to-bitrise-io@2: inputs: - notify_user_groups: none - create-install-page-qr-code@1: {} - summary: This workflow stamps the app icon and creates a QR code installable ad-hoc - build used for pull request testing. - description: "This step expects the following environment variable: \n$INST_XCODE_SCHEME - (e.g., Horizon)" + - script@1: + inputs: + - content: |- + #!/usr/bin/env bash + # fail if any commands fails + set -e + # make pipelines' return status equal the last command to exit with a non-zero status, or zero if all commands exit successfully + set -o pipefail + # debug log + set -x + + QR_KEY="${BITRISE_PUBLIC_INSTALL_PAGE_QR_CODE_IMAGE_URL}_${INST_XCODE_SCHEME}" + envman add --key $QR_KEY --value $BITRISE_PUBLIC_INSTALL_PAGE_QR_CODE_IMAGE_URL + title: Export QR Image URL + summary: This workflow stamps the app icon and creates a QR code installable ad-hoc build used for pull request testing. _pr_adhoc_build_discovery: steps: - script@1: From 59f4cf46fbc2f09008022cab4cac40cba781842b Mon Sep 17 00:00:00 2001 From: Attila Varga Date: Thu, 12 Dec 2024 16:08:56 +0100 Subject: [PATCH 13/37] Fix QR key. Add unified QR code table as comment. --- .bitrise/bitrise_pr_adhoc.yml | 52 +++++++++++++++++++++++++---------- 1 file changed, 38 insertions(+), 14 deletions(-) diff --git a/.bitrise/bitrise_pr_adhoc.yml b/.bitrise/bitrise_pr_adhoc.yml index 9df23e2bff..652820815c 100644 --- a/.bitrise/bitrise_pr_adhoc.yml +++ b/.bitrise/bitrise_pr_adhoc.yml @@ -2,11 +2,11 @@ format_version: '13' workflows: pr_adhoc_builds: + after_run: + - _common_save_spm_cache before_run: - _common_prepare_workspace - _pr_adhoc_build_discovery - after_run: - - _common_save_spm_cache steps: - set-env-var@0: inputs: @@ -52,18 +52,42 @@ workflows: - workflow_id: _pr_adhoc_build run_if: '{{enveq "REQUIRE_HORIZON" "true"}}' title: Build Horizon - - comment-on-github-pull-request@0: + - script@1: + title: Create Comment HTML inputs: - - body: | -

Builds

- -
-
$INST_XCODE_SCHEME Build QR Code - -
- - update_comment_tag: "$INST_XCODE_SCHEME_Build" - - personal_access_token: "$DANGER_GITHUB_API_TOKEN" - is_always_run: false + - content: | + #!/usr/bin/env bash + # fail if any commands fails + set -e + # make pipelines' return status equal the last command to exit with a non-zero status, or zero if all commands exit successfully + set -o pipefail + # debug log + set -x + + declare -A APP_NAMES=( + [BITRISE_PUBLIC_INSTALL_PAGE_QR_CODE_IMAGE_URL_Student]="Student" + [BITRISE_PUBLIC_INSTALL_PAGE_QR_CODE_IMAGE_URL_Teacher]="Teacher" + [BITRISE_PUBLIC_INSTALL_PAGE_QR_CODE_IMAGE_URL_Parent]="Parent" + [BITRISE_PUBLIC_INSTALL_PAGE_QR_CODE_IMAGE_URL_Horizon]="Horizon" + ) + + COLUMNS="" + + for VAR_NAME in "${!APP_NAMES[@]}"; do + if [[ -n "${!VAR_NAME}" ]]; then + COLUMNS+="
" + COLUMNS+="${APP_NAMES[$VAR_NAME]}" + COLUMNS+="" + COLUMNS+="
" + fi + done + + PR_COMMENT="

Builds

" + PR_COMMENT+="" + PR_COMMENT+="${COLUMNS}" + PR_COMMENT+="
" + + envman add --key PR_BUILDS_COMMENT --value $HTML_TABLE _pr_adhoc_build: description: "This step expects the following environment variable: \n$INST_XCODE_SCHEME (e.g., Horizon)\n\nThe output will be an environment variable called BITRISE_PUBLIC_INSTALL_PAGE_QR_CODE_IMAGE_URL_$INST_XCODE_SCHEME that'll contain the image url of the QR code pointing to the created application." steps: @@ -97,7 +121,7 @@ workflows: # debug log set -x - QR_KEY="${BITRISE_PUBLIC_INSTALL_PAGE_QR_CODE_IMAGE_URL}_${INST_XCODE_SCHEME}" + QR_KEY="BITRISE_PUBLIC_INSTALL_PAGE_QR_CODE_IMAGE_URL_${INST_XCODE_SCHEME}" envman add --key $QR_KEY --value $BITRISE_PUBLIC_INSTALL_PAGE_QR_CODE_IMAGE_URL title: Export QR Image URL summary: This workflow stamps the app icon and creates a QR code installable ad-hoc build used for pull request testing. From 9008448d321c3b27929a82cefca5fa54feb125dc Mon Sep 17 00:00:00 2001 From: Attila Varga Date: Thu, 12 Dec 2024 16:17:53 +0100 Subject: [PATCH 14/37] Fix variable name. Omit clean operation before builds. --- .bitrise/bitrise_pr_adhoc.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.bitrise/bitrise_pr_adhoc.yml b/.bitrise/bitrise_pr_adhoc.yml index 652820815c..abcf41779c 100644 --- a/.bitrise/bitrise_pr_adhoc.yml +++ b/.bitrise/bitrise_pr_adhoc.yml @@ -87,7 +87,7 @@ workflows: PR_COMMENT+="${COLUMNS}" PR_COMMENT+="" - envman add --key PR_BUILDS_COMMENT --value $HTML_TABLE + envman add --key PR_BUILDS_COMMENT --value $PR_COMMENT _pr_adhoc_build: description: "This step expects the following environment variable: \n$INST_XCODE_SCHEME (e.g., Horizon)\n\nThe output will be an environment variable called BITRISE_PUBLIC_INSTALL_PAGE_QR_CODE_IMAGE_URL_$INST_XCODE_SCHEME that'll contain the image url of the QR code pointing to the created application." steps: @@ -102,7 +102,6 @@ workflows: - xcode-archive@5: inputs: - distribution_method: ad-hoc - - perform_clean_action: "yes" - automatic_code_signing: api-key - icloud_container_environment: Production - scheme: $INST_XCODE_SCHEME From 3ea1e7ecbdb83af63561a9d2e1cc10ce98044550 Mon Sep 17 00:00:00 2001 From: Attila Varga Date: Thu, 12 Dec 2024 16:34:59 +0100 Subject: [PATCH 15/37] Add back updated PR comment step. --- .bitrise/bitrise_pr_adhoc.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.bitrise/bitrise_pr_adhoc.yml b/.bitrise/bitrise_pr_adhoc.yml index abcf41779c..357ac0ddba 100644 --- a/.bitrise/bitrise_pr_adhoc.yml +++ b/.bitrise/bitrise_pr_adhoc.yml @@ -88,6 +88,11 @@ workflows: PR_COMMENT+="" envman add --key PR_BUILDS_COMMENT --value $PR_COMMENT + - comment-on-github-pull-request@0: + inputs: + - body: $PR_BUILDS_COMMENT + - update_comment_tag: $INST_XCODE_SCHEME_Build + - personal_access_token: $GITHUB_API_TOKEN _pr_adhoc_build: description: "This step expects the following environment variable: \n$INST_XCODE_SCHEME (e.g., Horizon)\n\nThe output will be an environment variable called BITRISE_PUBLIC_INSTALL_PAGE_QR_CODE_IMAGE_URL_$INST_XCODE_SCHEME that'll contain the image url of the QR code pointing to the created application." steps: From 1c3a2cd3e1a9e7996f053b4909acf745e8f11b47 Mon Sep 17 00:00:00 2001 From: Attila Varga Date: Thu, 12 Dec 2024 17:36:51 +0100 Subject: [PATCH 16/37] Add PR trigger. --- .bitrise/bitrise_pr_adhoc.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.bitrise/bitrise_pr_adhoc.yml b/.bitrise/bitrise_pr_adhoc.yml index 357ac0ddba..0b1a3f08e6 100644 --- a/.bitrise/bitrise_pr_adhoc.yml +++ b/.bitrise/bitrise_pr_adhoc.yml @@ -183,4 +183,9 @@ workflows: - $REQUIRE_PARENT=true - $REQUIRE_TEACHER=true - $REQUIRE_STUDENT=true - - $REQUIRE_HORIZON=true \ No newline at end of file + - $REQUIRE_HORIZON=true +trigger_map: +- pull_request_target_branch: + regex: .* + type: pull_request + workflow: pr_adhoc_builds \ No newline at end of file From 11b4808709e358d5c31c90498741ff8e7f673119 Mon Sep 17 00:00:00 2001 From: Attila Varga Date: Thu, 12 Dec 2024 17:56:19 +0100 Subject: [PATCH 17/37] Don't run PR comment step if workflow failed. --- .bitrise/bitrise_pr_adhoc.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.bitrise/bitrise_pr_adhoc.yml b/.bitrise/bitrise_pr_adhoc.yml index 0b1a3f08e6..1c94766c53 100644 --- a/.bitrise/bitrise_pr_adhoc.yml +++ b/.bitrise/bitrise_pr_adhoc.yml @@ -93,6 +93,7 @@ workflows: - body: $PR_BUILDS_COMMENT - update_comment_tag: $INST_XCODE_SCHEME_Build - personal_access_token: $GITHUB_API_TOKEN + is_always_run: false _pr_adhoc_build: description: "This step expects the following environment variable: \n$INST_XCODE_SCHEME (e.g., Horizon)\n\nThe output will be an environment variable called BITRISE_PUBLIC_INSTALL_PAGE_QR_CODE_IMAGE_URL_$INST_XCODE_SCHEME that'll contain the image url of the QR code pointing to the created application." steps: From 3c326279b0b3a1d7d99d1dfcf3f6a79c85742f87 Mon Sep 17 00:00:00 2001 From: Attila Varga Date: Thu, 12 Dec 2024 18:00:54 +0100 Subject: [PATCH 18/37] Add human readable status report name. --- .bitrise/bitrise_pr_adhoc.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.bitrise/bitrise_pr_adhoc.yml b/.bitrise/bitrise_pr_adhoc.yml index 1c94766c53..872b6ae7db 100644 --- a/.bitrise/bitrise_pr_adhoc.yml +++ b/.bitrise/bitrise_pr_adhoc.yml @@ -2,6 +2,7 @@ format_version: '13' workflows: pr_adhoc_builds: + status_report_name: Ad-Hoc Builds after_run: - _common_save_spm_cache before_run: From 62affbefde9d1685825278b282609d12f94ac0e5 Mon Sep 17 00:00:00 2001 From: Attila Varga Date: Thu, 12 Dec 2024 18:09:42 +0100 Subject: [PATCH 19/37] Don't use utility workflow format for adhoc build. --- .bitrise/bitrise_pr_adhoc.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.bitrise/bitrise_pr_adhoc.yml b/.bitrise/bitrise_pr_adhoc.yml index 872b6ae7db..c24bd23538 100644 --- a/.bitrise/bitrise_pr_adhoc.yml +++ b/.bitrise/bitrise_pr_adhoc.yml @@ -17,7 +17,7 @@ workflows: - bitrise-run@0: inputs: - bitrise_config_path: ./.bitrise/bitrise_pr_adhoc.yml - - workflow_id: _pr_adhoc_build + - workflow_id: pr_adhoc_build run_if: '{{enveq "REQUIRE_STUDENT" "true"}}' title: Build Student - set-env-var@0: @@ -28,7 +28,7 @@ workflows: - bitrise-run@0: inputs: - bitrise_config_path: ./.bitrise/bitrise_pr_adhoc.yml - - workflow_id: _pr_adhoc_build + - workflow_id: pr_adhoc_build run_if: '{{enveq "REQUIRE_TEACHER" "true"}}' title: Build Teacher - set-env-var@0: @@ -39,7 +39,7 @@ workflows: - bitrise-run@0: inputs: - bitrise_config_path: ./.bitrise/bitrise_pr_adhoc.yml - - workflow_id: _pr_adhoc_build + - workflow_id: pr_adhoc_build run_if: '{{enveq "REQUIRE_PARENT" "true"}}' title: Build Parent - set-env-var@0: @@ -50,7 +50,7 @@ workflows: - bitrise-run@0: inputs: - bitrise_config_path: ./.bitrise/bitrise_pr_adhoc.yml - - workflow_id: _pr_adhoc_build + - workflow_id: pr_adhoc_build run_if: '{{enveq "REQUIRE_HORIZON" "true"}}' title: Build Horizon - script@1: @@ -95,7 +95,7 @@ workflows: - update_comment_tag: $INST_XCODE_SCHEME_Build - personal_access_token: $GITHUB_API_TOKEN is_always_run: false - _pr_adhoc_build: + pr_adhoc_build: description: "This step expects the following environment variable: \n$INST_XCODE_SCHEME (e.g., Horizon)\n\nThe output will be an environment variable called BITRISE_PUBLIC_INSTALL_PAGE_QR_CODE_IMAGE_URL_$INST_XCODE_SCHEME that'll contain the image url of the QR code pointing to the created application." steps: - set-xcode-build-number@1: From 312d28bf04456356890e38725ccc544e815c3f65 Mon Sep 17 00:00:00 2001 From: Attila Varga Date: Thu, 12 Dec 2024 18:20:50 +0100 Subject: [PATCH 20/37] Reference the outer yml when starting sub-build. --- .bitrise/bitrise_pr_adhoc.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.bitrise/bitrise_pr_adhoc.yml b/.bitrise/bitrise_pr_adhoc.yml index c24bd23538..dfb20a7781 100644 --- a/.bitrise/bitrise_pr_adhoc.yml +++ b/.bitrise/bitrise_pr_adhoc.yml @@ -16,7 +16,7 @@ workflows: title: Setup Student Scheme - bitrise-run@0: inputs: - - bitrise_config_path: ./.bitrise/bitrise_pr_adhoc.yml + - bitrise_config_path: ./.bitrise/bitrise.yml - workflow_id: pr_adhoc_build run_if: '{{enveq "REQUIRE_STUDENT" "true"}}' title: Build Student @@ -27,7 +27,7 @@ workflows: title: Setup Teacher Scheme - bitrise-run@0: inputs: - - bitrise_config_path: ./.bitrise/bitrise_pr_adhoc.yml + - bitrise_config_path: ./.bitrise/bitrise.yml - workflow_id: pr_adhoc_build run_if: '{{enveq "REQUIRE_TEACHER" "true"}}' title: Build Teacher @@ -38,7 +38,7 @@ workflows: title: Setup Parent Scheme - bitrise-run@0: inputs: - - bitrise_config_path: ./.bitrise/bitrise_pr_adhoc.yml + - bitrise_config_path: ./.bitrise/bitrise.yml - workflow_id: pr_adhoc_build run_if: '{{enveq "REQUIRE_PARENT" "true"}}' title: Build Parent @@ -49,7 +49,7 @@ workflows: title: Setup Horizon Scheme - bitrise-run@0: inputs: - - bitrise_config_path: ./.bitrise/bitrise_pr_adhoc.yml + - bitrise_config_path: ./.bitrise/bitrise.yml - workflow_id: pr_adhoc_build run_if: '{{enveq "REQUIRE_HORIZON" "true"}}' title: Build Horizon From bf85b1299d69d4cd3a6806db6a47c8db3b22b18c Mon Sep 17 00:00:00 2001 From: Attila Varga Date: Fri, 13 Dec 2024 10:52:13 +0100 Subject: [PATCH 21/37] Update build number update step to its latest version. --- .bitrise/bitrise_pr_adhoc.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.bitrise/bitrise_pr_adhoc.yml b/.bitrise/bitrise_pr_adhoc.yml index dfb20a7781..b18ab45247 100644 --- a/.bitrise/bitrise_pr_adhoc.yml +++ b/.bitrise/bitrise_pr_adhoc.yml @@ -98,9 +98,9 @@ workflows: pr_adhoc_build: description: "This step expects the following environment variable: \n$INST_XCODE_SCHEME (e.g., Horizon)\n\nThe output will be an environment variable called BITRISE_PUBLIC_INSTALL_PAGE_QR_CODE_IMAGE_URL_$INST_XCODE_SCHEME that'll contain the image url of the QR code pointing to the created application." steps: - - set-xcode-build-number@1: + - set-xcode-build-number@2: inputs: - - plist_path: $INST_XCODE_SCHEME/$INST_XCODE_SCHEME/Resources/Info.plist + - scheme: $INST_XCODE_SCHEME - bitrise-step-stamp-appicon-with-version-number@1: inputs: - stamp_version: PR From 8cab76af1212b7fff18dbd323e6792c6ef87c391 Mon Sep 17 00:00:00 2001 From: Attila Varga Date: Fri, 13 Dec 2024 12:01:59 +0100 Subject: [PATCH 22/37] Extract app icon location to an external variable since it differs in the Horizon app. --- .bitrise/bitrise_pr_adhoc.yml | 72 ++++++++++++++++++++++++++--------- 1 file changed, 54 insertions(+), 18 deletions(-) diff --git a/.bitrise/bitrise_pr_adhoc.yml b/.bitrise/bitrise_pr_adhoc.yml index b18ab45247..f7f88514a5 100644 --- a/.bitrise/bitrise_pr_adhoc.yml +++ b/.bitrise/bitrise_pr_adhoc.yml @@ -9,44 +9,80 @@ workflows: - _common_prepare_workspace - _pr_adhoc_build_discovery steps: - - set-env-var@0: + - script@1: inputs: - - destination_keys: INST_XCODE_SCHEME - - value: Student - title: Setup Student Scheme + - content: |- + #!/usr/bin/env bash + # fail if any commands fails + set -e + # make pipelines' return status equal the last command to exit with a non-zero status, or zero if all commands exit successfully + set -o pipefail + # debug log + set -x + + envman add --key INST_XCODE_SCHEME --value Student + envman add --key INST_XCODE_APPICON_PATH --value Student/Student/Assets.xcassets/AppIcon.appiconset + title: Setup Student Variables - bitrise-run@0: inputs: - bitrise_config_path: ./.bitrise/bitrise.yml - workflow_id: pr_adhoc_build run_if: '{{enveq "REQUIRE_STUDENT" "true"}}' title: Build Student - - set-env-var@0: + - script@1: inputs: - - destination_keys: INST_XCODE_SCHEME - - value: Teacher - title: Setup Teacher Scheme + - content: |- + #!/usr/bin/env bash + # fail if any commands fails + set -e + # make pipelines' return status equal the last command to exit with a non-zero status, or zero if all commands exit successfully + set -o pipefail + # debug log + set -x + + envman add --key INST_XCODE_SCHEME --value Teacher + envman add --key INST_XCODE_APPICON_PATH --value Teacher/Teacher/Assets.xcassets/AppIcon.appiconset + title: Setup Teacher Variables - bitrise-run@0: inputs: - bitrise_config_path: ./.bitrise/bitrise.yml - workflow_id: pr_adhoc_build run_if: '{{enveq "REQUIRE_TEACHER" "true"}}' title: Build Teacher - - set-env-var@0: + - script@1: inputs: - - destination_keys: INST_XCODE_SCHEME - - value: Parent - title: Setup Parent Scheme + - content: |- + #!/usr/bin/env bash + # fail if any commands fails + set -e + # make pipelines' return status equal the last command to exit with a non-zero status, or zero if all commands exit successfully + set -o pipefail + # debug log + set -x + + envman add --key INST_XCODE_SCHEME --value Parent + envman add --key INST_XCODE_APPICON_PATH --value Parent/Parent/Assets.xcassets/AppIcon.appiconset + title: Setup Parent Variables - bitrise-run@0: inputs: - bitrise_config_path: ./.bitrise/bitrise.yml - workflow_id: pr_adhoc_build run_if: '{{enveq "REQUIRE_PARENT" "true"}}' title: Build Parent - - set-env-var@0: + - script@1: inputs: - - destination_keys: INST_XCODE_SCHEME - - value: Horizon - title: Setup Horizon Scheme + - content: |- + #!/usr/bin/env bash + # fail if any commands fails + set -e + # make pipelines' return status equal the last command to exit with a non-zero status, or zero if all commands exit successfully + set -o pipefail + # debug log + set -x + + envman add --key INST_XCODE_SCHEME --value Horizon + envman add --key INST_XCODE_APPICON_PATH --value Horizon/Horizon/Resources/Assets.xcassets/AppIcon.appiconset + title: Setup Horizon Variables - bitrise-run@0: inputs: - bitrise_config_path: ./.bitrise/bitrise.yml @@ -96,7 +132,7 @@ workflows: - personal_access_token: $GITHUB_API_TOKEN is_always_run: false pr_adhoc_build: - description: "This step expects the following environment variable: \n$INST_XCODE_SCHEME (e.g., Horizon)\n\nThe output will be an environment variable called BITRISE_PUBLIC_INSTALL_PAGE_QR_CODE_IMAGE_URL_$INST_XCODE_SCHEME that'll contain the image url of the QR code pointing to the created application." + description: "This step expects the following environment variables: \n$INST_XCODE_SCHEME (e.g., Horizon)\n$INST_XCODE_APPICON_PATH (e.g., Horizon/Horizon/Resources/Assets.xcassets/AppIcon.appiconset)\n\nThe output will be an environment variable called BITRISE_PUBLIC_INSTALL_PAGE_QR_CODE_IMAGE_URL_$INST_XCODE_SCHEME that'll contain the image url of the QR code pointing to the created application." steps: - set-xcode-build-number@2: inputs: @@ -105,7 +141,7 @@ workflows: inputs: - stamp_version: PR - stamp_build_number: $PR_NUMBER - - stamp_path_to_icons: $INST_XCODE_SCHEME/$INST_XCODE_SCHEME/Resources/Assets.xcassets/AppIcon.appiconset + - stamp_path_to_icons: $INST_XCODE_APPICON_PATH - xcode-archive@5: inputs: - distribution_method: ad-hoc From 841b12c02cae32e014487254bc6abe8cb836c1d5 Mon Sep 17 00:00:00 2001 From: Attila Varga Date: Fri, 13 Dec 2024 14:10:34 +0100 Subject: [PATCH 23/37] Enable verbose loggin for xcode build. --- .bitrise/bitrise_pr_adhoc.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.bitrise/bitrise_pr_adhoc.yml b/.bitrise/bitrise_pr_adhoc.yml index f7f88514a5..54aaf451a2 100644 --- a/.bitrise/bitrise_pr_adhoc.yml +++ b/.bitrise/bitrise_pr_adhoc.yml @@ -148,6 +148,7 @@ workflows: - automatic_code_signing: api-key - icloud_container_environment: Production - scheme: $INST_XCODE_SCHEME + - verbose_log: "yes" - deploy-to-bitrise-io@2: inputs: - notify_user_groups: none From 226767752298b181dfbb548aac4779d479b886fb Mon Sep 17 00:00:00 2001 From: Attila Varga Date: Fri, 13 Dec 2024 15:23:26 +0100 Subject: [PATCH 24/37] Extract PR comment script to a dedicated file. Move adhoc related files to a dedicated folder. --- .bitrise/bitrise.yml | 2 +- .bitrise/{ => pr_adhoc}/bitrise_pr_adhoc.yml | 37 ++------------------ .bitrise/pr_adhoc/create_pr_comment.sh | 34 ++++++++++++++++++ 3 files changed, 37 insertions(+), 36 deletions(-) rename .bitrise/{ => pr_adhoc}/bitrise_pr_adhoc.yml (84%) create mode 100755 .bitrise/pr_adhoc/create_pr_comment.sh diff --git a/.bitrise/bitrise.yml b/.bitrise/bitrise.yml index e3a8201c79..780180591e 100644 --- a/.bitrise/bitrise.yml +++ b/.bitrise/bitrise.yml @@ -3,7 +3,7 @@ format_version: '13' default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git project_type: ios include: - - path: .bitrise/bitrise_pr_adhoc.yml + - path: .bitrise/pr_adhoc/bitrise_pr_adhoc.yml workflows: _common_prepare_workspace: steps: diff --git a/.bitrise/bitrise_pr_adhoc.yml b/.bitrise/pr_adhoc/bitrise_pr_adhoc.yml similarity index 84% rename from .bitrise/bitrise_pr_adhoc.yml rename to .bitrise/pr_adhoc/bitrise_pr_adhoc.yml index 54aaf451a2..5a99cd8f79 100644 --- a/.bitrise/bitrise_pr_adhoc.yml +++ b/.bitrise/pr_adhoc/bitrise_pr_adhoc.yml @@ -89,42 +89,9 @@ workflows: - workflow_id: pr_adhoc_build run_if: '{{enveq "REQUIRE_HORIZON" "true"}}' title: Build Horizon - - script@1: - title: Create Comment HTML + - script-runner@0: inputs: - - content: | - #!/usr/bin/env bash - # fail if any commands fails - set -e - # make pipelines' return status equal the last command to exit with a non-zero status, or zero if all commands exit successfully - set -o pipefail - # debug log - set -x - - declare -A APP_NAMES=( - [BITRISE_PUBLIC_INSTALL_PAGE_QR_CODE_IMAGE_URL_Student]="Student" - [BITRISE_PUBLIC_INSTALL_PAGE_QR_CODE_IMAGE_URL_Teacher]="Teacher" - [BITRISE_PUBLIC_INSTALL_PAGE_QR_CODE_IMAGE_URL_Parent]="Parent" - [BITRISE_PUBLIC_INSTALL_PAGE_QR_CODE_IMAGE_URL_Horizon]="Horizon" - ) - - COLUMNS="" - - for VAR_NAME in "${!APP_NAMES[@]}"; do - if [[ -n "${!VAR_NAME}" ]]; then - COLUMNS+="
" - COLUMNS+="${APP_NAMES[$VAR_NAME]}" - COLUMNS+="" - COLUMNS+="
" - fi - done - - PR_COMMENT="

Builds

" - PR_COMMENT+="" - PR_COMMENT+="${COLUMNS}" - PR_COMMENT+="
" - - envman add --key PR_BUILDS_COMMENT --value $PR_COMMENT + - file_path: ./.bitrise/pr_adhoc/create_pr_comment.sh - comment-on-github-pull-request@0: inputs: - body: $PR_BUILDS_COMMENT diff --git a/.bitrise/pr_adhoc/create_pr_comment.sh b/.bitrise/pr_adhoc/create_pr_comment.sh new file mode 100755 index 0000000000..cc9613c8f6 --- /dev/null +++ b/.bitrise/pr_adhoc/create_pr_comment.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash +# fail if any commands fails +set -e +# make pipelines' return status equal the last command to exit with a non-zero status, or zero if all commands exit successfully +set -o pipefail +# debug log +# set -x + +declare -a APP_NAMES=( + "BITRISE_PUBLIC_INSTALL_PAGE_QR_CODE_IMAGE_URL_Student:Student" + "BITRISE_PUBLIC_INSTALL_PAGE_QR_CODE_IMAGE_URL_Teacher:Teacher" + "BITRISE_PUBLIC_INSTALL_PAGE_QR_CODE_IMAGE_URL_Parent:Parent" + "BITRISE_PUBLIC_INSTALL_PAGE_QR_CODE_IMAGE_URL_Horizon:Horizon" +) + +COLUMNS="" + +for PAIR in "${APP_NAMES[@]}"; do + QR_URL="${PAIR%%:*}" + APP_NAME="${PAIR#*:}" + if [[ -n "${!QR_URL}" ]]; then + COLUMNS+="
" + COLUMNS+="${APP_NAME}" + COLUMNS+="" + COLUMNS+="
" + fi +done + +PR_COMMENT="

Builds

" +PR_COMMENT+="" +PR_COMMENT+="${COLUMNS}" +PR_COMMENT+="
" + +envman add --key PR_BUILDS_COMMENT --value $PR_COMMENT From 8d1e11a0441131edd34e223b768226ad5cd143ce Mon Sep 17 00:00:00 2001 From: Attila Varga Date: Fri, 13 Dec 2024 17:55:00 +0100 Subject: [PATCH 25/37] Write QR urls to file from child workflow. --- .bitrise/pr_adhoc/bitrise_pr_adhoc.yml | 22 +++++----------- .bitrise/pr_adhoc/create_pr_comment.sh | 32 ++++++++++++++++------- .bitrise/pr_adhoc/write_qr_url_to_file.sh | 14 ++++++++++ 3 files changed, 43 insertions(+), 25 deletions(-) create mode 100755 .bitrise/pr_adhoc/write_qr_url_to_file.sh diff --git a/.bitrise/pr_adhoc/bitrise_pr_adhoc.yml b/.bitrise/pr_adhoc/bitrise_pr_adhoc.yml index 5a99cd8f79..9b55070cea 100644 --- a/.bitrise/pr_adhoc/bitrise_pr_adhoc.yml +++ b/.bitrise/pr_adhoc/bitrise_pr_adhoc.yml @@ -92,6 +92,8 @@ workflows: - script-runner@0: inputs: - file_path: ./.bitrise/pr_adhoc/create_pr_comment.sh + - working_dir: $BITRISE_SOURCE_DIR/.bitrise/pr_adhoc + title: Create PR Comment - comment-on-github-pull-request@0: inputs: - body: $PR_BUILDS_COMMENT @@ -99,6 +101,7 @@ workflows: - personal_access_token: $GITHUB_API_TOKEN is_always_run: false pr_adhoc_build: + summary: This workflow stamps the app icon and creates a QR code installable ad-hoc build used for pull request testing. description: "This step expects the following environment variables: \n$INST_XCODE_SCHEME (e.g., Horizon)\n$INST_XCODE_APPICON_PATH (e.g., Horizon/Horizon/Resources/Assets.xcassets/AppIcon.appiconset)\n\nThe output will be an environment variable called BITRISE_PUBLIC_INSTALL_PAGE_QR_CODE_IMAGE_URL_$INST_XCODE_SCHEME that'll contain the image url of the QR code pointing to the created application." steps: - set-xcode-build-number@2: @@ -115,26 +118,15 @@ workflows: - automatic_code_signing: api-key - icloud_container_environment: Production - scheme: $INST_XCODE_SCHEME - - verbose_log: "yes" - deploy-to-bitrise-io@2: inputs: - notify_user_groups: none - create-install-page-qr-code@1: {} - - script@1: + - script-runner@0: inputs: - - content: |- - #!/usr/bin/env bash - # fail if any commands fails - set -e - # make pipelines' return status equal the last command to exit with a non-zero status, or zero if all commands exit successfully - set -o pipefail - # debug log - set -x - - QR_KEY="BITRISE_PUBLIC_INSTALL_PAGE_QR_CODE_IMAGE_URL_${INST_XCODE_SCHEME}" - envman add --key $QR_KEY --value $BITRISE_PUBLIC_INSTALL_PAGE_QR_CODE_IMAGE_URL - title: Export QR Image URL - summary: This workflow stamps the app icon and creates a QR code installable ad-hoc build used for pull request testing. + - file_path: ./.bitrise/pr_adhoc/write_qr_url_to_file.sh + - working_dir: $BITRISE_SOURCE_DIR/.bitrise/pr_adhoc + title: Write QR URL To File _pr_adhoc_build_discovery: steps: - script@1: diff --git a/.bitrise/pr_adhoc/create_pr_comment.sh b/.bitrise/pr_adhoc/create_pr_comment.sh index cc9613c8f6..79b27560bd 100755 --- a/.bitrise/pr_adhoc/create_pr_comment.sh +++ b/.bitrise/pr_adhoc/create_pr_comment.sh @@ -6,24 +6,35 @@ set -o pipefail # debug log # set -x +# Reads files from the working directory containing QR code URLs +# for each app and creates a PR comment from them that will be exposed +# with envman in the $PR_BUILDS_COMMENT variable. +# File format is expected in this format: Student_qr_url + declare -a APP_NAMES=( - "BITRISE_PUBLIC_INSTALL_PAGE_QR_CODE_IMAGE_URL_Student:Student" - "BITRISE_PUBLIC_INSTALL_PAGE_QR_CODE_IMAGE_URL_Teacher:Teacher" - "BITRISE_PUBLIC_INSTALL_PAGE_QR_CODE_IMAGE_URL_Parent:Parent" - "BITRISE_PUBLIC_INSTALL_PAGE_QR_CODE_IMAGE_URL_Horizon:Horizon" + "Student" + "Teacher" + "Parent" + "Horizon" ) COLUMNS="" -for PAIR in "${APP_NAMES[@]}"; do - QR_URL="${PAIR%%:*}" - APP_NAME="${PAIR#*:}" - if [[ -n "${!QR_URL}" ]]; then +for APP_NAME in "${APP_NAMES[@]}"; do + FILE_NAME="${APP_NAME}_qr_url" + + + if [[ -f "${FILE_NAME}" ]]; then + QR_URL=$(<"${FILE_NAME}") + echo "${APP_NAME}'s QR url is ${QR_URL}." COLUMNS+="
" COLUMNS+="${APP_NAME}" - COLUMNS+="" + COLUMNS+="" COLUMNS+="
" - fi + else + echo "File ${FILE_NAME} not found." + fi + done PR_COMMENT="

Builds

" @@ -31,4 +42,5 @@ PR_COMMENT+="" PR_COMMENT+="${COLUMNS}" PR_COMMENT+="
" +printf "\nGenerated HTML snippet:\n${PR_COMMENT}" envman add --key PR_BUILDS_COMMENT --value $PR_COMMENT diff --git a/.bitrise/pr_adhoc/write_qr_url_to_file.sh b/.bitrise/pr_adhoc/write_qr_url_to_file.sh new file mode 100755 index 0000000000..07699d55ae --- /dev/null +++ b/.bitrise/pr_adhoc/write_qr_url_to_file.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +# fail if any commands fails +set -e +# make pipelines' return status equal the last command to exit with a non-zero status, or zero if all commands exit successfully +set -o pipefail +# debug log +# set -x + +# Writes the contents of the$BITRISE_PUBLIC_INSTALL_PAGE_QR_CODE_IMAGE_URL variable +# to a file named $INST_XCODE_SCHEME_qr_url to the working directory. +# We do this because we can't export variables with envman if the workflow is triggered +# via the "Bitrise Run" step. + +echo "${BITRISE_PUBLIC_INSTALL_PAGE_QR_CODE_IMAGE_URL}" > "${INST_XCODE_SCHEME}_qr_url" \ No newline at end of file From 28a1b41f83667e5c05e89f6747a62f70fab23d96 Mon Sep 17 00:00:00 2001 From: Attila Varga Date: Fri, 13 Dec 2024 18:21:06 +0100 Subject: [PATCH 26/37] Change img tag src to double quotes. Crank up compression on SPM cache. --- .bitrise/bitrise.yml | 4 +++- .bitrise/pr_adhoc/create_pr_comment.sh | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.bitrise/bitrise.yml b/.bitrise/bitrise.yml index 780180591e..f5297bddc0 100644 --- a/.bitrise/bitrise.yml +++ b/.bitrise/bitrise.yml @@ -64,7 +64,9 @@ workflows: for building/testing.' _common_save_spm_cache: steps: - - save-spm-cache@1: {} + - save-spm-cache@1: + inputs: + - compression_level: 19 summary: This workflow's only task is to save resolved SPM dependencies to the cache to be re-used later by other workflows (mainly the _common_prepare_workspace one). diff --git a/.bitrise/pr_adhoc/create_pr_comment.sh b/.bitrise/pr_adhoc/create_pr_comment.sh index 79b27560bd..2a3ae3fc63 100755 --- a/.bitrise/pr_adhoc/create_pr_comment.sh +++ b/.bitrise/pr_adhoc/create_pr_comment.sh @@ -29,7 +29,7 @@ for APP_NAME in "${APP_NAMES[@]}"; do echo "${APP_NAME}'s QR url is ${QR_URL}." COLUMNS+="
" COLUMNS+="${APP_NAME}" - COLUMNS+="" + COLUMNS+="" COLUMNS+="
" else echo "File ${FILE_NAME} not found." From b9fb70dd2864db9de4316b1bc140d200b81dd5a6 Mon Sep 17 00:00:00 2001 From: Attila Varga Date: Fri, 13 Dec 2024 18:35:10 +0100 Subject: [PATCH 27/37] Fix variable not being quoted during envman export. Turn off comment tag updating. --- .bitrise/pr_adhoc/bitrise_pr_adhoc.yml | 1 - .bitrise/pr_adhoc/create_pr_comment.sh | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.bitrise/pr_adhoc/bitrise_pr_adhoc.yml b/.bitrise/pr_adhoc/bitrise_pr_adhoc.yml index 9b55070cea..028c772098 100644 --- a/.bitrise/pr_adhoc/bitrise_pr_adhoc.yml +++ b/.bitrise/pr_adhoc/bitrise_pr_adhoc.yml @@ -97,7 +97,6 @@ workflows: - comment-on-github-pull-request@0: inputs: - body: $PR_BUILDS_COMMENT - - update_comment_tag: $INST_XCODE_SCHEME_Build - personal_access_token: $GITHUB_API_TOKEN is_always_run: false pr_adhoc_build: diff --git a/.bitrise/pr_adhoc/create_pr_comment.sh b/.bitrise/pr_adhoc/create_pr_comment.sh index 2a3ae3fc63..630a62ac9f 100755 --- a/.bitrise/pr_adhoc/create_pr_comment.sh +++ b/.bitrise/pr_adhoc/create_pr_comment.sh @@ -37,10 +37,10 @@ for APP_NAME in "${APP_NAMES[@]}"; do done -PR_COMMENT="

Builds

" +PR_COMMENT="

Builds

" PR_COMMENT+="" PR_COMMENT+="${COLUMNS}" PR_COMMENT+="
" printf "\nGenerated HTML snippet:\n${PR_COMMENT}" -envman add --key PR_BUILDS_COMMENT --value $PR_COMMENT +envman add --key PR_BUILDS_COMMENT --value "${PR_COMMENT}" From 4c14863b882ebc96908ba6ee1659eff3e243b4f2 Mon Sep 17 00:00:00 2001 From: Attila Varga Date: Mon, 16 Dec 2024 15:31:10 +0100 Subject: [PATCH 28/37] Minor updates, restore PR comment updating. [ignore-commit-lint] --- .bitrise/pr_adhoc/bitrise_pr_adhoc.yml | 6 ++++-- .bitrise/pr_adhoc/create_pr_comment.sh | 1 - .bitrise/pr_adhoc/write_qr_url_to_file.sh | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.bitrise/pr_adhoc/bitrise_pr_adhoc.yml b/.bitrise/pr_adhoc/bitrise_pr_adhoc.yml index 028c772098..3005ce6901 100644 --- a/.bitrise/pr_adhoc/bitrise_pr_adhoc.yml +++ b/.bitrise/pr_adhoc/bitrise_pr_adhoc.yml @@ -98,6 +98,7 @@ workflows: inputs: - body: $PR_BUILDS_COMMENT - personal_access_token: $GITHUB_API_TOKEN + - update_comment_tag: bitrise_adhoc_builds is_always_run: false pr_adhoc_build: summary: This workflow stamps the app icon and creates a QR code installable ad-hoc build used for pull request testing. @@ -170,7 +171,7 @@ workflows: envman add --key REQUIRE_PARENT --value "true" && envman add --key REQUIRE_TEACHER --value "true" && envman add --key REQUIRE_STUDENT --value "true" && - envman add --key REQUIRE_HORIZON --value + envman add --key REQUIRE_HORIZON --value "true" fi title: Discover Which Apps To Build summary: |- @@ -185,4 +186,5 @@ trigger_map: - pull_request_target_branch: regex: .* type: pull_request - workflow: pr_adhoc_builds \ No newline at end of file + workflow: pr_adhoc_builds + \ No newline at end of file diff --git a/.bitrise/pr_adhoc/create_pr_comment.sh b/.bitrise/pr_adhoc/create_pr_comment.sh index 630a62ac9f..fb1ddb6c5d 100755 --- a/.bitrise/pr_adhoc/create_pr_comment.sh +++ b/.bitrise/pr_adhoc/create_pr_comment.sh @@ -23,7 +23,6 @@ COLUMNS="" for APP_NAME in "${APP_NAMES[@]}"; do FILE_NAME="${APP_NAME}_qr_url" - if [[ -f "${FILE_NAME}" ]]; then QR_URL=$(<"${FILE_NAME}") echo "${APP_NAME}'s QR url is ${QR_URL}." diff --git a/.bitrise/pr_adhoc/write_qr_url_to_file.sh b/.bitrise/pr_adhoc/write_qr_url_to_file.sh index 07699d55ae..37187723cf 100755 --- a/.bitrise/pr_adhoc/write_qr_url_to_file.sh +++ b/.bitrise/pr_adhoc/write_qr_url_to_file.sh @@ -11,4 +11,4 @@ set -o pipefail # We do this because we can't export variables with envman if the workflow is triggered # via the "Bitrise Run" step. -echo "${BITRISE_PUBLIC_INSTALL_PAGE_QR_CODE_IMAGE_URL}" > "${INST_XCODE_SCHEME}_qr_url" \ No newline at end of file +echo "${BITRISE_PUBLIC_INSTALL_PAGE_QR_CODE_IMAGE_URL}" > "${INST_XCODE_SCHEME}_qr_url" From 3f204da3c79f95376ab27b587b898c135604d585 Mon Sep 17 00:00:00 2001 From: Attila Varga Date: Mon, 16 Dec 2024 18:20:02 +0100 Subject: [PATCH 29/37] Switch to the fastest compression on SPM cache. --- .bitrise/bitrise.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.bitrise/bitrise.yml b/.bitrise/bitrise.yml index f5297bddc0..5bf335c8df 100644 --- a/.bitrise/bitrise.yml +++ b/.bitrise/bitrise.yml @@ -66,7 +66,7 @@ workflows: steps: - save-spm-cache@1: inputs: - - compression_level: 19 + - compression_level: 1 summary: This workflow's only task is to save resolved SPM dependencies to the cache to be re-used later by other workflows (mainly the _common_prepare_workspace one). From 33f94aeef417db41d8cd2c282fd1c06af63239f2 Mon Sep 17 00:00:00 2001 From: Attila Varga Date: Tue, 17 Dec 2024 09:43:13 +0100 Subject: [PATCH 30/37] Update script headers. --- .bitrise/pr_adhoc/create_pr_comment.sh | 18 ++++++++++++++++++ .bitrise/pr_adhoc/write_qr_url_to_file.sh | 18 ++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/.bitrise/pr_adhoc/create_pr_comment.sh b/.bitrise/pr_adhoc/create_pr_comment.sh index fb1ddb6c5d..408c822af7 100755 --- a/.bitrise/pr_adhoc/create_pr_comment.sh +++ b/.bitrise/pr_adhoc/create_pr_comment.sh @@ -1,4 +1,22 @@ #!/usr/bin/env bash +# +# This file is part of Canvas. +# Copyright (C) 2024-present Instructure, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# + # fail if any commands fails set -e # make pipelines' return status equal the last command to exit with a non-zero status, or zero if all commands exit successfully diff --git a/.bitrise/pr_adhoc/write_qr_url_to_file.sh b/.bitrise/pr_adhoc/write_qr_url_to_file.sh index 37187723cf..1dd09acb56 100755 --- a/.bitrise/pr_adhoc/write_qr_url_to_file.sh +++ b/.bitrise/pr_adhoc/write_qr_url_to_file.sh @@ -1,4 +1,22 @@ #!/usr/bin/env bash +# +# This file is part of Canvas. +# Copyright (C) 2024-present Instructure, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# + # fail if any commands fails set -e # make pipelines' return status equal the last command to exit with a non-zero status, or zero if all commands exit successfully From 7e03c3371d3dbfa8a5a9db5263cb04aaef65b8f9 Mon Sep 17 00:00:00 2001 From: Attila Varga Date: Thu, 2 Jan 2025 12:13:23 +0100 Subject: [PATCH 31/37] Bump bitrise to Xcode 16.2. --- .bitrise/bitrise.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.bitrise/bitrise.yml b/.bitrise/bitrise.yml index 5bf335c8df..43d168782a 100644 --- a/.bitrise/bitrise.yml +++ b/.bitrise/bitrise.yml @@ -72,8 +72,8 @@ workflows: one). meta: bitrise.io: - stack: osx-xcode-16.0.x machine_type_id: g2-m1.8core + stack: osx-xcode-16.2.x app: envs: - BITRISE_PROJECT_PATH: Canvas.xcworkspace From 69f50bad9da61285c0ce5bd5dc19401923b9aafb Mon Sep 17 00:00:00 2001 From: Attila Varga Date: Thu, 2 Jan 2025 15:39:48 +0100 Subject: [PATCH 32/37] Update CSS. --- .bitrise/pr_adhoc/create_pr_comment.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.bitrise/pr_adhoc/create_pr_comment.sh b/.bitrise/pr_adhoc/create_pr_comment.sh index 408c822af7..8cebc910eb 100755 --- a/.bitrise/pr_adhoc/create_pr_comment.sh +++ b/.bitrise/pr_adhoc/create_pr_comment.sh @@ -44,7 +44,7 @@ for APP_NAME in "${APP_NAMES[@]}"; do if [[ -f "${FILE_NAME}" ]]; then QR_URL=$(<"${FILE_NAME}") echo "${APP_NAME}'s QR url is ${QR_URL}." - COLUMNS+="
" + COLUMNS+="
" COLUMNS+="${APP_NAME}" COLUMNS+="" COLUMNS+="
" From cf63560f086b33409457566af8f3419318cec357 Mon Sep 17 00:00:00 2001 From: Attila Varga Date: Mon, 6 Jan 2025 13:48:53 +0100 Subject: [PATCH 33/37] Extract app discovery shell script from yml file. --- .bitrise/pr_adhoc/bitrise_pr_adhoc.yml | 60 ++------------------ .bitrise/pr_adhoc/discover_apps_to_build.sh | 63 +++++++++++++++++++++ .bitrise/pr_adhoc/write_qr_url_to_file.sh | 2 +- 3 files changed, 68 insertions(+), 57 deletions(-) create mode 100755 .bitrise/pr_adhoc/discover_apps_to_build.sh diff --git a/.bitrise/pr_adhoc/bitrise_pr_adhoc.yml b/.bitrise/pr_adhoc/bitrise_pr_adhoc.yml index 3005ce6901..c101828394 100644 --- a/.bitrise/pr_adhoc/bitrise_pr_adhoc.yml +++ b/.bitrise/pr_adhoc/bitrise_pr_adhoc.yml @@ -7,8 +7,11 @@ workflows: - _common_save_spm_cache before_run: - _common_prepare_workspace - - _pr_adhoc_build_discovery steps: + - script-runner@0: + inputs: + - file_path: ./.bitrise/pr_adhoc/discover_apps_to_build.sh + title: Discover Which Apps To Build - script@1: inputs: - content: |- @@ -127,61 +130,6 @@ workflows: - file_path: ./.bitrise/pr_adhoc/write_qr_url_to_file.sh - working_dir: $BITRISE_SOURCE_DIR/.bitrise/pr_adhoc title: Write QR URL To File - _pr_adhoc_build_discovery: - steps: - - script@1: - inputs: - - content: |- - #!/usr/bin/env bash - # fail if any commands fails - set -e - # debug log - set -x - - # Assuming our commit message is in the correct format, we decide which tests to go on with - # $GIT_CLONE_COMMIT_MESSAGE_BODY - echo "Git msg: ${GIT_CLONE_COMMIT_MESSAGE_BODY}" - echo "Bitrise Pull Request: " - echo $BITRISE_PULL_REQUEST - echo "Bitrise Git Message: " - echo $BITRISE_GIT_MESSAGE - - if [[ ! -z $BITRISE_PULL_REQUEST ]]; then - envman add --key PR_NUMBER --value $BITRISE_PULL_REQUEST - else - envman add --key PR_NUMBER --value "NOT_PR" - fi - if [[ $BITRISE_GIT_MESSAGE == *"Student"* ]]; then - envman add --key REQUIRE_STUDENT --value "true" - fi - - if [[ $BITRISE_GIT_MESSAGE == *"Teacher"* ]]; then - envman add --key REQUIRE_TEACHER --value "true" - fi - - if [[ $BITRISE_GIT_MESSAGE == *"Parent"* ]]; then - envman add --key REQUIRE_PARENT --value "true" - fi - - if [[ $BITRISE_GIT_MESSAGE == *"Horizon"* ]]; then - envman add --key REQUIRE_HORIZON --value "true" - fi - - if [[ $BITRISE_GIT_MESSAGE == *"affects: All"* ]]; then - envman add --key REQUIRE_PARENT --value "true" && - envman add --key REQUIRE_TEACHER --value "true" && - envman add --key REQUIRE_STUDENT --value "true" && - envman add --key REQUIRE_HORIZON --value "true" - fi - title: Discover Which Apps To Build - summary: |- - This step analyzes the pull request's description and decides which apps to build. - - Outputs if conditions are met for each app: - - $REQUIRE_PARENT=true - - $REQUIRE_TEACHER=true - - $REQUIRE_STUDENT=true - - $REQUIRE_HORIZON=true trigger_map: - pull_request_target_branch: regex: .* diff --git a/.bitrise/pr_adhoc/discover_apps_to_build.sh b/.bitrise/pr_adhoc/discover_apps_to_build.sh new file mode 100755 index 0000000000..8aecc41a09 --- /dev/null +++ b/.bitrise/pr_adhoc/discover_apps_to_build.sh @@ -0,0 +1,63 @@ +#!/usr/bin/env bash +# +# This file is part of Canvas. +# Copyright (C) 2024-present Instructure, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# + +# fail if any commands fails +set -e +# make pipelines' return status equal the last command to exit with a non-zero status, or zero if all commands exit successfully +set -o pipefail +# debug log +# set -x + +# This script inspects the pull request's description and if it contains an app's name +# it sets the appropriate environment variable. +# +# Outputs if conditions are met for each app: +# - $REQUIRE_PARENT=true +# - $REQUIRE_TEACHER=true +# - $REQUIRE_STUDENT=true +# - $REQUIRE_HORIZON=true + +if [[ ! -z $BITRISE_PULL_REQUEST ]]; then + envman add --key PR_NUMBER --value $BITRISE_PULL_REQUEST +else + envman add --key PR_NUMBER --value "NOT_PR" +fi + +if [[ $BITRISE_GIT_MESSAGE == *"Student"* ]]; then + envman add --key REQUIRE_STUDENT --value "true" +fi + +if [[ $BITRISE_GIT_MESSAGE == *"Teacher"* ]]; then + envman add --key REQUIRE_TEACHER --value "true" +fi + +if [[ $BITRISE_GIT_MESSAGE == *"Parent"* ]]; then + envman add --key REQUIRE_PARENT --value "true" +fi + +if [[ $BITRISE_GIT_MESSAGE == *"Horizon"* ]]; then + envman add --key REQUIRE_HORIZON --value "true" +fi + +if [[ $BITRISE_GIT_MESSAGE == *"affects: All"* ]]; then + envman add --key REQUIRE_PARENT --value "true" && + envman add --key REQUIRE_TEACHER --value "true" && + envman add --key REQUIRE_STUDENT --value "true" && + envman add --key REQUIRE_HORIZON --value "true" +fi diff --git a/.bitrise/pr_adhoc/write_qr_url_to_file.sh b/.bitrise/pr_adhoc/write_qr_url_to_file.sh index 1dd09acb56..142b6cbf92 100755 --- a/.bitrise/pr_adhoc/write_qr_url_to_file.sh +++ b/.bitrise/pr_adhoc/write_qr_url_to_file.sh @@ -24,7 +24,7 @@ set -o pipefail # debug log # set -x -# Writes the contents of the$BITRISE_PUBLIC_INSTALL_PAGE_QR_CODE_IMAGE_URL variable +# Writes the contents of the $BITRISE_PUBLIC_INSTALL_PAGE_QR_CODE_IMAGE_URL variable # to a file named $INST_XCODE_SCHEME_qr_url to the working directory. # We do this because we can't export variables with envman if the workflow is triggered # via the "Bitrise Run" step. From 98fcd167708a17866c925a4c85090ab8dac78460 Mon Sep 17 00:00:00 2001 From: Attila Varga Date: Mon, 6 Jan 2025 14:36:38 +0100 Subject: [PATCH 34/37] Remove custom CSS since they don't work in github comments. --- .bitrise/pr_adhoc/create_pr_comment.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.bitrise/pr_adhoc/create_pr_comment.sh b/.bitrise/pr_adhoc/create_pr_comment.sh index 8cebc910eb..408c822af7 100755 --- a/.bitrise/pr_adhoc/create_pr_comment.sh +++ b/.bitrise/pr_adhoc/create_pr_comment.sh @@ -44,7 +44,7 @@ for APP_NAME in "${APP_NAMES[@]}"; do if [[ -f "${FILE_NAME}" ]]; then QR_URL=$(<"${FILE_NAME}") echo "${APP_NAME}'s QR url is ${QR_URL}." - COLUMNS+="
" + COLUMNS+="
" COLUMNS+="${APP_NAME}" COLUMNS+="" COLUMNS+="
" From 916296524b2b3e806ecf9794789e53ed7786395f Mon Sep 17 00:00:00 2001 From: Attila Varga Date: Mon, 6 Jan 2025 14:54:10 +0100 Subject: [PATCH 35/37] Unify tabs to 4 spaces in shell scripts. --- .bitrise/pr_adhoc/create_pr_comment.sh | 12 ++++++------ .bitrise/pr_adhoc/discover_apps_to_build.sh | 20 ++++++++++---------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.bitrise/pr_adhoc/create_pr_comment.sh b/.bitrise/pr_adhoc/create_pr_comment.sh index 408c822af7..204dd6e368 100755 --- a/.bitrise/pr_adhoc/create_pr_comment.sh +++ b/.bitrise/pr_adhoc/create_pr_comment.sh @@ -39,18 +39,18 @@ declare -a APP_NAMES=( COLUMNS="" for APP_NAME in "${APP_NAMES[@]}"; do - FILE_NAME="${APP_NAME}_qr_url" + FILE_NAME="${APP_NAME}_qr_url" - if [[ -f "${FILE_NAME}" ]]; then - QR_URL=$(<"${FILE_NAME}") - echo "${APP_NAME}'s QR url is ${QR_URL}." + if [[ -f "${FILE_NAME}" ]]; then + QR_URL=$(<"${FILE_NAME}") + echo "${APP_NAME}'s QR url is ${QR_URL}." COLUMNS+="
" COLUMNS+="${APP_NAME}" COLUMNS+="" COLUMNS+="
" else - echo "File ${FILE_NAME} not found." - fi + echo "File ${FILE_NAME} not found." + fi done diff --git a/.bitrise/pr_adhoc/discover_apps_to_build.sh b/.bitrise/pr_adhoc/discover_apps_to_build.sh index 8aecc41a09..455abd2b7a 100755 --- a/.bitrise/pr_adhoc/discover_apps_to_build.sh +++ b/.bitrise/pr_adhoc/discover_apps_to_build.sh @@ -34,30 +34,30 @@ set -o pipefail # - $REQUIRE_HORIZON=true if [[ ! -z $BITRISE_PULL_REQUEST ]]; then - envman add --key PR_NUMBER --value $BITRISE_PULL_REQUEST + envman add --key PR_NUMBER --value $BITRISE_PULL_REQUEST else - envman add --key PR_NUMBER --value "NOT_PR" + envman add --key PR_NUMBER --value "NOT_PR" fi if [[ $BITRISE_GIT_MESSAGE == *"Student"* ]]; then - envman add --key REQUIRE_STUDENT --value "true" + envman add --key REQUIRE_STUDENT --value "true" fi if [[ $BITRISE_GIT_MESSAGE == *"Teacher"* ]]; then - envman add --key REQUIRE_TEACHER --value "true" + envman add --key REQUIRE_TEACHER --value "true" fi if [[ $BITRISE_GIT_MESSAGE == *"Parent"* ]]; then - envman add --key REQUIRE_PARENT --value "true" + envman add --key REQUIRE_PARENT --value "true" fi if [[ $BITRISE_GIT_MESSAGE == *"Horizon"* ]]; then - envman add --key REQUIRE_HORIZON --value "true" + envman add --key REQUIRE_HORIZON --value "true" fi if [[ $BITRISE_GIT_MESSAGE == *"affects: All"* ]]; then - envman add --key REQUIRE_PARENT --value "true" && - envman add --key REQUIRE_TEACHER --value "true" && - envman add --key REQUIRE_STUDENT --value "true" && - envman add --key REQUIRE_HORIZON --value "true" + envman add --key REQUIRE_PARENT --value "true" && + envman add --key REQUIRE_TEACHER --value "true" && + envman add --key REQUIRE_STUDENT --value "true" && + envman add --key REQUIRE_HORIZON --value "true" fi From 1166254971e6dd6a00c17be5460837dd6f5a0375 Mon Sep 17 00:00:00 2001 From: Attila Varga Date: Tue, 7 Jan 2025 11:02:38 +0100 Subject: [PATCH 36/37] Update workflow comment. Make details tag open by default. --- .bitrise/pr_adhoc/bitrise_pr_adhoc.yml | 2 +- .bitrise/pr_adhoc/create_pr_comment.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.bitrise/pr_adhoc/bitrise_pr_adhoc.yml b/.bitrise/pr_adhoc/bitrise_pr_adhoc.yml index c101828394..88c8f46838 100644 --- a/.bitrise/pr_adhoc/bitrise_pr_adhoc.yml +++ b/.bitrise/pr_adhoc/bitrise_pr_adhoc.yml @@ -105,7 +105,7 @@ workflows: is_always_run: false pr_adhoc_build: summary: This workflow stamps the app icon and creates a QR code installable ad-hoc build used for pull request testing. - description: "This step expects the following environment variables: \n$INST_XCODE_SCHEME (e.g., Horizon)\n$INST_XCODE_APPICON_PATH (e.g., Horizon/Horizon/Resources/Assets.xcassets/AppIcon.appiconset)\n\nThe output will be an environment variable called BITRISE_PUBLIC_INSTALL_PAGE_QR_CODE_IMAGE_URL_$INST_XCODE_SCHEME that'll contain the image url of the QR code pointing to the created application." + description: "This step expects the following environment variables: \n$INST_XCODE_SCHEME (e.g., Horizon)\n$INST_XCODE_APPICON_PATH (e.g., Horizon/Horizon/Resources/Assets.xcassets/AppIcon.appiconset)\n\nThe output will be a file with the name ${INST_XCODE_SCHEME}_qr_url that will contain the image url of the QR code pointing to the created application. The file is needed because we can't export environment variables in case the workflow is run via the Bitrise Run step." steps: - set-xcode-build-number@2: inputs: diff --git a/.bitrise/pr_adhoc/create_pr_comment.sh b/.bitrise/pr_adhoc/create_pr_comment.sh index 204dd6e368..f756f058b3 100755 --- a/.bitrise/pr_adhoc/create_pr_comment.sh +++ b/.bitrise/pr_adhoc/create_pr_comment.sh @@ -44,7 +44,7 @@ for APP_NAME in "${APP_NAMES[@]}"; do if [[ -f "${FILE_NAME}" ]]; then QR_URL=$(<"${FILE_NAME}") echo "${APP_NAME}'s QR url is ${QR_URL}." - COLUMNS+="
" + COLUMNS+="
" COLUMNS+="${APP_NAME}" COLUMNS+="" COLUMNS+="
" From 60b0868dba5c3e708e89fa54c72723dc0f9fa26a Mon Sep 17 00:00:00 2001 From: Attila Varga Date: Wed, 8 Jan 2025 16:25:52 +0100 Subject: [PATCH 37/37] Remove unnecessary environment settings from time zone update step. Split adhoc yml into two separate ones. --- .bitrise/bitrise.yml | 4 +-- .bitrise/pr_adhoc/workflow_pr_adhoc_build.yml | 30 +++++++++++++++++++ ...adhoc.yml => workflow_pr_adhoc_builds.yml} | 30 ++----------------- Canvas.xcworkspace/contents.xcworkspacedata | 3 ++ 4 files changed, 36 insertions(+), 31 deletions(-) create mode 100644 .bitrise/pr_adhoc/workflow_pr_adhoc_build.yml rename .bitrise/pr_adhoc/{bitrise_pr_adhoc.yml => workflow_pr_adhoc_builds.yml} (73%) diff --git a/.bitrise/bitrise.yml b/.bitrise/bitrise.yml index 43d168782a..f1d1abe1ad 100644 --- a/.bitrise/bitrise.yml +++ b/.bitrise/bitrise.yml @@ -3,7 +3,7 @@ format_version: '13' default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git project_type: ios include: - - path: .bitrise/pr_adhoc/bitrise_pr_adhoc.yml + - path: .bitrise/pr_adhoc/workflow_pr_adhoc_builds.yml workflows: _common_prepare_workspace: steps: @@ -30,8 +30,6 @@ workflows: - content: |- #!/usr/bin/env bash sudo systemsetup -settimezone America/Denver - envman add --key BITRISE_CONFIGURATION --value Adhoc - envman add --key BITRISE_SCHEME --value Student title: Update timezone to MST - git::git@github.com:instructure/steps-canvas-ios-secrets.git@master: title: Canvas iOS Secrets diff --git a/.bitrise/pr_adhoc/workflow_pr_adhoc_build.yml b/.bitrise/pr_adhoc/workflow_pr_adhoc_build.yml new file mode 100644 index 0000000000..385cb9c6a0 --- /dev/null +++ b/.bitrise/pr_adhoc/workflow_pr_adhoc_build.yml @@ -0,0 +1,30 @@ +--- +format_version: '13' +workflows: + pr_adhoc_build: + summary: This workflow stamps the app icon and creates a QR code installable ad-hoc build used for pull request testing. + description: "This step expects the following environment variables: \n$INST_XCODE_SCHEME (e.g., Horizon)\n$INST_XCODE_APPICON_PATH (e.g., Horizon/Horizon/Resources/Assets.xcassets/AppIcon.appiconset)\n\nThe output will be a file with the name ${INST_XCODE_SCHEME}_qr_url that will contain the image url of the QR code pointing to the created application. The file is needed because we can't export environment variables in case the workflow is run via the Bitrise Run step." + steps: + - set-xcode-build-number@2: + inputs: + - scheme: $INST_XCODE_SCHEME + - bitrise-step-stamp-appicon-with-version-number@1: + inputs: + - stamp_version: PR + - stamp_build_number: $PR_NUMBER + - stamp_path_to_icons: $INST_XCODE_APPICON_PATH + - xcode-archive@5: + inputs: + - distribution_method: ad-hoc + - automatic_code_signing: api-key + - icloud_container_environment: Production + - scheme: $INST_XCODE_SCHEME + - deploy-to-bitrise-io@2: + inputs: + - notify_user_groups: none + - create-install-page-qr-code@1: {} + - script-runner@0: + inputs: + - file_path: ./.bitrise/pr_adhoc/write_qr_url_to_file.sh + - working_dir: $BITRISE_SOURCE_DIR/.bitrise/pr_adhoc + title: Write QR URL To File diff --git a/.bitrise/pr_adhoc/bitrise_pr_adhoc.yml b/.bitrise/pr_adhoc/workflow_pr_adhoc_builds.yml similarity index 73% rename from .bitrise/pr_adhoc/bitrise_pr_adhoc.yml rename to .bitrise/pr_adhoc/workflow_pr_adhoc_builds.yml index 88c8f46838..5a98916fba 100644 --- a/.bitrise/pr_adhoc/bitrise_pr_adhoc.yml +++ b/.bitrise/pr_adhoc/workflow_pr_adhoc_builds.yml @@ -1,5 +1,7 @@ --- format_version: '13' +include: + - path: .bitrise/pr_adhoc/workflow_pr_adhoc_build.yml workflows: pr_adhoc_builds: status_report_name: Ad-Hoc Builds @@ -103,36 +105,8 @@ workflows: - personal_access_token: $GITHUB_API_TOKEN - update_comment_tag: bitrise_adhoc_builds is_always_run: false - pr_adhoc_build: - summary: This workflow stamps the app icon and creates a QR code installable ad-hoc build used for pull request testing. - description: "This step expects the following environment variables: \n$INST_XCODE_SCHEME (e.g., Horizon)\n$INST_XCODE_APPICON_PATH (e.g., Horizon/Horizon/Resources/Assets.xcassets/AppIcon.appiconset)\n\nThe output will be a file with the name ${INST_XCODE_SCHEME}_qr_url that will contain the image url of the QR code pointing to the created application. The file is needed because we can't export environment variables in case the workflow is run via the Bitrise Run step." - steps: - - set-xcode-build-number@2: - inputs: - - scheme: $INST_XCODE_SCHEME - - bitrise-step-stamp-appicon-with-version-number@1: - inputs: - - stamp_version: PR - - stamp_build_number: $PR_NUMBER - - stamp_path_to_icons: $INST_XCODE_APPICON_PATH - - xcode-archive@5: - inputs: - - distribution_method: ad-hoc - - automatic_code_signing: api-key - - icloud_container_environment: Production - - scheme: $INST_XCODE_SCHEME - - deploy-to-bitrise-io@2: - inputs: - - notify_user_groups: none - - create-install-page-qr-code@1: {} - - script-runner@0: - inputs: - - file_path: ./.bitrise/pr_adhoc/write_qr_url_to_file.sh - - working_dir: $BITRISE_SOURCE_DIR/.bitrise/pr_adhoc - title: Write QR URL To File trigger_map: - pull_request_target_branch: regex: .* type: pull_request workflow: pr_adhoc_builds - \ No newline at end of file diff --git a/Canvas.xcworkspace/contents.xcworkspacedata b/Canvas.xcworkspace/contents.xcworkspacedata index 48d5898084..16d514e7f2 100644 --- a/Canvas.xcworkspace/contents.xcworkspacedata +++ b/Canvas.xcworkspace/contents.xcworkspacedata @@ -44,6 +44,9 @@ location = "group:TeacherE2E.xctestplan"> + +