Merge branch 'dev' of https://github.com/TranHoan2004/LabVerse into f… #535
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
| # CI for Android application | |
| name: Android CI/CD | |
| on: | |
| push: | |
| branches: [ | |
| "main", "dev", | |
| "feat/**", "refactor/**", | |
| "style/**", "fix/**" | |
| ] | |
| pull_request: | |
| branches: | |
| - dev | |
| permissions: | |
| contents: read | |
| jobs: | |
| android-build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v3 | |
| with: | |
| distribution: "temurin" | |
| java-version: '21' | |
| - name: Grant execute permission | |
| run: chmod +x gradlew | |
| working-directory: android-app | |
| - name: Build | |
| run: ./gradlew build | |
| working-directory: android-app | |
| - name: Run Unit Tests | |
| run: ./gradlew test | |
| working-directory: android-app | |
| - name: Build Kotlin (Gradle) | |
| run: ./gradlew clean build | |
| working-directory: android-app | |
| - name: Upload Debug APK | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: debug-apk | |
| path: android-app/app/build/outputs/apk/debug/app-debug.apk | |
| detect-services: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| matrix: ${{ steps.set-matrix.outputs.matrix }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: List services | |
| id: set-matrix | |
| run: | | |
| services=$(ls -d services/*/ | xargs -n 1 basename | jq -R -s -c 'split("\n")[:-1]') | |
| echo "matrix=$services" >> $GITHUB_OUTPUT | |
| spring-boot-build: | |
| runs-on: ubuntu-latest | |
| needs: [android-build, detect-services] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| service: ${{ fromJSON(needs.detect-services.outputs.matrix) }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v3 | |
| with: | |
| distribution: "temurin" | |
| java-version: '21' | |
| - name: Grant execute permission for mvnw | |
| run: chmod +x mvnw | |
| working-directory: services/${{matrix.service}} | |
| - name: Build spring boot | |
| run: ./mvnw clean package -DskipTests | |
| working-directory: services/${{matrix.service}} | |
| # - name: Run Spring boot tests | |
| # run: ./mvnw test | |
| # working-directory: services/${{matrix.service}} | |
| - name: Compile Kotlin | |
| run: ./mvnw compile | |
| working-directory: services/${{matrix.service}} | |
| - name: Upload JAR | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{matrix.service}}-jar | |
| path: services/${{matrix.service}}/target/*.jar | |
| react-vite-build: | |
| name: Build / Test / Lint | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Use Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 18 | |
| cache: 'npm' | |
| cache-dependency-path: ./web/package-lock.json | |
| - name: Install dependencies | |
| run: npm ci | |
| working-directory: ./web | |
| - name: Run typescheck | |
| run: npm run typescheck | |
| working-directory: ./web | |
| - name: Build | |
| run: npm run build | |
| working-directory: ./web | |
| - name: Upload production build artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist | |
| path: .web/dist | |
| qodana-analysis: | |
| runs-on: ubuntu-latest | |
| needs: [ android-build, spring-boot-build, detect-services ] | |
| strategy: | |
| matrix: | |
| service: ${{ fromJSON(needs.detect-services.outputs.matrix) }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Run Qodana | |
| uses: JetBrains/qodana-action@v2025.2 | |
| with: | |
| args: --project-dir=. | |
| image: jetbrains/qodana-jvm-community:2025.2 | |
| results-dir: qodana-results/android |