No preview QR code on Github PR

Question or problem

I’ve got Tuist set up and running with test results being added to my PRs within our Github Repo. I’ve just updated our workflows to create preview builds shared via Tuist. I was hoping these would appear in the same comment as the test results but I’m not seeing anything so far. Are there are any other steps I’m missing?

I’ve noticed there’s no branch noted against the preview on the dashboard - could that be the missing link that the bot needs to post on the correct PR? How is that set/detected?

Expectation

QR code & link to use the tuist preview is shared on the PR similar to the test results.

Context

  • Tuist version: 4.49.0
  • Github app is set up

Reproduction (mandatory for problems)

jobs:
  determine-runner:
    uses: ./.github/workflows/determine-runner.yml
    secrets: inherit

  build:
    name: Build & Test
    needs: determine-runner
    runs-on: ${{ fromJSON(needs.determine-runner.outputs.runner-label) }}
    environment: Development
    permissions: write-all
    steps:
      - name: Select Xcode version
        uses: maxim-lobanov/setup-xcode@v1
        with:
          xcode-version: latest-stable
      - name: Checkout project
        uses: actions/checkout@v4
      - name: Restore SPM artifacts cache
        id: cache-tuist-restore
        uses: actions/cache/restore@v4
        with:
          path: |
            ./Tuist/.build/checkouts
            ./Tuist/.build/artifacts
            ./Tuist/.build/workspace-state.json
          key: ${{ runner.os }}-tuist-cache
      - name: Install Tuist
        uses: jdx/mise-action@v2
      - name: Download dependencies and create project workspace
        run: |
          bundle install
          tuist install
          tuist cache -c Debug
          tuist generate -c Debug
      - name: Save SPM artifacts in cache
        id: cache-tuist-save
        uses: actions/cache/save@v4
        with:
          path: |
            ./Tuist/.build/checkouts
            ./Tuist/.build/artifacts
            ./Tuist/.build/workspace-state.json
          key: ${{ steps.cache-tuist-restore.outputs.cache-primary-key }}
      - name: Set App Build Number
        uses: poad/xcode-build-number-auto-update@v1
        with:
          path: ./Derived/InfoPlists/Hyper-Info.plist
          new-number: ${{ env.BUILD_NUMBER }}
      - name: Set App Clip Build Number
        uses: poad/xcode-build-number-auto-update@v1
        with:
          path: ./Derived/InfoPlists/HyperAppClip-Info.plist
          new-number: ${{ env.BUILD_NUMBER }}
      - name: Run tests
        run: tuist test AutomationTest -C Debug --test-plan HyperUnitTestPlan --result-bundle-path TestResults.xcresult --no-selective-testing

  release:
    name: Build (Release Configuration)
    needs: determine-runner
    runs-on: ${{ fromJSON(needs.determine-runner.outputs.runner-label) }}
    environment: Development
    permissions: write-all
    steps:
      - name: Select Xcode version
        uses: maxim-lobanov/setup-xcode@v1
        with:
          xcode-version: latest-stable
      - name: Checkout project
        uses: actions/checkout@v4
      - name: Restore SPM artifacts cache
        id: cache-tuist-restore
        uses: actions/cache/restore@v4
        with:
          path: |
            ./Tuist/.build/checkouts
            ./Tuist/.build/artifacts
            ./Tuist/.build/workspace-state.json
          key: ${{ runner.os }}-tuist-cache-release
      - name: Install Tuist
        uses: jdx/mise-action@v2
      - name: Download dependencies and create project workspace
        run: |
          bundle install
          tuist install
          tuist cache -c Release
          tuist generate -c Release
        env:
          TUIST_PREVIEW: 1
      - name: Save SPM artifacts in cache
        id: cache-tuist-save
        uses: actions/cache/save@v4
        with:
          path: |
            ./Tuist/.build/checkouts
            ./Tuist/.build/artifacts
            ./Tuist/.build/workspace-state.json
          key: ${{ steps.cache-tuist-restore.outputs.cache-primary-key }}
      - name: Set App Build Number
        uses: poad/xcode-build-number-auto-update@v1
        with:
          path: ./Derived/InfoPlists/Hyper-Info.plist
          new-number: ${{ env.BUILD_NUMBER }}
      - name: Set App Clip Build Number
        uses: poad/xcode-build-number-auto-update@v1
        with:
          path: ./Derived/InfoPlists/HyperAppClip-Info.plist
          new-number: ${{ env.BUILD_NUMBER }}
      - name: Build Preview Build
        run: bundle exec fastlane ios preview environment:"Staging"

      - name: Share Release build via Tuist
        run: tuist share Hyper.ipa
        env:
          TUIST_PREVIEW: 1

I’ve noticed there’s no branch noted against the preview on the dashboard - could that be the missing link that the bot needs to post on the correct PR?

That’s a good shout :smile:

GitHub Actions runs the action in a detached HEAD state; previously, we naively tried to get the current branch running git branch --show-current which did not work.
We fixed this and the branch should now be correctly picked up for all CI providers running with detached HEAD on Tuist 4.51.2 and later.

If you’re able, I’d suggest upgrading the Tuist CLI - the branch name should definitely start popping up on the dashboard, and I am also relatively confident that this will also fix the issue with preview-related comments not appearing.

2 Likes

You’re absolutely spot on, upgrading to a version later than 4.51.2 did the trick! Thanks very much!

2 Likes