|
| 1 | +# synced from @nextcloud/android-config |
| 2 | + |
| 3 | +# SPDX-FileCopyrightText: 2023-2024 Nextcloud GmbH and Nextcloud contributors |
| 4 | +# SPDX-FileCopyrightText: 2025 Alper Ozturk <alper.ozturk@nextcloud.com> |
| 5 | +# SPDX-FileCopyrightText: 2023 Tobias Kaminsky <tobias@kaminsky.me> |
| 6 | +# SPDX-FileCopyrightText: 2023 Andy Scherzinger <info@andy-scherzinger.de> |
| 7 | +# SPDX-FileCopyrightText: 2023 Josh Richards <josh.t.richards@gmail.com> |
| 8 | +# SPDX-FileCopyrightText: 2025 Marcel Hibbe <dev@mhibbe.de> |
| 9 | +# SPDX-License-Identifier: GPL-3.0-or-later |
| 10 | + |
| 11 | +#TESTTEST |
| 12 | + |
| 13 | +name: "Analysis Self-Hosted" |
| 14 | + |
| 15 | +on: |
| 16 | + pull_request: |
| 17 | + branches: [ "master", "main", "stable-*" ] |
| 18 | + push: |
| 19 | + branches: [ "master", "main", "stable-*" ] |
| 20 | + |
| 21 | +permissions: |
| 22 | + pull-requests: write |
| 23 | + contents: write |
| 24 | + |
| 25 | +concurrency: |
| 26 | + group: analysis-wrapper-${{ github.head_ref || github.run_id }} |
| 27 | + cancel-in-progress: true |
| 28 | + |
| 29 | +jobs: |
| 30 | + analysis: |
| 31 | + runs-on: [ubuntu-latest, self-hosted] |
| 32 | + steps: |
| 33 | + - name: Disabled on forks |
| 34 | + if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository }} |
| 35 | + run: | |
| 36 | + echo 'Can not analyze PRs from forks' |
| 37 | + exit 1 |
| 38 | + - name: Setup variables # zizmor: ignore[template-injection] |
| 39 | + id: get-vars |
| 40 | + run: | |
| 41 | + if [ -z "$GITHUB_HEAD_REF" ]; then |
| 42 | + # push |
| 43 | + { |
| 44 | + echo "branch=$GITHUB_REF_NAME" |
| 45 | + echo "pr=$GITHUB_RUN_ID" |
| 46 | + echo "repo=${{ github.repository }}" |
| 47 | + } >> "$GITHUB_OUTPUT" |
| 48 | + else |
| 49 | + # pull request |
| 50 | + { |
| 51 | + echo "branch=$GITHUB_HEAD_REF" |
| 52 | + echo "pr=${{ github.event.pull_request.number }}" |
| 53 | + echo "repo=${{ github.event.pull_request.head.repo.full_name }}" |
| 54 | + } >> "$GITHUB_OUTPUT" |
| 55 | + fi |
| 56 | + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 57 | + with: |
| 58 | + persist-credentials: false |
| 59 | + repository: ${{ steps.get-vars.outputs.repo }} |
| 60 | + ref: ${{ steps.get-vars.outputs.branch }} |
| 61 | + - name: Set up JDK 17 |
| 62 | + uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0 |
| 63 | + with: |
| 64 | + distribution: "temurin" |
| 65 | + java-version: 17 |
| 66 | + - name: Install dependencies |
| 67 | + run: | |
| 68 | + sudo apt install python3-defusedxml |
| 69 | + - name: Run analysis wrapper |
| 70 | + env: |
| 71 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 72 | + |
| 73 | + # Memory that is set in jvmargs must be wisely chosen. |
| 74 | + # E.g. with -Xmx5g and -Xmx1g android talk builds always failed with "The operation was canceled". -Xmx3g seems to work so far. |
| 75 | + run: | |
| 76 | + mkdir -p "$HOME/.gradle" |
| 77 | + { |
| 78 | + echo "org.gradle.jvmargs=-Xmx3g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:+UseParallelGC -XX:MaxMetaspaceSize=1g" |
| 79 | + echo "org.gradle.configureondemand=true" |
| 80 | + echo "kapt.incremental.apt=true" |
| 81 | + } > "$HOME/.gradle/gradle.properties" |
| 82 | + 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