diff --git a/.github/workflows/build-android.yml b/.github/workflows/build-android.yml index 79e140f59..ff85129dd 100644 --- a/.github/workflows/build-android.yml +++ b/.github/workflows/build-android.yml @@ -2,7 +2,7 @@ name: Build Android Registration-Client on: workflow_dispatch: - inputs: + inputs: serverBaseURL: description: "Enter serverBaseURL for APK" required: true diff --git a/.github/workflows/push_trigger.yml b/.github/workflows/push_trigger.yml index 8b8faf36a..34682e0b8 100644 --- a/.github/workflows/push_trigger.yml +++ b/.github/workflows/push_trigger.yml @@ -1,123 +1,94 @@ -name: Android Registration-Client Build +name: ARC Build With Pre-Checks on: - push: - branches: - - '!release-branch' - - release-* - - master - - 1.* - - develop - - sprint-* - - main - - pull_request: - branches: - - master - - main - - "release-*" - - "sprint-*" + workflow_dispatch: + inputs: + serverBaseURL: + description: "Enter Server Base URL" + required: true + default: "api-internal.sandbox.xyz.net" jobs: - codeql: - name: CodeQL Security Analysis + + dco-check: + name: DCO Validation runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Validate DCO + uses: docker://ghcr.io/viperproject/dco-check:latest + with: + args: "--signoff" + + codeql: + name: CodeQL Security Scan + runs-on: ubuntu-latest + needs: dco-check permissions: contents: read security-events: write steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Initialize CodeQL uses: github/codeql-action/init@v3 with: - languages: "java" + languages: java - - name: Build for CodeQL - run: ./gradlew build || true + - name: Build for CodeQL (Android) + run: | + cd client + chmod +x gradlew + ./gradlew compileDebugSources || true - - name: Perform CodeQL Analysis + - name: Run CodeQL Analysis uses: github/codeql-action/analyze@v3 - build: - name: Android Build Check + prebuild: + name: Pre-Build Validation runs-on: ubuntu-latest - needs: [codeql] + needs: codeql steps: - - uses: actions/checkout@v3 - - - name: Setup Java 17 - uses: actions/setup-java@v3 - with: - distribution: zulu - java-version: "17" - - - name: Setup Flutter - uses: subosito/flutter-action@v2 - with: - flutter-version: "3.10.4" - - - name: Install Dependencies - run: flutter pub get + - name: Checkout + uses: actions/checkout@v4 - - name: Build APK (Debug) - run: flutter build apk --debug + - name: Validate Gradle Build (no tests) + run: | + cd client + chmod +x gradlew + ./gradlew clean assembleDebug --dry-run - build-android: + build-apk: + name: Build APK runs-on: ubuntu-latest + needs: prebuild + steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 + - name: Install npm dependencies + run: npm install + + - name: Replace serverBaseURL run: | - npm install - - name: Updating serverBaseURL. - run: | - find . -type f -name "*build.gradle" -print0 | xargs -0 sed -i "s/api-internal.sandbox.xyz.net/${{ github.event.inputs.defaultServerBaseURL }}/g" - - name: Build Android Registration-Client + find . -type f -name "*build.gradle" -print0 | \ + xargs -0 sed -i "s|api-internal.sandbox.xyz.net|${{ github.event.inputs.serverBaseURL }}|g" + + - name: Build APK run: | cd client chmod +x gradlew ./gradlew assembleDebug ls app/build/outputs/apk/debug - find -name '*.apk' - - name: Upload Artifact + + - name: Upload APK uses: actions/upload-artifact@v4 with: - name: apk-output - path: ./client/app/build/outputs/apk/debug/app-debug.apk + name: arc-apk + path: client/app/build/outputs/apk/debug/app-debug.apk retention-days: 5 - - Sonarbuild: - name: sonar-analysis - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - - name: Set up JDK 11 - uses: actions/setup-java@v1 - with: - java-version: 11 - - name: Cache SonarCloud packages - uses: actions/cache@v4 - with: - path: ~/.sonar/cache - key: ${{ runner.os }}-sonar - restore-keys: ${{ runner.os }}-sonar - - name: Cache Gradle packages - uses: actions/cache@v4 - with: - path: ~/.gradle/caches - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} - restore-keys: ${{ runner.os }}-gradle - - name: Build and analyze - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - run: | - cd client - chmod +x gradlew - ./gradlew build test testDebugUnitTestCoverage sonarqube --info --warning-mode all - ./gradlew build sonarqube --info --warning-mode all