Skip to content

Commit

Permalink
Caching tuist output to share between jobs (#83)
Browse files Browse the repository at this point in the history
  • Loading branch information
BobaFetters authored and runner committed Oct 12, 2023
1 parent d3e8df8 commit bb63a39
Show file tree
Hide file tree
Showing 4 changed files with 100 additions and 66 deletions.
3 changes: 1 addition & 2 deletions .github/actions/build-and-run-unit-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,4 @@ runs:
- name: Build and Test
shell: bash
run: |
xcodebuild clean test -resultBundlePath TestResults/ResultBundle.xcresult -derivedDataPath DerivedData -workspace "ApolloDev.xcworkspace" -scheme "${{ inputs.scheme }}" -destination "${{ inputs.destination }}" -testPlan "${{ inputs.test-plan }}" | xcbeautify
# Add step for saving build/test artifacts
xcodebuild clean test -resultBundlePath TestResults/ResultBundle.xcresult -derivedDataPath DerivedData -workspace "ApolloDev.xcworkspace" -scheme "${{ inputs.scheme }}" -destination "${{ inputs.destination }}" -testPlan "${{ inputs.test-plan }}" | xcbeautify
10 changes: 0 additions & 10 deletions .github/actions/setup-repo/action.yml

This file was deleted.

72 changes: 48 additions & 24 deletions .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,30 @@ env:
XCODE_VERSION: "15.0.0"

jobs:
tuist-generation:
runs-on: macos-13
timeout-minutes: 8
name: Run Tuist Generation
steps:
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ env.XCODE_VERSION }}
- name: Checkout Repo
uses: actions/checkout@v3
- name: Run Tuist Generation
uses: tuist/[email protected]
with:
command: 'generate'
arguments: ''
- name: Cache Build Dependencies
uses: actions/cache@v3
with:
path: |
./ApolloDev.xcodeproj
./ApolloDev.xcworkspace
./Derived/*
key: ${{ github.run_id }}-dependencies

run-swift-builds:
runs-on: macos-13
timeout-minutes: 15
Expand All @@ -25,16 +49,14 @@ jobs:
xcode-version: ${{ env.XCODE_VERSION }}
- name: Checkout Repo
uses: actions/checkout@v3
- name: Setup Repo
id: setup-repo
uses: ./.github/actions/setup-repo
- name: Run Swift Build
shell: bash
run: |
cd ${{ matrix.package }} && swift build
build-and-unit-test:
runs-on: macos-13
needs: tuist-generation
timeout-minutes: 20
strategy:
fail-fast: false
Expand Down Expand Up @@ -65,19 +87,25 @@ jobs:
xcode-version: ${{ env.XCODE_VERSION }}
- name: Checkout Repo
uses: actions/checkout@v3
- name: Setup Repo
id: setup-repo
uses: ./.github/actions/setup-repo
- name: Retrieve Build Cache
uses: actions/cache@v3
with:
path: |
./ApolloDev.xcodeproj
./ApolloDev.xcworkspace
./Derived/*
key: ${{ github.run_id }}-dependencies
fail-on-cache-miss: true
# Caching for apollo-ios and apollo-ios-codegen SPM dependencies
# - uses: actions/cache@v3
# with:
# path: ./DerivedData/SourcePackages
# key: ${{ runner.os }}-spm-${{ hashFiles('./apollo-ios/Package.resolved') }}-${{ hashFiles('./apollo-ios-codegen/Package.resolved') }}
- name: Run Tuist Generation
uses: tuist/[email protected]
with:
command: 'generate'
arguments: ''
# - name: Run Tuist Generation
# uses: tuist/[email protected]
# with:
# command: 'generate'
# arguments: ''
- name: Build and Test
uses: ./.github/actions/build-and-run-unit-tests
with:
Expand Down Expand Up @@ -124,9 +152,6 @@ jobs:
xcode-version: ${{ env.XCODE_VERSION }}
- name: Checkout Repo
uses: actions/checkout@v3
- name: Setup Repo
id: setup-repo
uses: ./.github/actions/setup-repo
- name: Install XCBeautify
shell: bash
run: |
Expand All @@ -146,9 +171,6 @@ jobs:
xcode-version: ${{ env.XCODE_VERSION }}
- name: Checkout Repo
uses: actions/checkout@v3
- name: Setup Repo
id: setup-repo
uses: ./.github/actions/setup-repo
- name: Export ENV Variables
shell: bash
working-directory: apollo-ios
Expand All @@ -161,6 +183,7 @@ jobs:

run-integration-tests:
runs-on: macos-13
needs: tuist-generation
timeout-minutes: 20
name: Apollo Integration Tests - macOS
steps:
Expand All @@ -169,9 +192,6 @@ jobs:
xcode-version: ${{ env.XCODE_VERSION }}
- name: Checkout Repo
uses: actions/checkout@v3
- name: Setup Repo
id: setup-repo
uses: ./.github/actions/setup-repo
- name: Setup Node 12.22.10
uses: actions/setup-node@v3
with:
Expand All @@ -195,11 +215,15 @@ jobs:
run: |
sh ./scripts/install-or-update-starwars-server.sh
cd ../starwars-server && npm start &
- name: Run Tuist Generation
uses: tuist/[email protected]
- name: Retrieve Build Cache
uses: actions/cache@v3
with:
command: 'generate'
arguments: ''
path: |
./ApolloDev.xcodeproj
./ApolloDev.xcworkspace
./Derived/*
key: ${{ github.run_id }}-dependencies
fail-on-cache-miss: true
- name: Build and Test
uses: ./.github/actions/build-and-run-unit-tests
with:
Expand Down
81 changes: 51 additions & 30 deletions .github/workflows/release-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,30 @@ env:
XCODE_VERSION: "15.0.0"

jobs:
tuist-generation:
runs-on: macos-13
timeout-minutes: 8
name: Run Tuist Generation
steps:
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ env.XCODE_VERSION }}
- name: Checkout Repo
uses: actions/checkout@v3
- name: Run Tuist Generation
uses: tuist/[email protected]
with:
command: 'generate'
arguments: ''
- name: Cache Build Dependencies
uses: actions/cache@v3
with:
path: |
./ApolloDev.xcodeproj
./ApolloDev.xcworkspace
./Derived/*
key: ${{ github.run_id }}-dependencies

run-swift-builds:
runs-on: macos-13
timeout-minutes: 15
Expand All @@ -26,16 +50,14 @@ jobs:
xcode-version: ${{ env.XCODE_VERSION }}
- name: Checkout Repo
uses: actions/checkout@v3
- name: Setup Repo
id: setup-repo
uses: ./.github/actions/setup-repo
- name: Run Swift Build
shell: bash
run: |
cd ${{ matrix.package }} && swift build
build-and-unit-test:
runs-on: macos-13
needs: tuist-generation
timeout-minutes: 20
strategy:
fail-fast: false
Expand Down Expand Up @@ -78,19 +100,20 @@ jobs:
xcode-version: ${{ env.XCODE_VERSION }}
- name: Checkout Repo
uses: actions/checkout@v3
- name: Setup Repo
id: setup-repo
uses: ./.github/actions/setup-repo
# Caching for apollo-ios and apollo-ios-codegen SPM dependencies
# - uses: actions/cache@v3
# with:
# path: ./DerivedData/SourcePackages
# key: ${{ runner.os }}-spm-${{ hashFiles('./apollo-ios/Package.resolved') }}-${{ hashFiles('./apollo-ios-codegen/Package.resolved') }}
- name: Run Tuist Generation
uses: tuist/[email protected]
- name: Retrieve Build Cache
uses: actions/cache@v3
with:
command: 'generate'
arguments: ''
path: |
./ApolloDev.xcodeproj
./ApolloDev.xcworkspace
./Derived/*
key: ${{ github.run_id }}-dependencies
fail-on-cache-miss: true
- name: Build and Test
uses: ./.github/actions/build-and-run-unit-tests
with:
Expand Down Expand Up @@ -129,6 +152,7 @@ jobs:
legacy-unit-test:
runs-on: macos-11
needs: tuist-generation
timeout-minutes: 20
strategy:
fail-fast: false
Expand All @@ -143,19 +167,20 @@ jobs:
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Setup Repo
id: setup-repo
uses: ./.github/actions/setup-repo
# Caching for apollo-ios and apollo-ios-codegen SPM dependencies
# - uses: actions/cache@v3
# with:
# path: ./DerivedData/SourcePackages
# key: ${{ runner.os }}-spm-${{ hashFiles('./apollo-ios/Package.resolved') }}-${{ hashFiles('./apollo-ios-codegen/Package.resolved') }}
- name: Run Tuist Generation
uses: tuist/[email protected]
- name: Retrieve Build Cache
uses: actions/cache@v3
with:
command: 'generate'
arguments: ''
path: |
./ApolloDev.xcodeproj
./ApolloDev.xcworkspace
./Derived/*
key: ${{ github.run_id }}-dependencies
fail-on-cache-miss: true
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: 12.4.0
Expand Down Expand Up @@ -205,9 +230,6 @@ jobs:
xcode-version: ${{ env.XCODE_VERSION }}
- name: Checkout Repo
uses: actions/checkout@v3
- name: Setup Repo
id: setup-repo
uses: ./.github/actions/setup-repo
- name: Install XCBeautify
shell: bash
run: |
Expand All @@ -227,9 +249,6 @@ jobs:
xcode-version: ${{ env.XCODE_VERSION }}
- name: Checkout Repo
uses: actions/checkout@v3
- name: Setup Repo
id: setup-repo
uses: ./.github/actions/setup-repo
- name: Export ENV Variables
shell: bash
working-directory: apollo-ios
Expand All @@ -242,6 +261,7 @@ jobs:

run-integration-tests:
runs-on: macos-13
needs: tuist-generation
timeout-minutes: 20
name: Apollo Integration Tests - macOS
steps:
Expand All @@ -250,9 +270,6 @@ jobs:
xcode-version: ${{ env.XCODE_VERSION }}
- name: Checkout Repo
uses: actions/checkout@v3
- name: Setup Repo
id: setup-repo
uses: ./.github/actions/setup-repo
- name: Setup Node 12.22.10
uses: actions/setup-node@v3
with:
Expand All @@ -276,11 +293,15 @@ jobs:
run: |
sh ./scripts/install-or-update-starwars-server.sh
cd ../starwars-server && npm start &
- name: Run Tuist Generation
uses: tuist/[email protected]
- name: Retrieve Build Cache
uses: actions/cache@v3
with:
command: 'generate'
arguments: ''
path: |
./ApolloDev.xcodeproj
./ApolloDev.xcworkspace
./Derived/*
key: ${{ github.run_id }}-dependencies
fail-on-cache-miss: true
- name: Build and Test
uses: ./.github/actions/build-and-run-unit-tests
with:
Expand Down

0 comments on commit bb63a39

Please sign in to comment.