Skip to content

Commit

Permalink
workflow: updated actions and commands to their latest
Browse files Browse the repository at this point in the history
  • Loading branch information
Aashu-Dubey committed Jul 10, 2024
1 parent d54cd3f commit ffa70f5
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 21 deletions.
38 changes: 29 additions & 9 deletions .github/workflows/build-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,46 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

# Optional security step: Validate whether gradle-wrapper.jar is valid or malicious
- name: Validate Gradle Wrapper
uses: gradle/actions/wrapper-validation@v3

# 'corepack enable' is needed for now till it's experimental, may remove the command once it becomes stable in later node releases
- name: Enable Corepack
run: corepack enable

# Setup Web environment to install packages.
- name: Setup Web environment
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '16'
node-version: '20'
cache: 'yarn'

# Setup Java environment in order to build the Android app.
- name: Setup Java environment
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '11'
cache: 'gradle'

# Here '--frozen-lockfile' will only use commited 'yarn.lock', and will throw error if some update is needed
# Setup gradle using official gradle action
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
add-job-summary: 'on-failure'

- name: Restore node_modules from cache
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock') }}
restore-keys: ${{ runner.os }}-node-modules-

# Here '--immutable' will only use commited 'yarn.lock', and will throw error if some update is needed
- name: Install node_modules
run: yarn install --frozen-lockfile
run: yarn install --immutable

# In some cases, Gradle is not executable by default, so we do this before the build process
- name: Make gradlew executable
Expand All @@ -50,7 +70,7 @@ jobs:
run: ./gradlew assembleRelease --no-daemon

- name: Save apk file as artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: rn-animation-samples
path: android/app/build/outputs/apk/release/app-release.apk
path: android/app/build/outputs/apk/release/app-release.apk
51 changes: 39 additions & 12 deletions .github/workflows/build-ios-simulator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,39 @@ jobs:
runs-on: macos-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

# 'corepack enable' is needed for now till it's experimental, may remove the command once it becomes stable in later node releases
- name: Enable Corepack
run: corepack enable

# Setup Web environment to install packages.
- name: Setup Web environment
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '16'
node-version: '20'
cache: 'yarn'

# Here '--frozen-lockfile' will only use commited 'yarn.lock', and will throw error if some update is needed
- name: Install node_modules
run: yarn install --frozen-lockfile
- uses: hendrikmuhs/[email protected]
name: Xcode Compile Cache
with:
key: ${{ runner.os }}-ccache # makes a unique key w/related restore key internally
create-symlink: true
max-size: 1500M

- name: Restore node_modules from cache
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock') }}
restore-keys: ${{ runner.os }}-node-modules-

# improve iOS build compilation time
- name: Restore buildcache
uses: mikehardy/buildcache-action@v2
continue-on-error: true
# Here '--immutable' will only use commited 'yarn.lock', and will throw error if some update is needed
- name: Install node_modules
run: yarn install --immutable

- name: Restore Pods cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
ios/Pods
Expand All @@ -45,6 +58,13 @@ jobs:
key: ${{ runner.os }}-pods-${{ hashFiles('ios/Podfile.lock') }}
restore-keys: ${{ runner.os }}-pods-

- name: Restore build artifacts from cache
uses: actions/cache@v4
with:
path: ios/build
key: ${{ runner.os }}-ios-derived-data-${{ hashFiles('ios/Podfile.lock') }}
restore-keys: ${{ runner.os }}-ios-derived-data-

- name: Install Pod files
run: npx pod-install ios

Expand All @@ -54,6 +74,12 @@ jobs:
- name: Run simulator build command
working-directory: ios
run: |
export CCACHE_SLOPPINESS=clang_index_store,file_stat_matches,include_file_ctime,include_file_mtime,ivfsoverlay,pch_defines,modules,system_headers,time_macros
export CCACHE_FILECLONE=true
export CCACHE_DEPEND=true
export CCACHE_INODECACHE=true
export CCACHE_LIMIT_MULTIPLE=0.95
ccache -s
set -o pipefail
xcodebuild \
CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ \
Expand All @@ -62,6 +88,7 @@ jobs:
-sdk iphonesimulator \
-configuration Release \
-derivedDataPath build | xcpretty
ccache -s
- name: Store build .app file as zip
working-directory: ios
Expand All @@ -71,7 +98,7 @@ jobs:
zip -r -y -o output/RN_Animations.zip RN_Animations.app
- name: Save build file as artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: rn_animation_samples_ios
path: ios/build/Build/Products/Release-iphonesimulator/output

0 comments on commit ffa70f5

Please sign in to comment.