From eb8e0800297b49ebae0817caa743b78c9649ecc5 Mon Sep 17 00:00:00 2001 From: Denis Andrasec Date: Thu, 9 Oct 2025 10:52:53 +0200 Subject: [PATCH] Use `env` vars instead of direct interpolation in `run` commands --- .../build-xcframework-variant-slices.yml | 41 +++++++++++++++---- .github/workflows/ui-tests-common.yml | 16 ++++++-- 2 files changed, 44 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build-xcframework-variant-slices.yml b/.github/workflows/build-xcframework-variant-slices.yml index 8f401273e08..273ed0249ff 100644 --- a/.github/workflows/build-xcframework-variant-slices.yml +++ b/.github/workflows/build-xcframework-variant-slices.yml @@ -77,17 +77,25 @@ jobs: - name: Get version id: get-version + env: + GITHUB_SHA: ${{ github.sha }} + RELEASE_VERSION: ${{ inputs.release-version }} run: | - if [ -n "${{ inputs.release-version }}" ]; then - echo "VERSION=${{ inputs.release-version }}" >> $GITHUB_ENV + if [ -n "$RELEASE_VERSION" ]; then + echo "VERSION=$RELEASE_VERSION" >> $GITHUB_ENV else - echo "VERSION=$(grep MARKETING_VERSION Sources/Configuration/Versioning.xcconfig | cut -d ' ' -f 3)+${{ github.sha }}" >> $GITHUB_ENV + echo "VERSION=$(grep MARKETING_VERSION Sources/Configuration/Versioning.xcconfig | cut -d ' ' -f 3)+$GITHUB_SHA" >> $GITHUB_ENV fi shell: sh - name: Compute cache key + env: + RUNNER_OS: ${{ runner.os }} + VARIANT_ID: ${{ inputs.variant-id }} + MATRIX_SDK: ${{ matrix.sdk }} + VERSION: ${{ env.VERSION }} run: | - echo "SENTRY_XCFRAMEWORK_CACHE_KEY=${{ runner.os }}-xcframework-${{inputs.variant-id}}-slice-${{matrix.sdk}}-${{ env.VERSION }}-${{hashFiles('Sources/**')}}-${{hashFiles('Sentry.xcodeproj/**')}}" >> $GITHUB_ENV + echo "SENTRY_XCFRAMEWORK_CACHE_KEY=${RUNNER_OS}-xcframework-${VARIANT_ID}-slice-${MATRIX_SDK}-${VERSION}-${{hashFiles('Sources/**')}}-${{hashFiles('Sentry.xcodeproj/**')}}" >> $GITHUB_ENV - name: Restore xcarchive cache id: cache-xcarchive @@ -98,28 +106,43 @@ jobs: - name: Bump version if: steps.cache-xcarchive.outputs.cache-hit != 'true' + env: + VERSION: ${{ env.VERSION }} run: | ./scripts/ci-select-xcode.sh 15.2 - make bump-version TO=${{ env.VERSION }} + make bump-version TO=$VERSION - name: Build ${{inputs.name}}${{inputs.suffix}} XCFramework slice for ${{matrix.sdk}} if: steps.cache-xcarchive.outputs.cache-hit != 'true' - run: ./scripts/build-xcframework-slice.sh ${{matrix.sdk}} ${{inputs.name}} "${{inputs.suffix}}" "${{inputs.macho-type}}" "${{inputs.configuration-suffix}}" + env: + MATRIX_SDK: ${{ matrix.sdk }} + INPUT_NAME: ${{ inputs.name }} + INPUT_SUFFIX: ${{ inputs.suffix }} + INPUT_MACHO_TYPE: ${{ inputs.macho-type }} + INPUT_CONFIG_SUFFIX: ${{ inputs.configuration-suffix }} + run: ./scripts/build-xcframework-slice.sh "$MATRIX_SDK" "$INPUT_NAME" "$INPUT_SUFFIX" "$INPUT_MACHO_TYPE" "$INPUT_CONFIG_SUFFIX" shell: bash # The SentrySwiftUI archive build also builds Sentry.framework as a byproduct of the dependency. We need to remove that to avoid downstream assembly tasks from tripping on these extra files. In the future we could investigate using this byproduct instead of running a separate task for Sentry.framework, or use the one already built by that other task instead of rebuilding it here. - name: Remove Sentry.framework from SentrySwiftUI build if: steps.cache-xcarchive.outputs.cache-hit != 'true' && inputs.name == 'SentrySwiftUI' + env: + GITHUB_WORKSPACE: ${{ github.workspace }} run: | - find "${{github.workspace}}/Carthage/archive" -name "Sentry.framework" -print0 | xargs -t0 rm -rf - find "${{github.workspace}}/Carthage/archive" -name "Sentry.framework.dSYM" -print0 | xargs -t0 rm -rf + find "$GITHUB_WORKSPACE/Carthage/archive" -name "Sentry.framework" -print0 | xargs -t0 rm -rf + find "$GITHUB_WORKSPACE/Carthage/archive" -name "Sentry.framework.dSYM" -print0 | xargs -t0 rm -rf shell: bash # the upload action broke symlinks in the mac sdk slice's xcarchive - name: Zip xcarchive if: steps.cache-xcarchive.outputs.cache-hit != 'true' + env: + GITHUB_WORKSPACE: ${{ github.workspace }} + INPUT_NAME: ${{ inputs.name }} + INPUT_SUFFIX: ${{ inputs.suffix }} + MATRIX_SDK: ${{ matrix.sdk }} run: | - ditto -c -k -X --rsrc --keepParent ${{github.workspace}}/Carthage/archive/${{inputs.name}}${{inputs.suffix}}/${{matrix.sdk}}.xcarchive ${{inputs.name}}${{inputs.suffix}}.xcarchive.zip + ditto -c -k -X --rsrc --keepParent ${GITHUB_WORKSPACE}/Carthage/archive/${INPUT_NAME}${INPUT_SUFFIX}/${MATRIX_SDK}.xcarchive ${INPUT_NAME}${INPUT_SUFFIX}.xcarchive.zip shell: bash - name: Cache xcarchive diff --git a/.github/workflows/ui-tests-common.yml b/.github/workflows/ui-tests-common.yml index 993a8802b1b..4b8c55612fb 100644 --- a/.github/workflows/ui-tests-common.yml +++ b/.github/workflows/ui-tests-common.yml @@ -80,11 +80,17 @@ jobs: XCODE_VERSION: ${{ inputs.xcode_version }} - name: Install required platforms for Xcode 26 if: ${{ inputs.xcode_version == '26.0.1' }} - run: ./scripts/ci-install-xOS-26-platforms.sh --platforms "${{inputs.platform}}" + env: + PLATFORM: ${{ inputs.platform }} + run: ./scripts/ci-install-xOS-26-platforms.sh --platforms "$PLATFORM" - name: Create simulator device for Xcode 26 if: ${{ inputs.xcode_version == '26.0.1' }} - run: ./scripts/ci-create-simulator.sh --platform "${{inputs.platform}}" --os-version "${{inputs.test-destination-os}}" --device-name "${{inputs.device}}" + env: + PLATFORM: ${{ inputs.platform }} + OS_VERSION: ${{ inputs.test-destination-os }} + DEVICE_NAME: ${{ inputs.device }} + run: ./scripts/ci-create-simulator.sh --platform "$PLATFORM" --os-version "$OS_VERSION" --device-name "$DEVICE_NAME" - run: make init-ci-build if: ${{ inputs.build_with_make }} @@ -109,9 +115,11 @@ jobs: - name: Run Fastlane env: FASTLANE_COMMAND: ${{ inputs.fastlane_command }} + DEVICE: ${{ inputs.device }} + TEST_DESTINATION_OS: ${{ inputs.test-destination-os }} run: | - if [ -n "${{inputs.device}}" ] && [ -n "${{inputs.test-destination-os}}" ]; then - bundle exec fastlane "$FASTLANE_COMMAND" device:"${{inputs.device}} (${{inputs.test-destination-os}})" + if [ -n "$DEVICE" ] && [ -n "$TEST_DESTINATION_OS" ]; then + bundle exec fastlane "$FASTLANE_COMMAND" device:"$DEVICE ($TEST_DESTINATION_OS)" else bundle exec fastlane "$FASTLANE_COMMAND" fi