Implement CI deployment branch approach for template testing #10
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: "Swift 6 Module Template CI" | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| concurrency: | |
| group: ${{ github.ref_name }} | |
| cancel-in-progress: true | |
| jobs: | |
| test-configure-script: | |
| name: Test configure.swift script and generate project | |
| runs-on: macos-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Test configure script with environment variables | |
| env: | |
| SMT_XXPROJECTXNAMEXX: "TestModule" | |
| SMT_ORGANIZATION_NAME: "Test Organization" | |
| SMT_COM_AN_ORGANIZATION_IDENTIFIER: "com.test.organization" | |
| SMT_AUTHOR_NAME: "Test Author" | |
| SMT_TODAYS_DATE: "January 1, 2024" | |
| SMT_TODAYS_YEAR: "2024" | |
| SMT_GITHUB_USERNAME: "testuser" | |
| run: | | |
| ./configure.swift | |
| ls -la OUTPUT/ | |
| - name: Verify generated project structure | |
| run: | | |
| cd OUTPUT/TestModule | |
| ls -la | |
| test -f Package.swift | |
| test -f README.md | |
| test -f LICENSE | |
| test -d Sources/TestModule | |
| test -d Tests/TestModuleTests | |
| test -d .github/workflows | |
| - name: Upload generated project as artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: generated-project | |
| path: OUTPUT/TestModule/ | |
| test-generated-project-swift-package: | |
| name: Test generated project - ${{ matrix.name }} | |
| needs: test-configure-script | |
| runs-on: ${{ matrix.runsOn }} | |
| env: | |
| DEVELOPER_DIR: "/Applications/${{ matrix.xcode }}.app/Contents/Developer" | |
| timeout-minutes: 10 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - xcode: "Xcode_16.3" | |
| runsOn: macos-latest | |
| name: "macOS, Xcode 16.3, Swift 6.1" | |
| - xcode: "Xcode_15.4" | |
| runsOn: macos-14 | |
| name: "macOS 14, Xcode 15.4, Swift 5.10" | |
| - xcode: "Xcode_15.2" | |
| runsOn: macos-13 | |
| name: "macOS 13, Xcode 15.2, Swift 5.9.2" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download generated project | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: generated-project | |
| path: TestModule/ | |
| - name: Swift Package Test | |
| run: | | |
| set -o pipefail | |
| cd TestModule | |
| swift build | |
| swift test | |
| test-generated-project-example-app: | |
| name: Test generated project Example App - ${{ matrix.name }} | |
| needs: test-configure-script | |
| runs-on: ${{ matrix.runsOn }} | |
| env: | |
| DEVELOPER_DIR: "/Applications/${{ matrix.xcode }}.app/Contents/Developer" | |
| timeout-minutes: 10 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - xcode: "Xcode_16.3" | |
| runsOn: macos-latest | |
| name: "iOS Simulator" | |
| destination: "platform=iOS Simulator,name=iPhone 15 Pro" | |
| - xcode: "Xcode_15.4" | |
| runsOn: macos-14 | |
| name: "iOS Simulator" | |
| destination: "platform=iOS Simulator,name=iPhone 15 Pro" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download generated project | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: generated-project | |
| path: TestModule/ | |
| - name: Build Example App | |
| run: | | |
| set -o pipefail | |
| cd TestModule/Example | |
| xcodebuild -project Example.xcodeproj -scheme Example -destination "${{ matrix.destination }}" clean build |