Merge shared code branch into rust layout feature branch #1386
Workflow file for this run
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
# Copyright 2023 Google LLC | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
name: SDK Main Workflow | |
# The on: and concurrencency: blocks should be the same for all core workflows | |
# Triggers nightly, on merges or pushes to main and stable and on pull requests. | |
on: | |
push: | |
branches: | |
- main | |
- 'stable/**' | |
pull_request: | |
merge_group: | |
schedule: | |
- cron: "0 0 * * *" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | |
cancel-in-progress: true | |
permissions: | |
contents: read | |
jobs: | |
############## Lints | |
validate-gradle-wrapper: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@8ca2b8b2ece13480cda6dacd3511b49857a23c09 # v2.5.1 | |
with: | |
egress-policy: audit | |
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 | |
- uses: gradle/wrapper-validation-action@56b90f209b02bf6d1deae490e9ef18b21a389cd4 # v1.1.0 | |
lint-kotlin: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@8ca2b8b2ece13480cda6dacd3511b49857a23c09 # v2.5.1 | |
with: | |
egress-policy: audit | |
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v3.5.2 | |
- name: Set up Java | |
uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0 # v3.13.0 | |
with: | |
distribution: "temurin" | |
java-version: "17" | |
- uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a # v2.7.1 | |
with: | |
cache-read-only: true | |
arguments: ktfmtCheck ktfmtCheckBuildScripts --no-configuration-cache | |
actionlint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@8ca2b8b2ece13480cda6dacd3511b49857a23c09 # v2.5.1 | |
with: | |
egress-policy: audit | |
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 | |
- name: Download actionlint | |
id: get_actionlint | |
run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) | |
shell: bash | |
- name: Check workflow files | |
run: ${{ steps.get_actionlint.outputs.executable }} -color | |
shell: bash | |
lint-rust: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@8ca2b8b2ece13480cda6dacd3511b49857a23c09 # v2.5.1 | |
with: | |
egress-policy: audit | |
- run: rustup toolchain install stable --profile minimal | |
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v3.5.2 | |
- name: Rust lint | |
run: cargo-fmt --all --check | |
cargo-deny: | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
checks: | |
- advisories | |
- bans licenses sources | |
# Prevent sudden announcement of a new advisory from failing ci: | |
continue-on-error: ${{ matrix.checks == 'advisories' }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: EmbarkStudios/cargo-deny-action@v1 | |
with: | |
command: check ${{ matrix.checks }} | |
validate-dependabot: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@8ca2b8b2ece13480cda6dacd3511b49857a23c09 # v2.5.1 | |
with: | |
egress-policy: audit | |
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 | |
- uses: marocchino/validate-dependabot@30653575251e0731f7c99bff8773e3988361597e # v2.1.0 | |
############## Gradle | |
sdk-support-build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@8ca2b8b2ece13480cda6dacd3511b49857a23c09 # v2.5.1 | |
with: | |
egress-policy: audit | |
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v3.5.2 | |
- name: Set up Java | |
uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0 # v3.13.0 | |
with: | |
distribution: "temurin" | |
java-version: "17" | |
- name: Set up Gradle | |
uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a # v2.9.0 | |
with: | |
# Upload in the dependency-review workflow | |
dependency-graph: generate | |
gradle-home-cache-cleanup: true | |
- name: Test build-logic | |
uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a # v2.9.0 | |
with: | |
build-root-directory: build-logic | |
arguments: test | |
- name: Test the plugins | |
uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a # v2.9.0 | |
with: | |
build-root-directory: plugins | |
arguments: test | |
sdk-build: | |
runs-on: "ubuntu-latest" | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@8ca2b8b2ece13480cda6dacd3511b49857a23c09 # v2.5.1 | |
with: | |
egress-policy: audit | |
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v3.5.2 | |
- name: Set up Java | |
uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0 # v3.13.0 | |
with: | |
distribution: "temurin" | |
java-version: "17" | |
- name: Set up Gradle | |
uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a # v2.9.0 | |
with: | |
# Upload in the dependency-review workflow | |
dependency-graph: generate | |
gradle-home-cache-cleanup: true | |
- name: Update Rust | |
run: rustup toolchain install stable --profile minimal | |
- name: Install Rust toolchains | |
run: ./install-rust-toolchains.sh | |
- name: Set up Rust Cache | |
uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43 | |
with: | |
workspaces: ". -> designcompose/build/intermediates/cargoTarget" | |
shared-key: "gradle-rust" | |
save-if: ${{ github.ref == 'refs/heads/main' }} | |
- name: Full Gradle Test and publish | |
uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a # v2.9.0 | |
with: | |
arguments: check build publishAllPublicationsToLocalDirRepository | |
- name: Upload maven repo | |
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 | |
with: | |
name: designcompose_m2repo | |
path: build/designcompose_m2repo/ | |
# These tests run on the local JVM and don't need the rust code, | |
# so it makes sense to put them in a seperate job | |
verify-roborazzi: | |
runs-on: "ubuntu-latest" | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@8ca2b8b2ece13480cda6dacd3511b49857a23c09 # v2.5.1 | |
with: | |
egress-policy: audit | |
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v3.5.2 | |
- name: Set up Java | |
uses: actions/setup-java@cd89f46ac9d01407894225f350157564c9c7cee2 # v3.12.0 | |
with: | |
distribution: "temurin" | |
java-version: "17" | |
- name: Set up Gradle | |
uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a # v2.9.0 | |
with: | |
# Upload in the dependency-review workflow | |
dependency-graph: generate | |
gradle-home-cache-cleanup: true | |
- name: Generate full comparison | |
uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a # v2.9.0 | |
with: | |
arguments: compareRoborazziDebug | |
- name: Upload diff report | |
uses: actions/upload-artifact@v3 | |
with: | |
name: screenshot-diff-report | |
path: | | |
**/build/outputs/roborazzi | |
**/build/reports/roborazzi | |
retention-days: 30 | |
- name: Verify Roborazzi | |
uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a # v2.9.0 | |
with: | |
arguments: verifyRoborazziDebug | |
########### Tutorial app | |
tutorial-app: | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
needs: sdk-build | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@8ca2b8b2ece13480cda6dacd3511b49857a23c09 # v2.5.1 | |
with: | |
egress-policy: audit | |
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 | |
- name: Set up Java | |
uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0 # v3.13.0 | |
with: | |
distribution: "temurin" | |
java-version: "17" | |
- name: Set up Gradle | |
uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a # v2.4.2 | |
with: | |
# Dependency graph isn't supported on Windows and we don't need it to run on Mac either | |
# This is GitHub's ternary operator | |
dependency-graph: ${{ matrix.os == 'ubuntu-latest' && 'generate' || 'disabled' }} | |
gradle-home-cache-cleanup: true | |
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | |
with: | |
name: designcompose_m2repo | |
path: designcompose_m2repo | |
- name: "Set environment variables (Linux/Mac)" | |
if: ${{ matrix.os != 'windows-latest'}} | |
run: | | |
echo "ORG_GRADLE_PROJECT_DesignComposeMavenRepo=$GITHUB_WORKSPACE/designcompose_m2repo" >> "$GITHUB_ENV" | |
- name: "Set environment variables (Windows)" | |
if: ${{ matrix.os == 'windows-latest'}} | |
run: | | |
chcp 65001 #set code page to utf-8 | |
echo "ORG_GRADLE_PROJECT_DesignComposeMavenRepo=$env:GITHUB_WORKSPACE/designcompose_m2repo" >> "$env:GITHUB_ENV" | |
- name: Check Tutorial App | |
uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a # v2.7.1 | |
with: | |
build-root-directory: reference-apps/tutorial | |
arguments: | | |
--init-script ../local-design-compose-repo.init.gradle.kts | |
build | |
######### Unbundled apps | |
aaos-unbundled: | |
runs-on: ubuntu-latest | |
needs: sdk-build | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@8ca2b8b2ece13480cda6dacd3511b49857a23c09 # v2.5.1 | |
with: | |
egress-policy: audit | |
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 | |
- name: Set up Java | |
uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0 # v3.13.0 | |
with: | |
distribution: "temurin" | |
java-version: "17" | |
- name: Set up Gradle | |
uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a # v2.4.2 | |
with: | |
dependency-graph: generate | |
gradle-home-cache-cleanup: true | |
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | |
with: | |
name: designcompose_m2repo | |
path: designcompose_m2repo | |
- run: sudo apt-get install repo | |
- name: "Set environment variables" | |
run: | | |
echo "ORG_GRADLE_PROJECT_DesignComposeMavenRepo=$GITHUB_WORKSPACE/designcompose_m2repo" >> "$GITHUB_ENV" | |
echo "ORG_GRADLE_PROJECT_unbundledAAOSDir=$GITHUB_WORKSPACE/undbundled-aaos" >> "$GITHUB_ENV" | |
- name: Check out the Unbundled AAOS Repo | |
run: | | |
HOST=https://android.googlesource.com/platform/manifest | |
BRANCH=ub-automotive-master-20230622 | |
mkdir "$ORG_GRADLE_PROJECT_unbundledAAOSDir" | |
cd "$ORG_GRADLE_PROJECT_unbundledAAOSDir" | |
repo init -u $HOST -b $BRANCH -g pdk,pdk-fs --depth=1 | |
repo sync -cq -j4 | |
- name: Check MediaCompose | |
uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a # v2.7.1 | |
with: | |
build-root-directory: reference-apps/aaos-unbundled | |
arguments: | | |
check | |
gradle-build-profile: | |
strategy: | |
matrix: | |
task: [assembleDebug, publishAllPublicationsToLocalDirRepository] | |
cache: [cache-enabled, cache-disabled] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@8ca2b8b2ece13480cda6dacd3511b49857a23c09 # v2.5.1 | |
with: | |
egress-policy: audit | |
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v3.5.2 | |
- name: Set up Java | |
uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0 # v3.13.0 | |
with: | |
distribution: "temurin" | |
java-version: "17" | |
- name: Set up Gradle | |
uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a # v2.9.0 | |
with: | |
cache-disabled: ${{matrix.cache == 'cache-disabled'}} | |
- name: Set up Rust Cache | |
if: ${{matrix.cache == 'cache-enabled'}} | |
uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43 | |
with: | |
workspaces: ". -> designcompose/build/intermediates/cargoTarget" | |
shared-key: "gradle-rust" | |
- name: Update Rust | |
run: rustup toolchain install stable --profile minimal | |
- name: Install Rust toolchains | |
run: ./install-rust-toolchains.sh | |
- name: Run the profiled build | |
uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a # v2.9.0 | |
with: | |
arguments: | |
${{matrix.task}} --profile | |
- name: Parse the results | |
run: | | |
./dev-scripts/parse-profile-data.sh | |
- name: Upload profile info | |
uses: actions/upload-artifact@v3 | |
with: | |
name: gradle-profile-${{matrix.task}}-${{matrix.cache}} | |
path: | | |
**/build/reports/profile | |
if-no-files-found: error | |
############# Rust | |
rust-test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@8ca2b8b2ece13480cda6dacd3511b49857a23c09 # v2.5.1 | |
with: | |
egress-policy: audit | |
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v3.5.2 | |
- run: rustup toolchain install stable --profile minimal | |
- uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43 | |
with: | |
save-if: ${{ github.ref == 'refs/heads/main' }} | |
- name: Build all | |
run: cargo build --all-targets --all-features | |
- name: Test all | |
run: cargo test --all-targets --all-features | |
############ Figma resources | |
figma-resources: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@8ca2b8b2ece13480cda6dacd3511b49857a23c09 # v2.5.1 | |
with: | |
egress-policy: audit | |
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v3.5.2 | |
- uses: ./.github/actions/build-figma-resource | |
with: | |
resource: auto-content-preview-widget | |
- uses: ./.github/actions/build-figma-resource | |
with: | |
resource: extended-layout-plugin | |