|
| 1 | +# synced from @nextcloud/android-config |
| 2 | +name: "Analysis" |
| 3 | + |
| 4 | +on: |
| 5 | + pull_request: |
| 6 | + branches: [ "master", "main", "stable-*" ] |
| 7 | + push: |
| 8 | + branches: [ "master", "main", "stable-*" ] |
| 9 | + |
| 10 | +permissions: |
| 11 | + pull-requests: write |
| 12 | + contents: write |
| 13 | + |
| 14 | +concurrency: |
| 15 | + group: analysis-wrapper-${{ github.head_ref || github.run_id }} |
| 16 | + cancel-in-progress: true |
| 17 | + |
| 18 | +jobs: |
| 19 | + analysis: |
| 20 | + runs-on: ubuntu-22.04 |
| 21 | + steps: |
| 22 | + - name: Setup variables |
| 23 | + id: get-vars |
| 24 | + run: | |
| 25 | + if [ -z "$GITHUB_HEAD_REF" ]; then |
| 26 | + # push |
| 27 | + echo "branch=$GITHUB_REF_NAME" >> "$GITHUB_OUTPUT" |
| 28 | + echo "pr=$GITHUB_RUN_ID" >> "$GITHUB_OUTPUT" |
| 29 | + echo "repo=${{ github.repository }}" >> "$GITHUB_OUTPUT" |
| 30 | + else |
| 31 | + # pull request |
| 32 | + echo "branch=$GITHUB_HEAD_REF" >> "$GITHUB_OUTPUT" |
| 33 | + echo "pr=${{ github.event.pull_request.number }}" >> "$GITHUB_OUTPUT" |
| 34 | + echo "repo=${{ github.event.pull_request.head.repo.full_name }}" >> "$GITHUB_OUTPUT" |
| 35 | + fi |
| 36 | + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 |
| 37 | + with: |
| 38 | + repository: ${{ steps.get-vars.outputs.repo }} |
| 39 | + ref: ${{ steps.get-vars.outputs.branch }} |
| 40 | + - name: Set up JDK 17 |
| 41 | + uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.0.0 |
| 42 | + with: |
| 43 | + distribution: "temurin" |
| 44 | + java-version: 17 |
| 45 | + - name: Install dependencies |
| 46 | + run: | |
| 47 | + python3 -m pip install defusedxml |
| 48 | + - name: Run analysis wrapper |
| 49 | + env: |
| 50 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 51 | + run: | |
| 52 | + mkdir -p $HOME/.gradle |
| 53 | + echo "org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError" > $HOME/.gradle/gradle.properties |
| 54 | + 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