Skip to content

Commit 72ddacd

Browse files
authored
Merge pull request #449 from oddbit/copilot/move-example-app-build-step
Move example app build to PR workflow, simplify publish workflow
2 parents c0deedd + fd5b31e commit 72ddacd

File tree

4 files changed

+14
-132
lines changed

4 files changed

+14
-132
lines changed

.github/workflows/build_deploy.yml

Lines changed: 0 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -5,113 +5,11 @@ on:
55
- "v[0-9]+.[0-9]+.[0-9]+*"
66

77
jobs:
8-
build_example:
9-
name: Build Example App
10-
runs-on: ${{ matrix.os }}
11-
timeout-minutes: 60
12-
strategy:
13-
fail-fast: true
14-
matrix:
15-
platform:
16-
- apk
17-
- ios
18-
os:
19-
- ubuntu-latest
20-
- macos-latest
21-
exclude:
22-
# Skip build combinations where Android is attempted to build on MacOS
23-
# and iOS attempt to build on Ubuntu.
24-
- os: macos-latest
25-
platform: apk
26-
- os: ubuntu-latest
27-
platform: ios
28-
29-
# TODO(Dennis): iOS builds aren't properly configured yet. Fix and
30-
# uncomment this exclusion
31-
# https://github.com/oddbit/flutter_facebook_app_events/actions/runs/3365684172/jobs/5581387481
32-
- platform: ios
33-
34-
steps:
35-
- uses: actions/checkout@v4
36-
37-
# Ensure a compatible JDK for modern Android Gradle Plugin
38-
- name: Set up Java 17
39-
if: matrix.platform == 'apk'
40-
uses: actions/setup-java@v4
41-
with:
42-
distribution: temurin
43-
java-version: "17"
44-
45-
- name: Set up Flutter
46-
uses: subosito/flutter-action@v2
47-
with:
48-
channel: "stable"
49-
cache: true
50-
51-
- run: flutter --version
52-
53-
# Resolve root package (plugin) dependencies
54-
- name: Flutter pub get (root)
55-
run: flutter pub get
56-
57-
# Resolve example app dependencies explicitly
58-
- name: Flutter pub get (example)
59-
if: matrix.platform == 'apk'
60-
working-directory: ./example
61-
run: flutter pub get
62-
63-
- name: Configure iOS build environment
64-
if: matrix.platform == 'ios'
65-
run: |
66-
echo "FLUTTER_EXTRA_PARAMS=--no-codesign" >> $GITHUB_ENV
67-
68-
- name: Activate iOS Pods Cache
69-
uses: actions/cache@v4
70-
if: matrix.platform == 'ios'
71-
with:
72-
path: example/ios/Pods
73-
key: ${{ runner.os }}-pods-${{ hashFiles('ios/Podfile.lock') }}
74-
restore-keys: ${{ runner.os }}-pods-
75-
76-
- run: flutter doctor
77-
78-
# Start from a clean state to avoid watcher/gradle cache oddities
79-
- name: Flutter clean (example)
80-
if: matrix.platform == 'apk'
81-
working-directory: ./example
82-
run: flutter clean
83-
84-
- name: Build Flutter
85-
working-directory: ./example
86-
run: >-
87-
flutter
88-
build ${{ matrix.platform }}
89-
${{ env.FLUTTER_EXTRA_PARAMS }}
90-
91-
# Help verify Android outputs and surface them as artifacts
92-
- name: List Android outputs
93-
if: matrix.platform == 'apk'
94-
working-directory: ./example
95-
run: |
96-
echo "Listing build/app/outputs:"
97-
ls -R build/app/outputs || true
98-
99-
- name: Upload APK artifact
100-
if: matrix.platform == 'apk'
101-
uses: actions/upload-artifact@v4
102-
with:
103-
name: example-apk
104-
path: |
105-
example/build/app/outputs/flutter-apk/*.apk
106-
example/build/app/outputs/apk/**/*.apk
107-
example/build/**/outputs/**/*.apk
108-
1098
publish:
1109
name: Publish Plugin
11110
runs-on: ubuntu-latest
11211
permissions:
11312
id-token: write
114-
needs: build_example
11513
steps:
11614
- uses: actions/checkout@v4
11715

.github/workflows/pr_build_example.yml

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@ jobs:
2626

2727
- name: Set up Android SDK
2828
uses: android-actions/setup-android@v3
29-
with:
30-
api-level: 34
31-
build-tools: 34.0.0
32-
cache: true
3329

3430
- name: Set up Flutter
3531
uses: subosito/flutter-action@v2
@@ -53,19 +49,3 @@ jobs:
5349
- name: Build example APK (debug, verbose)
5450
working-directory: example
5551
run: flutter build apk --debug -v
56-
57-
- name: List Android outputs
58-
working-directory: example
59-
run: |
60-
echo "Listing build/app/outputs:"
61-
ls -R build/app/outputs || true
62-
63-
- name: Upload APK artifact
64-
uses: actions/upload-artifact@v4
65-
with:
66-
name: example-app-debug-apk
67-
path: |
68-
example/build/app/outputs/flutter-apk/app-debug.apk
69-
example/build/app/outputs/apk/debug/*.apk
70-
example/build/**/outputs/**/*.apk
71-
if-no-files-found: warn

example/android/build.gradle

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
2-
32
buildscript {
3+
ext.kotlin_version = "1.9.24"
44
repositories {
55
google()
66
mavenCentral()
77
}
88

99
dependencies {
10-
// Modern Android Gradle Plugin
1110
classpath 'com.android.tools.build:gradle:8.5.2'
12-
// Modern Kotlin
13-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.24"
11+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1412
}
1513
}
1614

@@ -21,8 +19,14 @@ allprojects {
2119
}
2220
}
2321

24-
// Custom clean task to ensure all build directories are deleted
25-
tasks.register('clean', Delete) {
22+
rootProject.buildDir = "../build"
23+
subprojects {
24+
project.buildDir = "${rootProject.buildDir}/${project.name}"
25+
}
26+
subprojects {
27+
project.evaluationDependsOn(":app")
28+
}
29+
30+
tasks.register("clean", Delete) {
2631
delete rootProject.buildDir
27-
subprojects.each { delete it.buildDir }
28-
}
32+
}

example/android/gradle/wrapper/gradle-wrapper.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
# AGP 8.5.x pairs with Gradle 8.7
7-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
6+
7+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip

0 commit comments

Comments
 (0)