Nightly #1231
This file contains 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: Nightly | |
on: | |
schedule: | |
- cron: '0 2 * * *' # run at 2 AM UTC | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
code_formatting: | |
name: Code Formatting | |
runs-on: ubuntu-20.04 #https://github.com/actions/runner-images/issues/6709 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'adopt' | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v3 | |
- name: Run Code Formatting Checks | |
run: ./gradlew code_format_checks | |
unit_tests: | |
name: Unit tests | |
runs-on: ubuntu-20.04 #https://github.com/actions/runner-images/issues/6709 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'adopt' | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v3 | |
- name: JVM tests | |
run: ./gradlew jvm_tests | |
- name: Bundle the JVM checks report | |
if: always() | |
run: find . -type d -name 'reports' | zip -@ -r unit-tests-report.zip | |
- name: Upload the JVM checks report | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: unit-tests-report | |
path: unit-tests-report.zip | |
lint: | |
name: Lint | |
runs-on: ubuntu-20.04 #https://github.com/actions/runner-images/issues/6709 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'adopt' | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.18.3' | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v3 | |
- name: Lint | |
run: ./gradlew lint | |
- name: Bundle the lint report | |
if: always() | |
run: find . -name lint-results\* | zip -@ -r lint-report.zip | |
- name: Upload the JVM lint report | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: lint-report | |
path: lint-report.zip | |
android_tests: | |
runs-on: ubuntu-20.04 #https://github.com/actions/runner-images/issues/6709 | |
name: Android CI checks | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Setup jq | |
uses: dcarbone/[email protected] | |
with: | |
force: true | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
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@v3 | |
- name: Build | |
run: ./gradlew androidTestsBuild | |
- name: Run Android Tests | |
run: ./gradlew runFlankAndroidTests | |
- name: Bundle the Android CI tests report | |
if: always() | |
run: find . -type d -name 'fladleResults' | zip -@ -r android-tests-report.zip | |
- name: Generate json file with failures | |
if: ${{ failure() }} | |
run: cat build/fladle/fladleResults/HtmlErrorReport.html | cut -d\` -f2 >> 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: android-tests-report | |
path: android-tests-report.zip | |
create_task_when_failed: | |
name: Create Asana task when workflow failed | |
runs-on: ubuntu-20.04 #https://github.com/actions/runner-images/issues/6709 | |
needs: [code_formatting, unit_tests, lint, android_tests] | |
if: ${{ failure() }} | |
steps: | |
- name: Create Asana task when workflow failed | |
uses: honeycombio/gha-create-asana-task@main | |
with: | |
asana-secret: ${{ secrets.GH_ASANA_SECRET }} | |
asana-workspace-id: ${{ secrets.GH_ASANA_WORKSPACE_ID }} | |
asana-project-id: ${{ secrets.GH_ASANA_AOR_PROJECT_ID }} | |
asana-section-id: ${{ secrets.GH_ASANA_INCOMING_ID }} | |
asana-task-name: GH Workflow Failure - Nightly | |
asana-task-description: The nightly workflow has failed. See https://github.com/duckduckgo/Android/actions/runs/${{ github.run_id }} |