Skip to content
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

optimize gha #84

Merged
merged 5 commits into from
Oct 26, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 64 additions & 5 deletions .github/workflows/swift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,15 @@ on:
branches: [ main ]

jobs:
cancel_previous:
runs-on: ubuntu-latest
steps:
- uses: styfle/cancel-workflow-action@0.9.1
with:
workflow_id: ${{ github.event.workflow.id }}

build_and_test_spm_mac:
needs: cancel_previous
runs-on: macos-11
steps:
- uses: maxim-lobanov/setup-xcode@v1
Expand All @@ -25,6 +33,7 @@ jobs:
run: swift test

build_and_test_spm_linux:
needs: cancel_previous
runs-on: ubuntu-latest
steps:
- uses: fwal/setup-swift@v1
Expand All @@ -42,6 +51,7 @@ jobs:
run: swift test --enable-test-discovery

build_and_test_ios:
needs: cancel_previous
runs-on: macos-11
steps:
- uses: maxim-lobanov/setup-xcode@v1
Expand All @@ -50,12 +60,20 @@ jobs:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/cache@v2
with:
path: /Users/runner/Library/Developer/Xcode/DerivedData/**/SourcePackages/checkouts
key: ${{ runner.os }}-spm-ios-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-ios
- uses: webfactory/ssh-agent@v0.5.3
with:
ssh-private-key: ${{ secrets.SOVRAN_SSH_KEY }}
- run: xcodebuild -scheme Segment-Package test -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 11'


build_and_test_tvos:
needs: cancel_previous
runs-on: macos-11
steps:
- uses: maxim-lobanov/setup-xcode@v1
Expand All @@ -64,12 +82,19 @@ jobs:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/cache@v2
with:
path: /Users/runner/Library/Developer/Xcode/DerivedData/**/SourcePackages/checkouts
key: ${{ runner.os }}-spm-tvos-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-tvos
- uses: webfactory/ssh-agent@v0.5.3
with:
ssh-private-key: ${{ secrets.SOVRAN_SSH_KEY }}
- run: xcodebuild -scheme Segment-Package test -sdk appletvsimulator -destination 'platform=tvOS Simulator,name=Apple TV'

build_and_test_watchos:
needs: cancel_previous
runs-on: macos-11
steps:
- uses: maxim-lobanov/setup-xcode@v1
Expand All @@ -78,12 +103,19 @@ jobs:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/cache@v2
with:
path: /Users/runner/Library/Developer/Xcode/DerivedData/**/SourcePackages/checkouts
key: ${{ runner.os }}-spm-watchos-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-watchos
- uses: webfactory/ssh-agent@v0.5.3
with:
ssh-private-key: ${{ secrets.SOVRAN_SSH_KEY }}
- run: xcodebuild -scheme Segment-Package test -sdk watchsimulator -destination 'platform=watchOS Simulator,name=Apple Watch Series 5 - 40mm'

build_examples:
build_and_test_examples:
needs: cancel_previous
runs-on: macos-11
steps:
- uses: maxim-lobanov/setup-xcode@v1
Expand All @@ -92,17 +124,19 @@ jobs:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/cache@v2
with:
path: /Users/runner/Library/Developer/Xcode/DerivedData
key: ${{ runner.os }}-spm-examples-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-examples
- uses: webfactory/ssh-agent@v0.5.3
with:
ssh-private-key: ${{ secrets.SOVRAN_SSH_KEY }}
- name: build for ios simulator
run: |
cd Examples/apps/BasicExample
xcodebuild -workspace "BasicExample.xcworkspace" -scheme "BasicExample" -sdk iphonesimulator
- name: build for ios simulator
run: |
cd Examples/apps/DestinationsExample
xcodebuild -workspace "DestinationsExample.xcworkspace" -scheme "DestinationsExample" -sdk iphonesimulator
- name: build for ios simulator
run: |
cd Examples/apps/ObjCExample
Expand All @@ -115,3 +149,28 @@ jobs:
run: |
cd Examples/apps/SegmentUIKitExample
xcodebuild -workspace "SegmentUIKitExample.xcworkspace" -scheme "SegmentUIKitExample" -destination 'platform=macOS,variant=Mac Catalyst'


build_and_test_dest_examples:
needs: cancel_previous
runs-on: macos-11
steps:
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '13.0'
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/cache@v2
with:
path: /Users/runner/Library/Developer/Xcode/DerivedData
key: ${{ runner.os }}-spm-dest-example-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-dest-example
- uses: webfactory/ssh-agent@v0.5.3
with:
ssh-private-key: ${{ secrets.SOVRAN_SSH_KEY }}
- name: build for ios simulator
run: |
cd Examples/apps/DestinationsExample
xcodebuild -workspace "DestinationsExample.xcworkspace" -scheme "DestinationsExample" -sdk iphonesimulator