Skip to content

Commit

Permalink
Update workflows to 3.3.0 (#183)
Browse files Browse the repository at this point in the history
* Update automated integration test to use reusable workflow

Remove custom branch and validation step as it was not used
Update cron minutes slightly

* Update workflows to 3.3.0 and update lint to encompass all checks required in CI

* Trigger CI

* Revert "Trigger CI"

This reverts commit 1655a53.
  • Loading branch information
timkimadobe authored Feb 1, 2025
1 parent 66f767a commit 9119630
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 120 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ on:
jobs:
build-and-test:
name: "CI"
uses: adobe/aepsdk-commons/.github/workflows/android-build-and-test.yml@gha-android-3.1.0
uses: adobe/aepsdk-commons/.github/workflows/android-build-and-test.yml@gha-android-3.3.0
with:
android-api-levels: '[29]'
run-test-unit: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/maven-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
publish:
permissions:
contents: write
uses: adobe/aepsdk-commons/.github/workflows/android-maven-release.yml@gha-android-3.1.0
uses: adobe/aepsdk-commons/.github/workflows/android-maven-release.yml@gha-android-3.3.0
with:
tag: ${{ github.event.inputs.tag }}
create-github-release: ${{ github.event.inputs.create-github-release == 'true' }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/maven-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ jobs:
publish:
permissions:
contents: write
uses: adobe/aepsdk-commons/.github/workflows/android-maven-snapshot.yml@gha-android-3.1.0
uses: adobe/aepsdk-commons/.github/workflows/android-maven-snapshot.yml@gha-android-3.3.0
secrets: inherit
2 changes: 1 addition & 1 deletion .github/workflows/update-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
permissions:
contents: write
pull-requests: write
uses: adobe/aepsdk-commons/.github/workflows/versions.yml@gha-android-3.1.0
uses: adobe/aepsdk-commons/.github/workflows/versions.yml@gha-android-3.3.0
with:
version: ${{ github.event.inputs.version }}
branch: ${{ github.event.inputs.branch }}
Expand Down
131 changes: 16 additions & 115 deletions .github/workflows/upstream-integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,16 @@
name: Integration Tests

on:
# `*` is a special character in YAML so you have to quote this string
# Avoiding start of hour and other common times to avoid conflicts with peak times
schedule:
# Run every weekday at 12:45 PM PDT (Daylight saving time) -> 7:45 PM UTC
# Add +1 hour when back in PST
- cron: '45 19 * * 1-5'
# The `*` character is a special symbol in YAML and must be quoted.
#
# Scheduled job timing:
# * Runs every weekday at 11:37 AM PST / 12:37 PM PDT (during daylight saving time).
# * Avoids the start of the hour and other peak times to reduce runner availability issues.
- cron: '37 19 * * 1-5'

workflow_dispatch:
inputs:
branch:
description: 'The branch to use when running the integration tests'
required: false
default: 'main'
id:
description: '(Optional) The identifier for the run.'
required: false
Expand All @@ -53,12 +50,8 @@ on:
- 'None'

jobs:
test-integration-upstream:
runs-on: ubuntu-latest
strategy:
matrix:
api-level: [29]

setup-job:
runs-on: ubuntu-24.04
steps:
- name: Job run identifier ${{ github.event.inputs.id }}
run: |
Expand All @@ -68,104 +61,12 @@ jobs:
echo 'Job run identifier is:' ${{ inputs.id }}
fi;
- name: Check branch mismatch
run: |
CURRENT_BRANCH=$(echo "${GITHUB_REF##*/}")
INPUT_BRANCH="${{ github.event.inputs.branch }}"
echo "Running on branch: ${CURRENT_BRANCH}"
echo "Input branch: ${INPUT_BRANCH}"
if [ "${CURRENT_BRANCH}" != "${INPUT_BRANCH}" ]; then
echo "::warning title=Branch Mismatch::Input branch '${INPUT_BRANCH}' does not match current branch '${CURRENT_BRANCH}'"
fi
# This is to help reduce Android emulator boot up flakiness issues:
# See: https://github.com/ReactiveCircus/android-emulator-runner/issues/324#issuecomment-2009351180
- name: Delete unnecessary tools 🔧
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1
with:
android: false # Don't remove Android tools
tool-cache: true # Remove image tool cache - rm -rf "$AGENT_TOOLSDIRECTORY"
dotnet: true # rm -rf /usr/share/dotnet
haskell: true # rm -rf /opt/ghc...
swap-storage: true # rm -f /mnt/swapfile (4GiB)
docker-images: false # Takes 16s, enable if needed in the future
large-packages: false # includes google-cloud-sdk and it's slow

# The Android emulator requires Kernel-based Virtual Machine (KVM) access to run efficiently.
# This step ensures that the KVM is accessible with the proper permissions across all users.
- name: Enable KVM group perms
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
ls /dev/kvm
- name: Checkout
uses: actions/[email protected]
with:
ref: ${{ github.event.inputs.branch }}

- name: Set up Java
uses: actions/[email protected]
with:
distribution: 'zulu'
java-version: 17

- name: Gradle cache
uses: gradle/actions/[email protected]

- name: AVD cache
uses: actions/[email protected]
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ matrix.api-level }}

