Skip to content

Commit f7ab90d

Browse files
committed
Add GitHub workflows to automatically sync + build example app
1 parent 5ba16ed commit f7ab90d

File tree

2 files changed

+130
-0
lines changed

2 files changed

+130
-0
lines changed

.github/workflows/ReleaseFork.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: GitHub Release with APKs
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
timeout-minutes: 120
13+
14+
steps:
15+
- name: Enable KVM group perms
16+
run: |
17+
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
18+
sudo udevadm control --reload-rules
19+
sudo udevadm trigger --name-match=kvm
20+
ls /dev/kvm
21+
22+
- name: Checkout
23+
24+
uses: actions/checkout@v4
25+
26+
- name: Copy CI gradle.properties
27+
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties
28+
29+
- name: Set up JDK 17
30+
uses: actions/setup-java@v5
31+
with:
32+
distribution: 'zulu'
33+
java-version: 17
34+
35+
- name: Setup Gradle
36+
uses: gradle/actions/setup-gradle@v4
37+
with:
38+
build-scan-publish: true
39+
build-scan-terms-of-use-url: "https://gradle.com/terms-of-service"
40+
build-scan-terms-of-use-agree: "yes"
41+
42+
- name: Setup Android SDK
43+
uses: android-actions/setup-android@v3
44+
45+
- name: Accept licenses
46+
run: yes | sdkmanager --licenses || true
47+
48+
- name: Setup GMD
49+
run: ./gradlew :benchmarks:pixel6Api33Setup
50+
--info
51+
-Pandroid.experimental.testOptions.managedDevices.emulator.showKernelLogging=true
52+
-Pandroid.testoptions.manageddevices.emulator.gpu="swiftshader_indirect"
53+
54+
- name: Build release variant including baseline profile generation
55+
run: ./gradlew :app:assembleDemoRelease
56+
-Pandroid.testInstrumentationRunnerArguments.androidx.benchmark.enabledRules=BaselineProfile
57+
-Pandroid.testoptions.manageddevices.emulator.gpu="swiftshader_indirect"
58+
-Pandroid.experimental.testOptions.managedDevices.emulator.showKernelLogging=true
59+
-Pandroid.experimental.androidTest.numManagedDeviceShards=1
60+
-Pandroid.experimental.testOptions.managedDevices.maxConcurrentDevices=1
61+
- name: Create Release
62+
id: create_release
63+
uses: actions/create-release@v1
64+
env:
65+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66+
with:
67+
tag_name: ${{ github.ref }}
68+
release_name: ${{ github.ref }}
69+
draft: false
70+
prerelease: false
71+
72+
- name: Upload app
73+
uses: actions/upload-release-asset@v1
74+
env:
75+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
76+
with:
77+
upload_url: ${{ steps.create_release.outputs.upload_url }}
78+
asset_path: app/build/outputs/apk/demo/release/app-demo-release.apk
79+
asset_name: app-demo-release.apk
80+
asset_content_type: application/vnd.android.package-archive

.github/workflows/SyncUpstream.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Sync with Upstream
2+
3+
on:
4+
schedule:
5+
# Run every day at midnight UTC
6+
- cron: '0 0 * * *'
7+
workflow_dispatch: # Allow manual trigger
8+
9+
jobs:
10+
sync:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
17+
token: ${{ secrets.GITHUB_TOKEN }}
18+
19+
- name: Configure Git
20+
run: |
21+
git config user.name "github-actions[bot]"
22+
git config user.email "github-actions[bot]@users.noreply.github.com"
23+
24+
- name: Add upstream remote
25+
run: git remote add upstream https://github.com/android/nowinandroid.git
26+
27+
- name: Fetch upstream
28+
run: git fetch upstream --tags --prune
29+
30+
- name: Rebase and push all branches
31+
run: |
32+
for branch in $(git branch -r | grep 'upstream/' | grep -v 'HEAD' | sed 's/upstream\///'); do
33+
echo "Processing branch: $branch"
34+
35+
# Check if the branch exists in origin
36+
if git ls-remote --exit-code origin "$branch" > /dev/null 2>&1; then
37+
# Branch exists in origin, checkout and rebase onto upstream
38+
git checkout -B "$branch" "origin/$branch"
39+
git rebase "upstream/$branch"
40+
else
41+
# Branch doesn't exist in origin, just track upstream
42+
git checkout -B "$branch" "upstream/$branch"
43+
fi
44+
45+
git push origin "$branch" --force-with-lease
46+
done
47+
48+
- name: Push all tags
49+
run: git push origin --tags
50+

0 commit comments

Comments
 (0)