Refactor/#81 2차 QA 반영 #168
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: Validate PR | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| env: | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
| DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | |
| SCHEME_NAME: ${{ vars.SCHEME_NAME }} | |
| permissions: | |
| contents: read | |
| jobs: | |
| swiftlint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| # - name: Run SwiftLint | |
| # uses: norio-nomura/action-swiftlint@3.2.1 | |
| build-and-analyze: | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Xcode | |
| uses: maxim-lobanov/setup-xcode@v1 | |
| with: | |
| xcode-version: 16.4.0 | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: '3.2.9' | |
| - name: Cache Gems | |
| uses: actions/cache@v4 | |
| with: | |
| path: vendor/bundle | |
| key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-gems- | |
| - name: Bundle Install | |
| run: bundle install --deployment --jobs 4 --retry 3 --path vendor/bundle | |
| - name: List available devices | |
| run: xcrun simctl list devices | |
| - name: Run Fastlane | |
| run: bundle exec fastlane test | |
| - name: Generate Coverage Report | |
| run: | | |
| xcrun xccov view --report --json BeforeGoing.xcresult > coverage.json | |
| python3 scripts/convert_coverage.py coverage.json sonarqube-generic-coverage.xml | |
| - name: SonarCloud Scan | |
| uses: SonarSource/sonarqube-scan-action@v5.0.0 | |
| with: | |
| projectBaseDir: . | |
| env: | |
| SONAR_TOKEN: ${{ env.SONAR_TOKEN }} | |
| notify: | |
| runs-on: ubuntu-latest | |
| needs: [swiftlint, build-and-analyze] | |
| if: always() | |
| steps: | |
| - name: Send Success Message | |
| if: ${{ needs.swiftlint.result == 'success' && needs.build-and-analyze.result == 'success' }} | |
| uses: Ilshidur/action-discord@0.3.2 | |
| with: | |
| args: "We got a new pull request 👏" | |
| env: | |
| DISCORD_WEBHOOK: ${{ env.DISCORD_WEBHOOK }} | |
| DISCORD_EMBEDS: | | |
| [ | |
| { | |
| "author": { | |
| "name": "${{ github.event.pull_request.user.login }}" | |
| }, | |
| "title": "#${{ github.event.pull_request.number }}: ${{ github.event.pull_request.title }}", | |
| "color": 10478271, | |
| "description": "[View on GitHub](${{ github.event.pull_request.html_url }})", | |
| "fields": [ | |
| { | |
| "name": "Base Branch", | |
| "value": "${{ github.base_ref }}", | |
| "inline": true | |
| }, | |
| { | |
| "name": "Compare Branch", | |
| "value": "${{ github.head_ref }}", | |
| "inline": true | |
| } | |
| ] | |
| } | |
| ] | |
| - name: Send Failure Message | |
| if: ${{ needs.swiftlint.result != 'success' || needs.build-and-analyze.result != 'success' }} | |
| uses: Ilshidur/action-discord@0.3.2 | |
| with: | |
| args: "The pull request failed. Please resolve the issue and try again 👽" | |
| env: | |
| DISCORD_WEBHOOK: ${{ env.DISCORD_WEBHOOK }} | |
| DISCORD_EMBEDS: | | |
| [ | |
| { | |
| "author": { | |
| "name": "${{ github.event.pull_request.user.login }}" | |
| }, | |
| "title": "#${{ github.event.pull_request.number }}: ${{ github.event.pull_request.title }}", | |
| "color": 13458524, | |
| "description": "[View on GitHub](${{ github.event.pull_request.html_url }})", | |
| "fields": [ | |
| { | |
| "name": "Base Branch", | |
| "value": "${{ github.base_ref }}", | |
| "inline": true | |
| }, | |
| { | |
| "name": "Compare Branch", | |
| "value": "${{ github.head_ref }}", | |
| "inline": true | |
| } | |
| ] | |
| } | |
| ] |