[pull] develop from duckduckgo:develop #1621
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
| name: Privacy Tests | |
| on: | |
| pull_request: | |
| types: | |
| - opened | |
| - synchronize | |
| - reopened | |
| paths: | |
| - 'node_modules/@duckduckgo/content-scope-scripts/**' | |
| workflow_call: | |
| inputs: | |
| commit: | |
| description: 'Specific commit SHA to checkout (optional, defaults to latest)' | |
| required: true | |
| type: string | |
| workflow_dispatch: | |
| inputs: | |
| commit: | |
| description: 'Specific commit SHA to checkout (optional, defaults to latest)' | |
| required: false | |
| type: string | |
| concurrency: | |
| group: ${{ github.workflow_ref }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| privacy_tests: | |
| if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' || github.event_name == 'workflow_call' || github.event_name == 'pull_request' }} | |
| name: ${{ matrix.name }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: Privacy Tests | |
| build-task: androidTestsBuild | |
| flank-task: runFlankPrivacyTests | |
| artifact-name: android-tests-report-privacy | |
| asana-task-name: GH Workflow Failure - Privacy tests | |
| - name: Internal Privacy Tests | |
| build-task: internalAndroidTestsBuild | |
| flank-task: runFlankInternalPrivacyTests | |
| artifact-name: android-tests-report-privacy-internal | |
| asana-task-name: GH Workflow Failure - Internal privacy tests | |
| env: | |
| DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ inputs.commit || github.sha }} | |
| submodules: recursive | |
| - name: Setup jq | |
| uses: dcarbone/install-jq-action@v1.0.1 | |
| with: | |
| force: true | |
| - name: Set up JDK version | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version-file: .github/.java-version | |
| distribution: 'adopt' | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.18.3' | |
| - name: Decode secret | |
| env: | |
| FLANK: ${{ secrets.FLANK }} | |
| run: echo "$FLANK" > flank.json | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v5 | |
| with: | |
| cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} | |
| - name: Build | |
| run: ./gradlew ${{ matrix.build-task }} | |
| - name: Run Android Tests | |
| run: ./gradlew ${{ matrix.flank-task }} --no-configuration-cache | |
| - name: Bundle the Android CI tests report | |
| if: always() | |
| run: find . -type d -name 'fladleResults' | zip -@ -r ${{ matrix.artifact-name }}.zip | |
| - name: Generate json file with failures | |
| if: ${{ failure() }} | |
| run: cut -d\` -f2 < build/fladle/fladleResults/HtmlErrorReport.html >> results.json | |
| - name: Print failure report | |
| if: ${{ failure() }} | |
| run: | | |
| jq -r '.[] | .label as $id | .items[] | "Test:", $id, "Failure:", .label, "URL:", .url, "\n"' results.json | |
| - name: Upload the Android CI tests report | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.artifact-name }} | |
| path: ${{ matrix.artifact-name }}.zip | |
| - name: Create Asana task when workflow failed | |
| if: ${{ failure() && github.event_name != 'workflow_dispatch' }} | |
| id: create-failure-task | |
| uses: duckduckgo/native-github-asana-sync@v2.0 | |
| with: | |
| asana-pat: ${{ secrets.ASANA_ACCESS_TOKEN }} | |
| asana-project: ${{ secrets.GH_ASANA_AOR_PROJECT_ID }} | |
| asana-section: ${{ secrets.GH_ASANA_INCOMING_ID }} | |
| asana-task-name: ${{ matrix.asana-task-name }} | |
| asana-task-description: The ${{ matrix.name }} workflow has failed. See https://github.com/duckduckgo/Android/actions/runs/${{ github.run_id }} | |
| action: 'create-asana-task' | |
| - name: Adding as a release blocker | |
| if: ${{ failure() && steps.create-failure-task.outputs.taskId != '' }} | |
| uses: duckduckgo/native-github-asana-sync@v2.0 | |
| with: | |
| asana-pat: ${{ secrets.ASANA_ACCESS_TOKEN }} | |
| asana-project: ${{ vars.GH_ANDROID_APP_RELEASES_PROJECT_ID }} | |
| asana-section: ${{ vars.GH_ANDROID_APP_RELEASES_PROJECT_BLOCKER_SECTION_ID }} | |
| asana-task-id: ${{ steps.create-failure-task.outputs.taskId }} | |
| action: 'add-task-asana-project' |