-
Notifications
You must be signed in to change notification settings - Fork 0
feat: ACI-3938 Activate xcode step #2
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
Merged
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
3597d0d
feat: ACI-3938 Activate xcode step
zsolt-marta-bitrise 82b7762
fix: ACI-3938 lint
zsolt-marta-bitrise b7ce728
fix: ACI-3938 Commit
zsolt-marta-bitrise 31710dd
fix: ACI-3938 Only mac
zsolt-marta-bitrise 16308a2
feat: ACI-3938 Log
zsolt-marta-bitrise c3a56cf
feat: ACI-3938 Always gather info
zsolt-marta-bitrise 288f207
feat: ACI-3938 Always gather info
zsolt-marta-bitrise 0a183f2
feat: ACI-3938 Build signal
zsolt-marta-bitrise 994fd96
fix: ACI-3938 Deps
zsolt-marta-bitrise 2e26647
fix: ACI-3938 Deps
zsolt-marta-bitrise eb56c2b
fix: ACI-3938 Remove xcpretty
zsolt-marta-bitrise 24c581b
fix: ACI-3938 Remove tee
zsolt-marta-bitrise 469da02
fix: Build test app
zsolt-marta-bitrise 1cdf47d
fix: No need for deps
zsolt-marta-bitrise 5f114f0
fix: branch
zsolt-marta-bitrise 1999c73
fix: Use source
zsolt-marta-bitrise ea64f47
fix: Use source
zsolt-marta-bitrise 3e97864
fix: print xcodebuild location
zsolt-marta-bitrise c571783
tmp: alias manually
zsolt-marta-bitrise ce8d5f4
tmp: alias manually
zsolt-marta-bitrise 825deae
tmp: ls bin folder
zsolt-marta-bitrise b21605c
tmp: move to cli
zsolt-marta-bitrise 12043c3
fix: Revert manual alias, add path to envman
zsolt-marta-bitrise ec248bc
fix: Remove manual envman
zsolt-marta-bitrise 76929c4
fix: udpate README
zsolt-marta-bitrise File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| .bitrise* | ||
| .idea | ||
| .vscode | ||
| README.md.backup | ||
| _tmp/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,19 @@ | ||
| # bitrise-step-xcode-enable-compilation-cache | ||
| # Bitrise Build Cache Add-On for Xcode | ||
|
|
||
| Enables the Bitrise Build Cache Add-On for Xcode. | ||
|
|
||
| ## What this step does | ||
|
|
||
| - Configures the build using the Build Cache CLI so Bitrise Remote Build Cache is used. | ||
| - Ensures all subsequent Xcode builds in the workflow will read from the remote cache and push new entries. | ||
| - Adds a PATH entry to make the CLI available in all subsequent steps. | ||
| - From this point on, all calls to `xcodebuild` are wrapped so the underlying Xcode command has compilation caching enabled. | ||
| - The wrapper script in in `~/.bitrise-xcelerate/bin` and it's added as `xcodebuild` to the path in `~/.zshrc` and `~/.bashrc`, | ||
| - The PATH is also exported through `envman` so it's available in subsequent steps. | ||
| - Saves analytical data (command, duration, cache information, environment) to Bitrise. The data is available on the Build cache page: https://app.bitrise.io/build-cache | ||
|
|
||
| ## Notes | ||
|
|
||
| - Xcode 26 Beta 4 is required to use the remote cache. | ||
| - The wrapper in the PATH persists only for subsequent steps in the current workflow run. | ||
| - Ensure your workflow uses `xcodebuild` (or compatible tooling) to benefit from the remote cache. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| format_version: "11" | ||
| default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git | ||
|
|
||
| workflows: | ||
| check: | ||
| steps: | ||
| - git::https://github.com/bitrise-steplib/steps-check.git: | ||
| inputs: | ||
| - skip_go_checks: "yes" | ||
| - workflow: lint | ||
|
|
||
| e2e: | ||
| steps: | ||
| - git::https://github.com/bitrise-steplib/steps-check.git: | ||
| inputs: | ||
| - workflow: e2e | ||
| - skip_go_checks: "yes" | ||
|
|
||
| generate_readme: | ||
| steps: | ||
| - git::https://github.com/bitrise-steplib/steps-readme-generator.git@main: { } | ||
|
|
||
| test_run_the_step: | ||
| steps: | ||
| - path::./: | ||
| run_if: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| format_version: "11" | ||
| default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git | ||
|
|
||
| app: | ||
| envs: | ||
| - TEST_APP_URL: https://github.com/bitrise-io/swift-package-deckofplayingcards | ||
| - BRANCH: main | ||
|
|
||
| workflows: | ||
| test_xcc: | ||
| after_run: | ||
| - _setup | ||
| - _run | ||
| - _check | ||
| _run: | ||
| steps: | ||
| - path::./: | ||
| title: Execute step | ||
| run_if: "true" | ||
| is_skippable: false | ||
| inputs: | ||
| - verbose: "true" | ||
| - change-workdir: | ||
| title: Switch working dir to _tmp | ||
| inputs: | ||
| - path: ./_tmp | ||
| - script: | ||
| title: build app | ||
| inputs: | ||
| - content: |- | ||
| #!/usr/bin/env bash | ||
| set -eo pipefail | ||
|
|
||
| if [ $(uname -s) != "Darwin" ]; then | ||
| echo "This workflow only works on macOS stack!" | ||
| exit 0 | ||
| fi | ||
|
|
||
| echo "xcodebuild location with which: $(which xcodebuild)" | ||
| echo "xcodebuild location with type: $(type xcodebuild)" | ||
|
|
||
| ls -hal ~/.bitrise-xcelerate/bin/ | ||
|
|
||
| echo "Starting build..." | ||
| xcodebuild build -destination 'generic/platform=iOS' \ | ||
| -scheme DeckOfPlayingCards \ | ||
| CODE_SIGN_IDENTITY= CODE_SIGNING_REQUIRED=NO -showBuildTimingSummary 2> wrapper.log > xcodebuild.log | ||
|
|
||
| _check: | ||
| steps: | ||
| - script: | ||
| title: gather info | ||
| is_always_run: true | ||
| inputs: | ||
| - content: |- | ||
| set -exo pipefail | ||
|
|
||
| cp ~/.bitrise-xcelerate/config.json $BITRISE_DEPLOY_DIR || true | ||
| cp ~/.bitrise-xcelerate/proxy.err.log $BITRISE_DEPLOY_DIR || true | ||
| cp ~/.bitrise-xcelerate/proxy.out.log $BITRISE_DEPLOY_DIR || true | ||
| cp xcodebuild.log $BITRISE_DEPLOY_DIR || true | ||
| cp wrapper.log $BITRISE_DEPLOY_DIR || true | ||
|
|
||
| cat "$BITRISE_DEPLOY_DIR/wrapper.log" || true | ||
| head -n 20 $BITRISE_DEPLOY_DIR/xcodebuild.log || true | ||
| tail -n 20 $BITRISE_DEPLOY_DIR/xcodebuild.log || true | ||
| - deploy-to-bitrise-io: { } | ||
| - script: | ||
| title: Check if the step is working | ||
| inputs: | ||
| - content: |- | ||
| #!/bin/bash | ||
| set -ex | ||
|
|
||
| if [ $(uname -s) != "Darwin" ]; then | ||
| echo "This workflow only works on macOS stack!" | ||
| exit 0 | ||
| fi | ||
|
|
||
| # We need Xcode beta stack for checkign the cache and the current CI setup dos not suppor that. The CLI has comprehensive tests for this. | ||
| # Let's just check that the invocation is saved. | ||
|
|
||
| if grep -q "Invocation saved" wrapper.log; then | ||
| echo "xcodebuild invocation found in log" | ||
| else | ||
| echo "xcodebuild invocation NOT found in log" | ||
| exit 1 | ||
| fi | ||
|
|
||
| _setup: | ||
| steps: | ||
| - script: | ||
| title: Delete _tmp dir | ||
| inputs: | ||
| - content: rm -rf _tmp | ||
| - git::https://github.com/bitrise-steplib/bitrise-step-simple-git-clone.git: | ||
| inputs: | ||
| - repository_url: $TEST_APP_URL | ||
| - clone_into_dir: ./_tmp | ||
| - branch: $BRANCH | ||
zsolt-marta-bitrise marked this conversation as resolved.
Show resolved
Hide resolved
zsolt-marta-bitrise marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| { | ||
| "$schema": "https://docs.renovatebot.com/renovate-schema.json", | ||
| "extends": [ | ||
| "local>bitrise-steplib/.github:renovate-config" | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| # 'read' has to be before 'set -e' | ||
| read -r -d '' UNAVAILABLE_MESSAGE << EOF_MSG | ||
| Bitrise Build Cache is not activated in this build. | ||
|
|
||
| You have added the **Activate Bitrise Build Cache for Xcode** add-on step to your workflow. | ||
|
|
||
| However, you don't have an activate Bitrise Build Cache Trial or Subscription for the current workspace yet. | ||
|
|
||
| You can activate a Trial at [app.bitrise.io/build-cache](https://app.bitrise.io/build-cache), | ||
| or contact us at [support@bitrise.io](mailto:support@bitrise.io) to activate it. | ||
| EOF_MSG | ||
|
|
||
| set -eo pipefail | ||
|
|
||
| echo "Checking whether Bitrise Build Cache is activated for this workspace ..." | ||
| if [ "$BITRISEIO_BUILD_CACHE_ENABLED" != "true" ]; then | ||
| printf "\n%s\n" "$UNAVAILABLE_MESSAGE" | ||
| set -x | ||
| bitrise plugin install https://github.com/bitrise-io/bitrise-plugins-annotations.git | ||
| bitrise :annotations annotate "$UNAVAILABLE_MESSAGE" --style error || { | ||
| echo "Failed to create annotation" | ||
| exit 3 | ||
| } | ||
| exit 2 | ||
| fi | ||
| echo "Bitrise Build Cache is activated in this workspace, configuring the build environment ..." | ||
|
|
||
| # download the Bitrise Build Cache CLI | ||
| export BITRISE_BUILD_CACHE_CLI_VERSION="v1.0.0" | ||
| curl --retry 5 -m 30 -sSfL 'https://raw.githubusercontent.com/bitrise-io/bitrise-build-cache-cli/main/install/installer.sh' | sh -s -- -b /tmp/bin -d $BITRISE_BUILD_CACHE_CLI_VERSION || true | ||
zsolt-marta-bitrise marked this conversation as resolved.
Show resolved
Hide resolved
zsolt-marta-bitrise marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| # Fall back to Artifact Registry if the download failed | ||
| if [ ! -f /tmp/bin/bitrise-build-cache ]; then | ||
| echo "Failed to download Bitrise Build Cache CLI, trying Artifact Registry ..." | ||
|
|
||
| version="${BITRISE_BUILD_CACHE_CLI_VERSION#v}" | ||
| os=$(uname -s | tr '[:upper:]' '[:lower:]') | ||
| arch=$(uname -m | sed 's/x86_64/amd64/' | sed 's/aarch64/arm64/') | ||
| package="bitrise-build-cache_${os}_${arch}.tar.gz" | ||
| filename="bitrise-build-cache_${version}_${os}_${arch}.tar.gz" | ||
|
|
||
| filepath="$package:$version:$filename" | ||
|
|
||
| echo "Downloading Bitrise Build Cache CLI from Artifact Registry: ${filepath}" | ||
|
|
||
| curl --retry 5 -m 60 -sSfL "https://artifactregistry.googleapis.com/download/v1/projects/ip-build-cache-prod/locations/us-central1/repositories/build-cache-cli-releases/files/${filepath}:download?alt=media" -o $package | ||
| tar -xzf "$package" | ||
| mkdir -p /tmp/bin | ||
| mv "bitrise-build-cache" /tmp/bin/bitrise-build-cache | ||
| rm -rf "$package" | ||
zsolt-marta-bitrise marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| fi | ||
|
|
||
| if [ ! -f /tmp/bin/bitrise-build-cache ]; then | ||
| echo "Failed to download Bitrise Build Cache CLI, exiting." | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ "$verbose" != "true" ] && [ "$verbose" != "false" ]; then | ||
| echo "Parsing inputs failed: Verbose logging ($verbose) is not a valid option." | ||
| fi | ||
zsolt-marta-bitrise marked this conversation as resolved.
Show resolved
Hide resolved
zsolt-marta-bitrise marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| # run the Bitrise Build Cache CLI | ||
| /tmp/bin/bitrise-build-cache activate xcode --debug="$verbose" --cache | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| title: Build Cache for Xcode | ||
| summary: Activates Bitrise Remote Build Cache add-on for subsequent Xcode builds in the workflow | ||
| description: | | ||
| This Step enables Bitrise's Build Cache Add‑On for Xcode by configuring the environment with the Build Cache CLI. | ||
|
|
||
| After this Step runs, Xcode builds invoked via xcodebuild in subsequent workflow steps will automatically read from the remote cache and push new entries when applicable. | ||
|
|
||
| The Step adds an alias to ~/.zshrc and ~/.bashrc so the wrapper is available in all following steps; from that point all xcodebuild calls are wrapped to enable compilation caching. | ||
| Analytical data (command, duration, cache information, environment) is collected and sent to Bitrise and is available on the Build cache page: https://app.bitrise.io/build-cache | ||
| website: https://github.com/bitrise-steplib/bitrise-step-activate-xcode-remote-cache | ||
| source_code_url: https://github.com/bitrise-steplib/bitrise-step-activate-xcode-remote-cache | ||
| support_url: https://github.com/bitrise-steplib/bitrise-step-activate-xcode-remote-cache | ||
|
|
||
| type_tags: | ||
| - utility | ||
|
|
||
| run_if: .IsCI | ||
| is_skippable: true | ||
|
|
||
| toolkit: | ||
| bash: | ||
| entry_file: step.sh | ||
|
|
||
| inputs: | ||
| - verbose: "false" | ||
| opts: | ||
| title: Verbose logging | ||
| summary: Enable logging additional information for troubleshooting | ||
| is_required: true | ||
| value_options: | ||
| - "true" | ||
| - "false" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.