diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..b1006b0 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,51 @@ +name: PactKit CI + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "*" ] + +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: true + +jobs: + build-and-test-library: + name: Test PactKitCore + runs-on: macos-15 + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Cache Swift PM dependencies + uses: actions/cache@v4 + with: + path: .build + key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }} + restore-keys: | + ${{ runner.os }}-spm- + + - name: Select Xcode 16.4 + run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer + + - name: Run library tests + run: swift test + + build-example-app: + name: Build Example App + needs: build-and-test-library + runs-on: macos-15 + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Select Xcode 16.4 + run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer + + - name: Build iOS Example App + run: | + xcodebuild build \ + -project Examples/PactKit-iOS-Example/PactKit-iOS-Example.xcodeproj \ + -scheme PactKit-iOS-Example \ + -destination 'platform=iOS Simulator,name=iPhone 16 Pro' diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml new file mode 100644 index 0000000..351ed11 --- /dev/null +++ b/.github/workflows/documentation.yml @@ -0,0 +1,45 @@ +name: Documentation + +on: + push: + branches: + - main + workflow_dispatch: + +concurrency: + group: docs-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: write + +jobs: + deploy-docs: + name: Deploy Documentation + runs-on: macos-15 + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Select Xcode 16.4 + run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer + + - name: Generate DocC documentation + run: | + swift package \ + --allow-writing-to-directory ./public \ + generate-documentation \ + --target PactKitCore \ + --output-path ./public \ + --transform-for-static-hosting \ + --hosting-base-path PactKit + + - name: Create .nojekyll file + run: touch ./public/.nojekyll + + - name: Deploy to GitHub Pages + uses: JamesIves/github-pages-deploy-action@v4 + with: + branch: gh-pages + folder: public diff --git a/.github/workflows/swift-ci.yml b/.github/workflows/swift-ci.yml deleted file mode 100644 index 7c59c2a..0000000 --- a/.github/workflows/swift-ci.yml +++ /dev/null @@ -1,62 +0,0 @@ -name: PactKit CI & Docs - -on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - -jobs: - build-and-test: - name: Build and Test - - runs-on: macos-15 - - steps: - - name: Checkout repository - uses: actions/checkout@v5 - - - name: Cache Swift PM dependencies - uses: actions/cache@v4 - with: - path: .build - key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }} - restore-keys: | - ${{ runner.os }}-spm- - - - name: Select Xcode 16.4 - run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer - - - name: Build library - run: swift build - - - name: Run tests - run: swift test - - deploy-docs: - name: Deploy Documentation - needs: build-and-test - if: github.event_name == 'push' && github.ref == 'refs/heads/main' - runs-on: macos-15 - - permissions: - contents: write - - steps: - - name: Checkout repository - uses: actions/checkout@v5 - - - name: Select Xcode 16.4 - run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer - - - name: Generate DocC documentation - run: swift package --allow-writing-to-directory ./docs generate-documentation --target PactKitCore --output-path ./docs --transform-for-static-hosting --hosting-base-path PactKit - - - name: Create .nojekyll file - run: touch ./docs/.nojekyll - - - name: Deploy to GitHub Pages - uses: peaceiris/actions-gh-pages@v4 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./docs