diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d0204df035a720..ccee3e2fa5dc11 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -398,10 +398,10 @@ jobs: run: ./python Lib/test/ssltests.py build-android: - name: Android (${{ matrix.arch }}) + # ${{ '' } is a hack to nest jobs under the same sidebar category. + name: Android${{ '' }} # zizmor: ignore[obfuscation] needs: build-context if: needs.build-context.outputs.run-tests == 'true' - timeout-minutes: 60 strategy: fail-fast: false matrix: @@ -412,13 +412,12 @@ jobs: - arch: x86_64 runs-on: ubuntu-24.04 - runs-on: ${{ matrix.runs-on }} - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - name: Build and test - run: ./Android/android.py ci ${{ matrix.arch }}-linux-android + uses: ./.github/workflows/reusable-android.yml + with: + arch: ${{ matrix.arch }} + check-name: ${{ matrix.arch }} + runner-vm-os: ${{ matrix.runs-on }} + timeout-minutes: 60 build-wasi: name: 'WASI' diff --git a/.github/workflows/reusable-android.yml b/.github/workflows/reusable-android.yml new file mode 100644 index 00000000000000..0248117f7dc0ff --- /dev/null +++ b/.github/workflows/reusable-android.yml @@ -0,0 +1,59 @@ +name: Reusable Android + +on: + workflow_call: + inputs: + arch: + description: CPU architecture + required: true + type: string + check-name: + description: A custom name for the Checks API-reported status + required: false + type: string + runner-vm-os: + description: VM OS to use + required: true + type: string + timeout-minutes: + description: Deadline for the job to complete + required: true + type: number + outputs: + steps: + description: >- + JSON-formatted collection of all build steps with their outputs + value: ${{ jobs.build.outputs.steps }} + +env: + FORCE_COLOR: 1 + ANDROID_CI_SCRIPT_TRIPLET: ${{ inputs.arch }}-linux-android + +jobs: + build: + name: >- + ${{ + inputs.check-name + && inputs.check-name + || format( + '{0}@💻{1}', + inputs.runner-vm-os, + inputs.arch + ) + }} + + runs-on: ${{ inputs.runner-vm-os }} + + timeout-minutes: ${{ inputs.timeout-minutes }} + + outputs: + steps: ${{ toJSON(steps) }} + + steps: + - name: Fetch CPython source from Git + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + with: + persist-credentials: false + + - name: Build and test + run: ./Android/android.py ci "${ANDROID_CI_SCRIPT_TRIPLET}"