Merge pull request #720 from mindbox-cloud/feature/MOBILE-52 #633
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: Lint + UnitTests + Build | |
| on: | |
| push: | |
| branches: | |
| - develop | |
| - mission/* | |
| pull_request: | |
| types: | |
| - opened | |
| - reopened | |
| - synchronize | |
| permissions: | |
| contents: read | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 2 | |
| submodules: true | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v3 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| cache: 'gradle' | |
| - name: Setup Android SDK | |
| uses: android-actions/setup-android@v2 | |
| - name: Get changed Kotlin files | |
| id: get_changed_files | |
| run: | | |
| CHANGED_FILES=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep -E '\.kt$|\.kts$' || true) | |
| echo "Changed Kotlin files:" | |
| echo "$CHANGED_FILES" | |
| echo "CHANGED_FILES<<EOF" >> $GITHUB_OUTPUT | |
| echo "$CHANGED_FILES" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| - name: Run ktlintCheck on changed files | |
| if: steps.get_changed_files.outputs.CHANGED_FILES != '' | |
| run: ./gradlew ktlintCheck -PinternalKtlintGitFilter="${{ steps.get_changed_files.outputs.CHANGED_FILES }}" | |
| - name: lint check | |
| run: ./gradlew --no-daemon lintDebug | |
| - name: detekt check | |
| run: ./gradlew --no-daemon detektDebug | |
| unit: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| submodules: true | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v3 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| cache: 'gradle' | |
| - name: Setup Android SDK | |
| uses: android-actions/setup-android@v2 | |
| - name: unit tests with coverage | |
| run: ./gradlew --no-daemon --stacktrace testDebugUnitTest koverHtmlReport | |
| - name: test report | |
| uses: asadmansr/android-test-report-action@v1.2.0 | |
| if: ${{ always() }} | |
| - name: upload coverage report | |
| uses: actions/upload-pages-artifact@v3 | |
| if: github.ref == 'refs/heads/develop' | |
| with: | |
| path: build/reports/kover/html | |
| deploy-coverage: | |
| runs-on: ubuntu-latest | |
| needs: unit | |
| if: github.ref == 'refs/heads/develop' | |
| permissions: | |
| pages: write | |
| id-token: write | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deploy.outputs.page_url }} | |
| steps: | |
| - name: deploy to GitHub Pages | |
| id: deploy | |
| uses: actions/deploy-pages@v4 | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| submodules: true | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v3 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| cache: 'gradle' | |
| - name: build project | |
| run: ./gradlew --no-daemon assembleDebug |