Skip to content

Commit

Permalink
tech: Reduce GitHub Actions workflow complexity
Browse files Browse the repository at this point in the history
Project is undergoing a major refactoring period
where different approaches and fixes from various
repository forks are coming together.

Workflow is temporarily reduced in complexity and
coverage to get builds validating what is actually
supported.
  • Loading branch information
surpher committed Jun 2, 2024
1 parent e4c9593 commit ce73270
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 217 deletions.
141 changes: 34 additions & 107 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,138 +1,65 @@
name: Build

on:
push:
branches:
- 'main'
- 'chore/**'
- 'docs/**'
- 'feat/**'
- 'feature/**'
- 'fix/**'
- 'refactor/**'
- 'releases/**'
- 'style/**'
- 'test/**'
- 'tech/**'
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
workflow_dispatch:

env:
RUST_TARGET_PATH: pact-reference

jobs:
test:
name: Run ${{ matrix.platform }} on ${{ matrix.host }}
test_ios:
name: "🤖 Test iOS"
runs-on: ${{ matrix.host }}

strategy:
fail-fast: true
matrix:
host: [macos-11, macos-12]
host: [macos-13, macos-14]
platform: [ios, macos]
include:
- platform: ios
scheme: "PactSwift-iOS"
destination: "platform=iOS Simulator,name=iPhone 12 Pro"
destination: "platform=iOS Simulator,name=iPhone 15 Pro"
- platform: macos
scheme: "PactSwift-macOS"
destination: "arch=x86_64"
- host: macos-11
xcode: 13.2.1
- host: macos-12
xcode: 14.0.1
- host: macos-13
xcode: 14.3.1
- host: macos-14
xcode: 15.3

env:
SCHEME: ${{ matrix.scheme }}
SCHEME: "PactSwift-iOS"
DESTINATION: ${{ matrix.destination }}

concurrency:
group: test_${{ matrix.host }}_${{ matrix.scheme }}_${{ github.ref }}
group: test_${{ matrix.host }}_${{ matrix.xcode }}_iOS_${{ github.ref }}
cancel-in-progress: true

steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: "🧑‍💻 Checkout repository"
uses: actions/checkout@v3

- name: Use Xcode ${{ matrix.xcode }}
- name: "🏭 Use Xcode ${{ matrix.xcode }}"
run: sudo xcode-select -switch /Applications/Xcode_${{ matrix.xcode }}.app

- name: Prepare Tools
run: |
Scripts/prepare_build_tools
- name: Run tests (Xcode)
run: |
set -o pipefail && xcodebuild clean test -project PactSwift.xcodeproj -scheme "$SCHEME" -destination "$DESTINATION" GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES GCC_GENERATE_TEST_COVERAGE_FILES=YES | xcbeautify
- name: Run tests (CLI - Swift Package)
run: |
swift build
swift test -c release
test_linux:
name: Run on Ubuntu
runs-on: ubuntu-latest

strategy:
fail-fast: true

concurrency:
group: test-linux-${{ github.ref }}
cancel-in-progress: true

steps:
- uses: fwal/setup-swift@v1
- name: Get swift version
run: swift --version

- name: "⬇️ Checkout repository"
uses: actions/checkout@v2

- name: Install Protoc
uses: arduino/setup-protoc@v1

- name: "♼ Cache rust binaries"
uses: actions/cache@v3
with:
path: |
${{ env.RUST_TARGET_PATH }}
key: build-${{ runner.os }}-rust-pactswift-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
build-${{ runner.os }}-rust-pactswift
build-${{ runner.os }}-rust-
- name: "⚗️ Build and Test"
run: |
Scripts/build_test_linux
test_carthage:
name: "Verify for Carthage"
runs-on: macos-12

strategy:
fail-fast: true

concurrency:
group: test-carthage-${{ github.ref }}
cancel-in-progress: true

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Use Xcode 13.4.1
run: sudo xcode-select -switch /Applications/Xcode_13.4.1.app

- name: Carthage build
run: |
carthage build --use-xcframeworks --no-skip-current
after_success:
needs: [test, test_carthage, test_linux]
name: Build demo projects
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest

steps:
- name: Build demo projects
- name: "🧪 Run tests (xcodebuild)"
run: |
curl -X POST https://api.github.com/repos/surpher/pact-swift-examples/dispatches -H 'Accept: application/vnd.github.everest-preview+json' -u ${{ secrets.PACT_SWIFT_TOKEN }} --data '{"event_type":"PactSwift - ${{ github.event.head_commit.message }}"}'
set -o pipefail && \
xcodebuild -resolvePackageDependencies && \
xcodebuild test \
-project PactSwift.xcodeproj \
-scheme "$SCHEME"\
-destination "$DESTINATION" \
| xcbeautify
# - name: "⚗️ Run tests (swift)"
# run: |
# swift build
# swift test -c release
110 changes: 0 additions & 110 deletions .github/workflows/build_pr.yml

This file was deleted.

0 comments on commit ce73270

Please sign in to comment.