Merge "Fix issues caused by adding/removing a not placing modifier" i… #257
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: AndroidX Presubmits | |
on: | |
push: | |
pull_request: | |
env: | |
# Allow precise monitoring of the save/restore of Gradle User Home by `gradle-build-action` | |
# See https://github.com/marketplace/actions/gradle-build-action?version=v2.1.1#cache-debugging-and-analysis | |
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true | |
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: "2022.07.23" | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
outputs: | |
gradlew_flags: ${{ steps.global-constants.outputs.gradlew_flags }} | |
steps: | |
- name: "Setup global constants" | |
id: global-constants | |
# The configuration-cache cannot be used due to state excluded when caching Gradle User Home | |
run: | | |
set -x | |
GRADLEW_FLAGS="-Dorg.gradle.internal.http.connectionTimeout=60000 \ | |
-Dorg.gradle.internal.http.socketTimeout=60000 \ | |
-Dorg.gradle.internal.repository.max.retries=20 \ | |
-Dorg.gradle.internal.repository.initial.backoff=500 \ | |
--no-configuration-cache \ | |
--stacktrace" | |
echo "::set-output name=gradlew_flags::$GRADLEW_FLAGS" | |
- name: Publish build scans link | |
# No scans are produced for PRs from forked repos, so omit this notice for forked PRs. | |
if: ${{ !(github.event.pull_request && github.event.pull_request.head.repo.fork) }} | |
run: echo "::notice title=All build scans for workflow::https://ge.androidx.dev/scans?search.names=CI%20run&search.values=$GITHUB_RUN_ID" | |
lint: | |
runs-on: ubuntu-latest | |
needs: [setup] | |
outputs: | |
status: ${{ steps.output-status.outputs.status }} | |
affectedFileArgs: ${{ steps.affected-file-args.outputs.files }} | |
env: | |
GRADLE_BUILD_CACHE_PASSWORD: ${{ secrets.GRADLE_BUILD_CACHE_PASSWORD }} | |
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} | |
steps: | |
- name: Pull request format | |
uses: 'androidx/check-pr-format-action@main' | |
with: | |
# Enforces a `Test: <stanza>` in the pull request | |
checks: '["(.*)?Test:(.*)?"]' | |
- name: "Setup JDK 17" | |
id: setup-java | |
uses: actions/setup-java@v1 | |
with: | |
java-version: "17" | |
- name: "Set environment variables" | |
shell: bash | |
run: | | |
set -x | |
echo "DIST_DIR=$HOME/dist" >> $GITHUB_ENV | |
- name: "Checkout androidx repo" | |
uses: actions/checkout@v2 | |
- name: "Get changed files in push or pull_request" | |
id: changed-files | |
uses: androidx/changed-files-action@main | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: "Warn on missing updateApi" | |
run: | | |
set -x | |
./development/apilint.py -f ${{ steps.changed-files.outputs.files }} | |
- name: "Parse changed-files as ktlint args" | |
id: ktlint-file-args | |
run: | | |
set -x | |
KTLINT_FILES=`echo "${{ steps.changed-files.outputs.files }}" | sed 's|[^ ]* *|--file=../&|g' | grep -v "*.txt"` | |
echo "::set-output name=ktlint-file-args::$KTLINT_FILES" | |
- name: "Parse changed-files as affected files args" | |
id: affected-file-args | |
run: | | |
set -x | |
AFFECTED_FILES=`echo "${{ steps.changed-files.outputs.files_including_removals }}" | sed 's|\([^ ]\+\)|--changedFilePath=\1|g'` | |
echo "::set-output name=files::$AFFECTED_FILES" | |
- name: "Setup Gradle" | |
uses: gradle/gradle-build-action@v2 | |
with: | |
# Only save Gradle User Home state for builds on the 'androidx-main' branch. | |
# Builds on other branches will only read existing entries from the cache. | |
cache-read-only: ${{ github.ref != 'refs/heads/androidx-main' }} | |
# Don't reuse cache entries from any other Job. | |
gradle-home-cache-strict-match: true | |
# Limit the size of the cache entry. | |
# These directories contain instrumented/transformed dependency jars which can be reconstructed relatively quickly. | |
gradle-home-cache-excludes: | | |
caches/jars-9 | |
caches/transforms-3 | |
- name: "ktlint" | |
env: | |
JAVA_HOME: ${{ steps.setup-java.outputs.path }} | |
working-directory: activity | |
run: ./gradlew -q :ktlintCheckFile ${{ steps.ktlint-file-args.outputs.ktlint-file-args }} ${{ needs.setup.outputs.gradlew_flags }} | |
build-modules: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
# If you would like to remove some projects temporarily, use .github/ci-control/ci-config.json instead. | |
# Keep these in alphabetical order. | |
project: ["activity", "appcompat", "biometric", "collection", "compose-runtime", "core", "datastore", "fragment", "lifecycle", "navigation", "paging", "room", "work"] | |
include: | |
- project: "compose-runtime" | |
project-root: "compose/runtime" | |
- project: "collection" | |
custom-os: "macos-latest" | |
runs-on: ${{ matrix.custom-os || matrix.os }} | |
needs: [setup, lint] | |
env: | |
artifact-id: ${{matrix.project}} | |
project-root: ${{matrix.project-root || matrix.project}} | |
GRADLE_BUILD_CACHE_PASSWORD: ${{ secrets.GRADLE_BUILD_CACHE_PASSWORD }} | |
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} | |
steps: | |
- name: "Checkout androidx repo" | |
uses: actions/checkout@v2 | |
- name: "Check if the project should be built" | |
id: check-ci-config | |
env: | |
BRANCH_REF: ${{ github.head_ref || github.ref }} | |
run: | | |
set -x | |
RESULT=`.github/ci-control/should_run_project.py --project ${{ matrix.project }} --branch "$BRANCH_REF"` | |
echo "::set-output name=enabled::$RESULT" | |
- name: "Run build" | |
uses: ./.github/actions/build-single-project | |
if: ${{ steps.check-ci-config.outputs.enabled == 'true' }} | |
with: | |
project: ${{ matrix.project }} | |
project-root: ${{matrix.project-root || matrix.project }} | |
gradle-cache-password: ${{ secrets.GRADLE_BUILD_CACHE_PASSWORD }} | |
gradle-enterprise-access-key: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} | |
gradle-flags: ${{ needs.setup.outputs.gradlew_flags }} | |
# Upload artifacts task should be in the build-single-project | |
# action but they have a tendency to fail and continue-on-error | |
# is not supported there yet. | |
# https://github.com/actions/runner/issues/1457 | |
- name: "Upload build artifacts" | |
continue-on-error: true | |
if: ${{ steps.check-ci-config.outputs.enabled == 'true' }} | |
uses: actions/upload-artifact@v2 | |
with: | |
name: artifacts_${{ matrix.project }} | |
path: ~/dist | |
- name: "Upload daemon logs" | |
continue-on-error: true | |
if: failure() | |
uses: actions/upload-artifact@v2 | |
with: | |
name: gradle-daemon-logs_${{ matrix.project }} | |
path: ~/.gradle/daemon |