|
| 1 | +name: "Swift 6 Module Template CI" |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - main |
| 10 | + |
| 11 | +concurrency: |
| 12 | + group: ${{ github.ref_name }} |
| 13 | + cancel-in-progress: true |
| 14 | + |
| 15 | +jobs: |
| 16 | + test-configure-script: |
| 17 | + name: Test configure.swift script and generate project |
| 18 | + runs-on: macos-latest |
| 19 | + timeout-minutes: 10 |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@v4 |
| 22 | + |
| 23 | + - name: Test configure script with environment variables |
| 24 | + env: |
| 25 | + SMT_XXPROJECTXNAMEXX: "TestModule" |
| 26 | + SMT_ORGANIZATION_NAME: "Test Organization" |
| 27 | + SMT_COM_AN_ORGANIZATION_IDENTIFIER: "com.test.organization" |
| 28 | + SMT_AUTHOR_NAME: "Test Author" |
| 29 | + SMT_TODAYS_DATE: "January 1, 2024" |
| 30 | + SMT_TODAYS_YEAR: "2024" |
| 31 | + SMT_GITHUB_USERNAME: "testuser" |
| 32 | + run: | |
| 33 | + ./configure.swift |
| 34 | + ls -la OUTPUT/ |
| 35 | + |
| 36 | + - name: Verify generated project structure |
| 37 | + run: | |
| 38 | + cd OUTPUT/TestModule |
| 39 | + ls -la |
| 40 | + test -f Package.swift |
| 41 | + test -f README.md |
| 42 | + test -f LICENSE |
| 43 | + test -d Sources/TestModule |
| 44 | + test -d Tests/TestModuleTests |
| 45 | + test -d .github/workflows |
| 46 | + |
| 47 | + - name: Upload generated project as artifact |
| 48 | + uses: actions/upload-artifact@v4 |
| 49 | + with: |
| 50 | + name: generated-project |
| 51 | + path: OUTPUT/TestModule/ |
| 52 | + test-generated-project: |
| 53 | + name: Test generated project using template workflow |
| 54 | + needs: test-configure-script |
| 55 | + runs-on: macos-15 |
| 56 | + timeout-minutes: 10 |
| 57 | + steps: |
| 58 | + - uses: actions/checkout@v4 |
| 59 | + |
| 60 | + - name: Download generated project |
| 61 | + uses: actions/download-artifact@v4 |
| 62 | + with: |
| 63 | + name: generated-project |
| 64 | + path: TestModule/ |
| 65 | + |
| 66 | + - name: Select Xcode 16.1 |
| 67 | + run: sudo xcode-select -s /Applications/Xcode_16.1.app |
| 68 | + |
| 69 | + - name: Test generated Swift package |
| 70 | + run: | |
| 71 | + cd TestModule |
| 72 | + swift build |
| 73 | + swift test |
| 74 | + |
| 75 | + - name: Test generated Example project |
| 76 | + run: | |
| 77 | + cd TestModule/Example |
| 78 | + xcodebuild -project Example.xcodeproj -scheme Example -destination "platform=iOS Simulator,name=iPhone 15,OS=18.1" clean build |
| 79 | + # delegate-to-template-workflow: |
| 80 | + # Don't know how to do this |
0 commit comments