-
Notifications
You must be signed in to change notification settings - Fork 44
Expand file tree
/
Copy pathaction.yml
More file actions
176 lines (146 loc) · 5.69 KB
/
Copy pathaction.yml
File metadata and controls
176 lines (146 loc) · 5.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
name: Android road test (selected RN app & AndroidApp)
description: Package the given RN app as AAR, publish to Maven Local, and build the corresponding AndroidApp flavor
inputs:
flavor:
description: 'AndroidApp flavor to build (expo<version> or vanilla)'
required: true
rn-project-path:
description: 'Path to the RN project to build'
required: true
rn-project-maven-path:
description: 'Maven path to the RN project, e.g. com/rnapp/brownfieldlib'
required: true
restore-turbo-cache:
description: 'Whether to restore the Turbo cache during setup'
required: false
default: 'true'
runs:
using: composite
steps:
- name: '::group:: Setup & prepare Android'
run: |
echo "::group::Setup & prepare Android"
echo "flavor=${{ inputs.flavor }} rn-project=${{ inputs.rn-project-path }}"
shell: bash
- name: Setup
uses: ./.github/actions/setup
with:
restore-turbo-cache: ${{ inputs.restore-turbo-cache }}
- name: Prepare Android environment
id: prepare-android
uses: ./.github/actions/prepare-android
with:
gradle-workflow-job-context: ${{ inputs.flavor }}
rn-project-path: ${{ inputs.rn-project-path }}
android-ccache: 'true'
- name: '::endgroup:: Setup & prepare Android'
run: echo "::endgroup::"
shell: bash
- name: '::group:: Brownfield Gradle plugin'
run: echo "::group::Brownfield Gradle plugin"
shell: bash
- name: Publish Brownfield Gradle Plugin to Maven Local
run: |
yarn run brownfield:plugin:publish:local
shell: bash
- name: '::endgroup:: Brownfield Gradle plugin'
run: echo "::endgroup::"
shell: bash
- name: '::group:: RN app — prebuild, package & publish AAR'
run: echo "::group::RN app — prebuild, package & publish AAR"
shell: bash
- name: Prebuild Expo app
if: ${{ startsWith(inputs.flavor, 'expo') }}
run: |
cd ${{ inputs.rn-project-path }}
yarn run expo prebuild --platform android
shell: bash
- name: Patch ExpoApp Android build.gradle for CI
if: ${{ startsWith(inputs.flavor, 'expo') }}
run: |
cd ${{ inputs.rn-project-path }}
yarn run brownfield:prepare:android:ci
shell: bash
- name: Package AAR with the Brownfield CLI
run: |
cd ${{ inputs.rn-project-path }}
yarn run brownfield:package:android
shell: bash
- name: Publish AAR artifact to Maven Local
run: |
cd ${{ inputs.rn-project-path }}
yarn run brownfield:publish:android
shell: bash
- name: Resolve AAR variants
id: aar-variants
run: |
if [[ "${{ inputs.flavor }}" == "vanilla" ]]; then
echo "debug=devDebug" >> "$GITHUB_OUTPUT"
echo "release_pattern=brownfieldlib-0.0.1-SNAPSHOT-devRelease.aar" >> "$GITHUB_OUTPUT"
echo "verify_debug=true" >> "$GITHUB_OUTPUT"
else
echo "release_pattern=brownfieldlib-0.0.1-SNAPSHOT.aar" >> "$GITHUB_OUTPUT"
echo "verify_debug=false" >> "$GITHUB_OUTPUT"
fi
shell: bash
- name: Verify debug AAR exists in Maven Local
if: ${{ steps.aar-variants.outputs.verify_debug == 'true' }}
run: stat ~/.m2/repository/${{ inputs.rn-project-maven-path }}/0.0.1-SNAPSHOT/brownfieldlib-0.0.1-SNAPSHOT-${{ steps.aar-variants.outputs.debug }}.aar
shell: bash
- name: Verify release AAR exists in Maven Local
run: |
AAR_DIR=~/.m2/repository/${{ inputs.rn-project-maven-path }}/0.0.1-SNAPSHOT
AAR_GLOB="$AAR_DIR/${{ steps.aar-variants.outputs.release_pattern }}"
if ! compgen -G "$AAR_GLOB" > /dev/null; then
echo "Expected release AAR was not published to Maven Local."
echo "Looked for: $AAR_GLOB"
ls -la "$AAR_DIR"
exit 1
fi
ls -1 $AAR_GLOB
shell: bash
- name: '::endgroup:: RN app — prebuild, package & publish AAR'
run: echo "::endgroup::"
shell: bash
- name: '::group:: Clean RN android outputs'
run: echo "::group::Clean RN android outputs"
shell: bash
- name: Clean up local RN Android build outputs
run: |
ANDROID_DIR="${{ inputs.rn-project-path }}/android"
rm -rf "$ANDROID_DIR/build"
rm -rf "$ANDROID_DIR/.cxx"
rm -rf "$ANDROID_DIR/.gradle"
rm -rf "$ANDROID_DIR/app/build"
rm -rf "$ANDROID_DIR/app/.cxx"
rm -rf "$ANDROID_DIR/app/.gradle"
find "$ANDROID_DIR" -maxdepth 2 -name '.cxx' -type d -prune -exec rm -rf {} +
shell: bash
- name: '::endgroup:: Clean RN android outputs'
run: echo "::endgroup::"
shell: bash
- name: '::group:: AndroidApp — assemble consumer app'
run: echo "::group::AndroidApp — assemble consumer app"
shell: bash
- name: Build native Android Brownfield app
run: yarn run build:example:android-consumer:${{ inputs.flavor }}
shell: bash
- name: '::endgroup:: AndroidApp — assemble consumer app'
run: echo "::endgroup::"
shell: bash
- name: '::group:: Save ccache & summary'
run: echo "::group::Save ccache & summary"
shell: bash
- name: Save Android ccache
if: steps.prepare-android.outputs.android-ccache-cache-hit != 'true'
uses: actions/cache/save@9255dc7a253b0ccc959486e2bca901246202afeb # v5
with:
path: .android_ccache
key: ${{ steps.prepare-android.outputs.android-ccache-cache-primary-key }}
- name: Log Android ccache stats
uses: ./.github/actions/ccache-summary
with:
name: Android road test (${{ inputs.flavor }})
- name: '::endgroup:: Save ccache & summary'
run: echo "::endgroup::"
shell: bash