|
| 1 | +name: CI/CD |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main ] |
| 6 | + pull_request: |
| 7 | + branches: [ main ] |
| 8 | + # schedule: |
| 9 | + # - cron: '0 0 * * *' |
| 10 | + workflow_dispatch: |
| 11 | + inputs: |
| 12 | + release: |
| 13 | + description: Create release |
| 14 | + required: false |
| 15 | + type: boolean |
| 16 | + version: |
| 17 | + description: New version to release |
| 18 | + required: false |
| 19 | + type: string |
| 20 | + |
| 21 | +concurrency: |
| 22 | + group: ci/cd-${{ github.ref }} |
| 23 | + cancel-in-progress: true |
| 24 | + |
| 25 | +jobs: |
| 26 | + # analyze: |
| 27 | + # name: Analyze |
| 28 | + # if: github.event_name != 'workflow_dispatch' |
| 29 | + # uses: SwiftyLab/ci/.github/workflows/codeql-analysis.yml@main |
| 30 | + # permissions: |
| 31 | + # actions: read |
| 32 | + # contents: read |
| 33 | + # security-events: write |
| 34 | + |
| 35 | + # spell-check: |
| 36 | + # name: Run spell check |
| 37 | + # runs-on: ubuntu-latest |
| 38 | + # steps: |
| 39 | + # - name: Checkout repository |
| 40 | + # uses: actions/checkout@v3 |
| 41 | + |
| 42 | + # - name: Spellcheck Action |
| 43 | + # uses: rojopolis/[email protected] |
| 44 | + # with: |
| 45 | + # config_path: .github/config/spellcheck.yml |
| 46 | + |
| 47 | + swift-package-test: |
| 48 | + name: Swift Package |
| 49 | + uses: SwiftyLab/ci/.github/workflows/swift-package.yml@main |
| 50 | + secrets: inherit |
| 51 | + with: |
| 52 | + codecov-swift: '5.7' |
| 53 | + codecov-os: ubuntu-latest |
| 54 | + matrix: > |
| 55 | + { |
| 56 | + "include": [ |
| 57 | + { |
| 58 | + "os": "ubuntu-latest", |
| 59 | + "swift": "5.7" |
| 60 | + }, |
| 61 | + { |
| 62 | + "os": "ubuntu-latest", |
| 63 | + "swift": "5.2" |
| 64 | + } |
| 65 | + ] |
| 66 | + } |
| 67 | + # { |
| 68 | + # "os": "macos-12", |
| 69 | + # "xcode": "latest-stable", |
| 70 | + # "swift": "5.6" |
| 71 | + # }, |
| 72 | + # { |
| 73 | + # "os": "windows-latest", |
| 74 | + # "swift": "5.6" |
| 75 | + # }, |
| 76 | + # { |
| 77 | + # "os": "windows-latest", |
| 78 | + # "swift": "5.3" |
| 79 | + # } |
| 80 | + |
| 81 | + cocoapods-test: |
| 82 | + name: CocoaPods |
| 83 | + uses: SwiftyLab/ci/.github/workflows/cocoapods.yml@main |
| 84 | + with: |
| 85 | + matrix: > |
| 86 | + { |
| 87 | + "include": [ |
| 88 | + { |
| 89 | + "os": "macos-12", |
| 90 | + "xcode": "13.4", |
| 91 | + "platform": "macos" |
| 92 | + }, |
| 93 | + { |
| 94 | + "os": "macos-12", |
| 95 | + "xcode": "13.4", |
| 96 | + "platform": "watchos" |
| 97 | + }, |
| 98 | + { |
| 99 | + "os": "macos-12", |
| 100 | + "xcode": "13.4", |
| 101 | + "platform": "tvos" |
| 102 | + }, |
| 103 | + { |
| 104 | + "os": "macos-12", |
| 105 | + "xcode": "13.4", |
| 106 | + "platform": "ios" |
| 107 | + } |
| 108 | + ] |
| 109 | + } |
| 110 | +
|
| 111 | + xcode-test: |
| 112 | + name: Xcode |
| 113 | + uses: SwiftyLab/ci/.github/workflows/xcode.yml@main |
| 114 | + with: |
| 115 | + matrix: > |
| 116 | + { |
| 117 | + "include": [ |
| 118 | + { |
| 119 | + "os": "macos-10.15", |
| 120 | + "xcode": "11.3.1", |
| 121 | + "platform": "macOS" |
| 122 | + }, |
| 123 | + { |
| 124 | + "os": "macos-10.15", |
| 125 | + "xcode": "11.3.1", |
| 126 | + "platform": "watchOS" |
| 127 | + }, |
| 128 | + { |
| 129 | + "os": "macos-10.15", |
| 130 | + "xcode": "11.3.1", |
| 131 | + "platform": "tvOS" |
| 132 | + }, |
| 133 | + { |
| 134 | + "os": "macos-10.15", |
| 135 | + "xcode": "11.3.1", |
| 136 | + "platform": "iOS" |
| 137 | + }, |
| 138 | + { |
| 139 | + "os": "macos-10.15", |
| 140 | + "xcode": "11.3.1", |
| 141 | + "platform": "mac-catalyst" |
| 142 | + } |
| 143 | + ] |
| 144 | + } |
| 145 | +
|
| 146 | + ci: |
| 147 | + name: CI |
| 148 | + if: github.event_name == 'push' |
| 149 | + needs: [swift-package-test, xcode-test, cocoapods-test] |
| 150 | + # needs: [analyze, swift-package-test, xcode-test, cocoapods-test] |
| 151 | + uses: SwiftyLab/ci/.github/workflows/ci.yml@main |
| 152 | + |
| 153 | + cd: |
| 154 | + name: CD |
| 155 | + if: | |
| 156 | + (github.event_name == 'push' && needs.ci.outputs.release == 'true') || |
| 157 | + (always() && |
| 158 | + github.event_name == 'workflow_dispatch' && |
| 159 | + github.event.inputs.release == 'true' && |
| 160 | + needs.swift-package-test.result == 'success' && |
| 161 | + needs.xcode-test.result == 'success' && |
| 162 | + needs.cocoapods-test.result == 'success' && |
| 163 | + (needs.ci.result == 'success' || needs.ci.result == 'skipped')) |
| 164 | + # (needs.analyze.result == 'success' || needs.analyze.result == 'skipped') |
| 165 | + needs: [ci, swift-package-test, xcode-test, cocoapods-test] |
| 166 | + # needs: [ci, analyze, swift-package-test, xcode-test, cocoapods-test] |
| 167 | + uses: SwiftyLab/ci/.github/workflows/cd.yml@main |
| 168 | + with: |
| 169 | + os: macos-12 |
| 170 | + version: ${{ github.event.inputs.version }} |
| 171 | + secrets: |
| 172 | + COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }} |
0 commit comments