-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Expand file tree
/
Copy pathaction.yml
More file actions
107 lines (107 loc) · 5.37 KB
/
Copy pathaction.yml
File metadata and controls
107 lines (107 loc) · 5.37 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
name: build-android
description: This action builds android
inputs:
release-type:
required: true
description: The type of release we are building. It could be nightly, release or dry-run
gradle-cache-encryption-key:
description: 'The encryption key needed to store the Gradle Configuration cache'
runs:
using: composite
steps:
- name: Setup git safe folders
shell: bash
run: git config --global --add safe.directory '*'
- name: Setup node.js
uses: ./.github/actions/setup-node
- name: Install node dependencies
uses: ./.github/actions/yarn-install
- name: Read current RNVersion
shell: bash
id: read-rn-version
run: |
echo "rn-version=$(jq -r '.version' packages/react-native/package.json)" >> $GITHUB_OUTPUT
- name: Set React Native Version
# We don't want to set the version for stable branches, because this has been
# already set from the 'create release' commits on the release branch.
# For testing RC.0, though, the version has not been set yet. In that case, we are on Stable branch and
# it is the only case when the version is still 1000.0.0
# We also skip this when the PR targets a stable branch (github.base_ref ends with '-stable'),
# since the version is already set on the stable branch.
if: ${{ !endsWith(github.ref_name, '-stable') && !endsWith(github.base_ref || '', '-stable') || endsWith(github.ref_name, '-stable') && steps.read-rn-version.outputs.rn-version == '1000.0.0' }}
shell: bash
run: node ./scripts/releases/set-rn-artifacts-version.js --build-type ${{ inputs.release-type }}
- name: Setup gradle
uses: ./.github/actions/setup-gradle
with:
cache-read-only: 'false'
cache-encryption-key: ${{ inputs.gradle-cache-encryption-key }}
- name: Restore Android ccache
uses: actions/cache/restore@v5
with:
path: /github/home/.cache/ccache
key: v2-ccache-android-${{ github.job }}-${{ github.ref }}-${{ hashFiles('packages/react-native/ReactAndroid/**/*.cpp', 'packages/react-native/ReactAndroid/**/*.h', 'packages/react-native/ReactCommon/**/*.cpp', 'packages/react-native/ReactAndroid/**/CMakeLists.txt', 'packages/react-native/ReactCommon/**/CMakeLists.txt') }}
restore-keys: |
v2-ccache-android-${{ github.job }}-${{ github.ref }}-
v2-ccache-android-${{ github.job }}-
v2-ccache-android-
- name: Show ccache stats
shell: bash
run: ccache -s -v
- name: Build and publish all the Android Artifacts to /tmp/maven-local
shell: bash
run: |
if [[ "${{ inputs.release-type }}" == "dry-run" ]]; then
# dry-run: we only build ARM64 to save time/resources. For release/nightlies the default is to build all archs.
export ORG_GRADLE_PROJECT_reactNativeArchitectures="arm64-v8a,x86" # x86 is required for E2E testing
export HERMES_PREBUILT_FLAG="ORG_GRADLE_PROJECT_react.internal.useHermesNightly=true"
TASKS="publishAllToMavenTempLocal build"
elif [[ "${{ inputs.release-type }}" == "nightly" ]]; then
# nightly: we set isSnapshot to true so artifacts are sent to the right repository on Maven Central.
export ORG_GRADLE_PROJECT_isSnapshot="true"
export HERMES_PREBUILT_FLAG="ORG_GRADLE_PROJECT_react.internal.useHermesNightly=true"
TASKS="publishAllToMavenTempLocal publishAndroidToSonatype build"
else
# release: we want to build all archs (default)
export HERMES_PREBUILT_FLAG="ORG_GRADLE_PROJECT_react.internal.useHermesStable=true"
TASKS="publishAllToMavenTempLocal publishAndroidToSonatype build"
fi
env "$HERMES_PREBUILT_FLAG" ./gradlew $TASKS -PenableWarningsAsErrors=true
- name: Save Android ccache
if: ${{ github.ref == 'refs/heads/main' || contains(github.ref, '-stable') }}
uses: actions/cache/save@v5
with:
path: /github/home/.cache/ccache
key: v2-ccache-android-${{ github.job }}-${{ github.ref }}-${{ hashFiles('packages/react-native/ReactAndroid/**/*.cpp', 'packages/react-native/ReactAndroid/**/*.h', 'packages/react-native/ReactCommon/**/*.cpp', 'packages/react-native/ReactAndroid/**/CMakeLists.txt', 'packages/react-native/ReactCommon/**/CMakeLists.txt') }}
- name: Show ccache stats
shell: bash
run: ccache -s -v
- name: Upload Maven Artifacts
uses: actions/upload-artifact@v6
with:
name: maven-local
path: /tmp/maven-local
- name: Upload test results
if: ${{ always() }}
uses: actions/upload-artifact@v6
with:
name: build-android-results
compression-level: 1
path: |
packages/react-native-gradle-plugin/react-native-gradle-plugin/build/reports
packages/react-native-gradle-plugin/settings-plugin/build/reports
packages/react-native/ReactAndroid/build/reports
- name: Upload RNTester APK - hermes-debug
if: ${{ always() }}
uses: actions/upload-artifact@v6
with:
name: rntester-debug
path: packages/rn-tester/android/app/build/outputs/apk/debug/
compression-level: 0
- name: Upload RNTester APK - hermes-release
if: ${{ always() }}
uses: actions/upload-artifact@v6
with:
name: rntester-release
path: packages/rn-tester/android/app/build/outputs/apk/release/
compression-level: 0