|
| 1 | +# synced from @nextcloud/android-config |
| 2 | + |
| 3 | +# SPDX-FileCopyrightText: 2023-2024 Nextcloud GmbH and Nextcloud contributors |
| 4 | +# SPDX-FileCopyrightText: 2025 Alper Ozturk <[email protected]> |
| 5 | +# SPDX-FileCopyrightText: 2023 Tobias Kaminsky <[email protected]> |
| 6 | +# SPDX-FileCopyrightText: 2023 Andy Scherzinger <[email protected]> |
| 7 | +# SPDX-FileCopyrightText: 2023 Josh Richards <[email protected]> |
| 8 | +# SPDX-FileCopyrightText: 2025 Marcel Hibbe <[email protected]> |
| 9 | +# SPDX-License-Identifier: GPL-3.0-or-later |
| 10 | + |
| 11 | +name: "Analysis" |
| 12 | + |
| 13 | +on: |
| 14 | + pull_request: |
| 15 | + branches: [ "master", "main", "stable-*" ] |
| 16 | + push: |
| 17 | + branches: [ "master", "main", "stable-*" ] |
| 18 | + |
| 19 | +permissions: |
| 20 | + pull-requests: write |
| 21 | + contents: write |
| 22 | + |
| 23 | +concurrency: |
| 24 | + group: analysis-wrapper-${{ github.head_ref || github.run_id }} |
| 25 | + cancel-in-progress: true |
| 26 | + |
| 27 | +jobs: |
| 28 | + analysis: |
| 29 | + runs-on: ubuntu-latest |
| 30 | + steps: |
| 31 | + - name: Disabled on forks |
| 32 | + if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository }} |
| 33 | + run: | |
| 34 | + echo 'Can not analyze PRs from forks' |
| 35 | + exit 1 |
| 36 | + - name: Setup variables # zizmor: ignore[template-injection] |
| 37 | + id: get-vars |
| 38 | + run: | |
| 39 | + if [ -z "$GITHUB_HEAD_REF" ]; then |
| 40 | + # push |
| 41 | + { |
| 42 | + echo "branch=$GITHUB_REF_NAME" |
| 43 | + echo "pr=$GITHUB_RUN_ID" |
| 44 | + echo "repo=${{ github.repository }}" |
| 45 | + } >> "$GITHUB_OUTPUT" |
| 46 | + else |
| 47 | + # pull request |
| 48 | + { |
| 49 | + echo "branch=$GITHUB_HEAD_REF" |
| 50 | + echo "pr=${{ github.event.pull_request.number }}" |
| 51 | + echo "repo=${{ github.event.pull_request.head.repo.full_name }}" |
| 52 | + } >> "$GITHUB_OUTPUT" |
| 53 | + fi |
| 54 | + - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 |
| 55 | + with: |
| 56 | + persist-credentials: false |
| 57 | + repository: ${{ steps.get-vars.outputs.repo }} |
| 58 | + ref: ${{ steps.get-vars.outputs.branch }} |
| 59 | + - name: Set up JDK 17 |
| 60 | + uses: actions/setup-java@f2beeb24e141e01a676f977032f5a29d81c9e27e # v5.1.0 |
| 61 | + with: |
| 62 | + distribution: "temurin" |
| 63 | + java-version: 17 |
| 64 | + - name: Install dependencies |
| 65 | + run: | |
| 66 | + sudo apt install python3-defusedxml |
| 67 | + - name: Run analysis wrapper |
| 68 | + env: |
| 69 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 70 | + run: | |
| 71 | + mkdir -p "$HOME/.gradle" |
| 72 | + { |
| 73 | + echo "org.gradle.jvmargs=-Xmx1g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8" |
| 74 | + echo "org.gradle.configureondemand=true" |
| 75 | + echo "kapt.incremental.apt=true" |
| 76 | + } > "$HOME/.gradle/gradle.properties" |
| 77 | + scripts/analysis/analysis-wrapper.sh "${{ steps.get-vars.outputs.branch }}" "${{ secrets.LOG_USERNAME }}" "${{ secrets.LOG_PASSWORD }}" "$GITHUB_RUN_NUMBER" "${{ steps.get-vars.outputs.pr }}" |
0 commit comments