Skip to content

Commit

Permalink
ci: update for tuist
Browse files Browse the repository at this point in the history
  • Loading branch information
watt committed Dec 3, 2024
1 parent cda870e commit b14ff99
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 57 deletions.
31 changes: 8 additions & 23 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,13 @@ jobs:
runs-on: macos-14-xlarge

steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/checkout@v4
- uses: jdx/mise-action@v2

- name: Read env
run: cat .github/workflows/env.properties >> $GITHUB_ENV
- name: Run swiftformat
run: swiftformat --lint .

- name: Switch to Xcode ${{ env.xcode_version }}
run: sudo xcode-select -s /Applications/Xcode_${{ env.xcode_version }}.app

- name: Cache SPM build
uses: actions/cache@v2
with:
path: .build
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-
- name: Run SwiftFormat
run: |
swift run -c release swiftformat --lint .
- name: Report error
if: ${{ failure() }}
run: |
echo '::error::SwiftFormat linting failed. Run `Scripts/swiftformat` to format your code.'
- name: Report error
if: ${{ failure() }}
run: |
echo '::error::SwiftFormat linting failed. Run `Scripts/swiftformat` to format your code.'
53 changes: 19 additions & 34 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,31 @@ jobs:

runs-on: macos-14-xlarge

env:
TUIST_TEST_DEVICE: iPhone SE (3rd generation)
TUIST_TEST_PLATFORM: iOS

strategy:
fail-fast: false # Don’t fail-fast so that we get all snapshot test changes
matrix:
include:
- sdk: "15.4"
destination: platform=iOS Simulator,OS=15.4,name=iPhone SE (3rd generation)
simctl_runtime: "com.apple.CoreSimulator.SimRuntime.iOS-15-4"
installation_required: true

- sdk: "16.2"
destination: platform=iOS Simulator,OS=16.2,name=iPhone SE (3rd generation)
simctl_runtime: "com.apple.CoreSimulator.SimRuntime.iOS-16-2"
installation_required: true

- sdk: "17.2"
destination: platform=iOS Simulator,OS=17.2,name=iPhone SE (3rd generation)
simctl_runtime: "com.apple.CoreSimulator.SimRuntime.iOS-17-2"
# The iOS 17.2 SDK is pre-installed on the macOS 13 image.
# Attempting to install it will fail with an error.
installation_required: false

steps:
- uses: actions/checkout@v4
- uses: jdx/mise-action@v2

- name: Read env
run: cat .github/workflows/env.properties >> $GITHUB_ENV
Expand All @@ -46,9 +51,18 @@ jobs:
if: ${{ matrix.installation_required }}
run: sudo xcodes runtimes install "iOS ${{ matrix.sdk }}"

- name: Build & Test
- name: Ensure sim exists
run: |
xcodebuild -scheme "BlueprintUI-Package" -destination "${{ matrix.destination }}" build test
xcrun simctl create \
"${{ env.TUIST_TEST_DEVICE }}" \
"${{ env.TUIST_TEST_DEVICE }}" \
"${{ matrix.simctl_runtime }}"
- name: Install dependencies
run: tuist install --path SampleApp

- name: Build & Test
run: tuist test --path SampleApp --os ${{ matrix.sdk }} UnitTests

- name: Package snapshot changes
if: ${{ failure() }}
Expand All @@ -61,32 +75,3 @@ jobs:
with:
name: snapshot_changes_${{ matrix.sdk }}
path: snapshot_changes_${{ matrix.sdk }}.tar


cocoapods:
name: "CocoaPods"

runs-on: macos-14-xlarge

steps:
- uses: actions/checkout@v4

- name: Read env
run: cat .github/workflows/env.properties >> $GITHUB_ENV

- name: Switch to Xcode ${{ env.xcode_version }}
run: sudo xcode-select -s /Applications/Xcode_${{ env.xcode_version }}.app

- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
# Uses version specified in .ruby_version
bundler-cache: true # runs 'bundle install' and caches installed gems automatically

- name: Pod Install
run: |
bundle exec pod install --project-directory=SampleApp/
- name: Build & Test
run: |
xcodebuild -workspace SampleApp/SampleApp.xcworkspace -scheme "BlueprintUI-Unit-Tests" -destination "platform=iOS Simulator,OS=17.2,name=iPhone SE (3rd generation)"

0 comments on commit b14ff99

Please sign in to comment.