# Note that the AVD configurations must exactly match what's used in the test step, otherwise the cache will not be used.
- name: create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@f0d1ed2dcad93c7479e8b2f2226c83af54494915 # v2.32.0
with:
api-level: ${{ matrix.api-level }}
arch: x86_64
disk-size: 6000M
heap-size: 600M
force-avd-creation: false
emulator-options: -no-metrics -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
script: echo "Generated AVD snapshot for caching."
upstream-integration-test:
name: "Edge Network (server) integration test"
needs: setup-job
uses: adobe/aepsdk-commons/.github/workflows/[email protected]
with:
android-api-levels: '[29]'
command: make upstream-integration-test TAGS_MOBILE_PROPERTY_ID=${{ github.event.inputs.tags-mobile-property-id }} EDGE_LOCATION_HINT=${{ github.event.inputs.edge-location-hint }}
secrets: inherit

# Logcat logging from: https://github.com/ReactiveCircus/android-emulator-runner/issues/9#issuecomment-867909354
- name: Run tests
uses: reactivecircus/android-emulator-runner@f0d1ed2dcad93c7479e8b2f2226c83af54494915 # v2.32.0
with:
api-level: ${{ matrix.api-level }}
arch: x86_64
disk-size: 6000M
heap-size: 600M
force-avd-creation: false
emulator-options: -no-snapshot-save -no-metrics -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
script: |
mkdir -p logs # Ensure the 'logs' directory exists
adb logcat -c # Clear logs
touch logs/emulator.log # Create log file
chmod 777 logs/emulator.log # Allow writing to log file
adb logcat >> logs/emulator.log & # Pipe all logcat messages into log file as a background process
make upstream-integration-test TAGS_MOBILE_PROPERTY_ID=${{ github.event.inputs.tags-mobile-property-id }} EDGE_LOCATION_HINT=${{ github.event.inputs.edge-location-hint }}
- name: Upload Logcat Logs
if: always()
uses: actions/[email protected]
with:
name: logcat-logs
path: logs/emulator.log

# Potential workflow solutions on job failure
- name: On failure
if: ${{ failure() }}
run: |
echo 'Job used branch: ' ${{ github.event.inputs.branch }}. Please make sure this is the branch to run off of.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ checkformat:
format-license:
(./code/gradlew -p code licenseFormat)

lint:
# Used by build and test CI workflow
lint: checkformat
(./code/gradlew -p code/$(EXTENSION-LIBRARY-FOLDER-NAME) lint)

unit-test:
Expand Down

0 comments on commit 9119630

Please sign in to comment.