Skip to content

Commit 725981f

Browse files
committed
Merge branch 'main' of github.com:callstack/react-native-brownfield into refactor/bgp/remove-deprecated-apis
2 parents ce8327a + ae4e61f commit 725981f

282 files changed

Lines changed: 13977 additions & 862 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/actions/androidapp-road-test/action.yml

Lines changed: 99 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,33 +14,54 @@ inputs:
1414
description: 'Maven path to the RN project, e.g. com/rnapp/brownfieldlib'
1515
required: true
1616

17+
restore-turbo-cache:
18+
description: 'Whether to restore the Turbo cache during setup'
19+
required: false
20+
default: 'true'
21+
1722
runs:
1823
using: composite
1924
steps:
25+
- name: '::group:: Setup & prepare Android'
26+
run: |
27+
echo "::group::Setup & prepare Android"
28+
echo "flavor=${{ inputs.flavor }} rn-project=${{ inputs.rn-project-path }}"
29+
shell: bash
30+
2031
- name: Setup
2132
uses: ./.github/actions/setup
33+
with:
34+
restore-turbo-cache: ${{ inputs.restore-turbo-cache }}
2235

2336
- name: Prepare Android environment
37+
id: prepare-android
2438
uses: ./.github/actions/prepare-android
25-
26-
- name: Restore Gradle cache
27-
uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5
2839
with:
29-
path: |
30-
~/.gradle/caches
31-
~/.gradle/wrapper
32-
key: ${{ runner.os }}-android-androidapp-${{ inputs.flavor }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
33-
restore-keys: |
34-
${{ runner.os }}-android-androidapp-${{ inputs.flavor }}-gradle-
35-
${{ runner.os }}-android-androidapp-gradle-
36-
37-
# == Brownfield Gradle Plugin ==
40+
gradle-workflow-job-context: ${{ inputs.flavor }}
41+
rn-project-path: ${{ inputs.rn-project-path }}
42+
android-ccache: 'true'
43+
44+
- name: '::endgroup:: Setup & prepare Android'
45+
run: echo "::endgroup::"
46+
shell: bash
47+
48+
- name: '::group:: Brownfield Gradle plugin'
49+
run: echo "::group::Brownfield Gradle plugin"
50+
shell: bash
51+
3852
- name: Publish Brownfield Gradle Plugin to Maven Local
3953
run: |
4054
yarn run brownfield:plugin:publish:local
4155
shell: bash
4256

43-
# == RN app ==
57+
- name: '::endgroup:: Brownfield Gradle plugin'
58+
run: echo "::endgroup::"
59+
shell: bash
60+
61+
- name: '::group:: RN app — prebuild, package & publish AAR'
62+
run: echo "::group::RN app — prebuild, package & publish AAR"
63+
shell: bash
64+
4465
- name: Prebuild Expo app
4566
if: ${{ startsWith(inputs.flavor, 'expo') }}
4667
run: |
@@ -67,16 +88,78 @@ runs:
6788
yarn run brownfield:publish:android
6889
shell: bash
6990

91+
- name: Resolve AAR variants
92+
id: aar-variants
93+
run: |
94+
if [[ "${{ inputs.flavor }}" == "vanilla" ]]; then
95+
echo "debug=devDebug" >> "$GITHUB_OUTPUT"
96+
echo "release=devRelease" >> "$GITHUB_OUTPUT"
97+
else
98+
echo "debug=debug" >> "$GITHUB_OUTPUT"
99+
echo "release=release" >> "$GITHUB_OUTPUT"
100+
fi
101+
shell: bash
102+
70103
- name: Verify debug AAR exists in Maven Local
71-
run: stat ~/.m2/repository/${{ inputs.rn-project-maven-path }}/0.0.1-SNAPSHOT/brownfieldlib-0.0.1-SNAPSHOT-debug.aar
104+
run: stat ~/.m2/repository/${{ inputs.rn-project-maven-path }}/0.0.1-SNAPSHOT/brownfieldlib-0.0.1-SNAPSHOT-${{ steps.aar-variants.outputs.debug }}.aar
72105
shell: bash
73106

74107
- name: Verify release AAR exists in Maven Local
75-
run: stat ~/.m2/repository/${{ inputs.rn-project-maven-path }}/0.0.1-SNAPSHOT/brownfieldlib-0.0.1-SNAPSHOT-release.aar
108+
run: stat ~/.m2/repository/${{ inputs.rn-project-maven-path }}/0.0.1-SNAPSHOT/brownfieldlib-0.0.1-SNAPSHOT-${{ steps.aar-variants.outputs.release }}.aar
109+
shell: bash
110+
111+
- name: '::endgroup:: RN app — prebuild, package & publish AAR'
112+
run: echo "::endgroup::"
113+
shell: bash
114+
115+
- name: '::group:: Clean RN android outputs'
116+
run: echo "::group::Clean RN android outputs"
117+
shell: bash
118+
119+
- name: Clean up local RN Android build outputs
120+
run: |
121+
ANDROID_DIR="${{ inputs.rn-project-path }}/android"
122+
rm -rf "$ANDROID_DIR/build"
123+
rm -rf "$ANDROID_DIR/.cxx"
124+
rm -rf "$ANDROID_DIR/.gradle"
125+
rm -rf "$ANDROID_DIR/app/build"
126+
rm -rf "$ANDROID_DIR/app/.cxx"
127+
rm -rf "$ANDROID_DIR/app/.gradle"
128+
find "$ANDROID_DIR" -maxdepth 2 -name '.cxx' -type d -prune -exec rm -rf {} +
76129
shell: bash
77130

78-
# == AndroidApp ==
131+
- name: '::endgroup:: Clean RN android outputs'
132+
run: echo "::endgroup::"
133+
shell: bash
134+
135+
- name: '::group:: AndroidApp — assemble consumer app'
136+
run: echo "::group::AndroidApp — assemble consumer app"
137+
shell: bash
79138

80139
- name: Build native Android Brownfield app
81140
run: yarn run build:example:android-consumer:${{ inputs.flavor }}
82141
shell: bash
142+
143+
- name: '::endgroup:: AndroidApp — assemble consumer app'
144+
run: echo "::endgroup::"
145+
shell: bash
146+
147+
- name: '::group:: Save ccache & summary'
148+
run: echo "::group::Save ccache & summary"
149+
shell: bash
150+
151+
- name: Save Android ccache
152+
if: steps.prepare-android.outputs.android-ccache-cache-hit != 'true'
153+
uses: actions/cache/save@9255dc7a253b0ccc959486e2bca901246202afeb # v5
154+
with:
155+
path: .android_ccache
156+
key: ${{ steps.prepare-android.outputs.android-ccache-cache-primary-key }}
157+
158+
- name: Log Android ccache stats
159+
uses: ./.github/actions/ccache-summary
160+
with:
161+
name: Android road test (${{ inputs.flavor }})
162+
163+
- name: '::endgroup:: Save ccache & summary'
164+
run: echo "::endgroup::"
165+
shell: bash

0 commit comments

Comments
 (0)