Skip to content

Commit

Permalink
ci: update gh pages build actions
Browse files Browse the repository at this point in the history
  • Loading branch information
JimmyDaddy committed Dec 6, 2023
1 parent 2c1ddd0 commit 69fc683
Show file tree
Hide file tree
Showing 35 changed files with 94 additions and 4,421 deletions.
88 changes: 75 additions & 13 deletions .github/workflows/native-ci.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,6 @@ name: Build and Test
on:
pull_request:
types: [opened, synchronize, reopened]
paths:
- 'example/**'
- 'android/**'
- 'ios/**'
- 'src/**'
- 'assets/**'
- 'package.json'
- 'react-native-image-marker.podspec'
- '*.MD'
workflow_dispatch:

jobs:
Expand All @@ -22,27 +13,40 @@ jobs:
- name: Checkout the code
uses: actions/checkout@v4

- name: Verify Dev Changed files
uses: tj-actions/[email protected]
id: verify-dev-changed-files
with:
files: |
!*.md
!*.MD
!*.yml
- uses: actions/cache@v3
name: Cache node_modules
id: cache-node-modules
if: steps.verify-dev-changed-files.outputs.files_changed == 'true'
with:
path: |
node_modules
example/node_modules
key: ${{ runner.os }}-nodeModules-${{ hashFiles('package.json') }}-${{ hashFiles('example/package.json') }}

- name: Set up Ruby
if: steps.verify-dev-changed-files.outputs.files_changed == 'true'
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
bundler-cache: true

- name: Setup node 16
if: steps.verify-dev-changed-files.outputs.files_changed == 'true'
uses: actions/setup-node@v3
with:
node-version: '16'

- name: Install npm dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
if: steps.cache-node-modules.outputs.cache-hit != 'true' && steps.verify-dev-changed-files.outputs.files_changed == 'true'
run: |
ls
pwd
Expand All @@ -60,8 +64,20 @@ jobs:
- name: Checkout the code
uses: actions/checkout@v4

- name: Verify Android Changed files
uses: tj-actions/[email protected]
id: verify-android-changed-files
with:
files: |
android/**
src/**
assets/**
package.json
!example/ios/**
- uses: actions/cache@v3
name: Cache node_modules
if: steps.verify-android-changed-files.outputs.files_changed == 'true'
id: cache-node-modules
with:
path: |
Expand All @@ -73,6 +89,7 @@ jobs:
- uses: actions/cache@v3
id: cache-gradle
name: Cache Gradle dependencies
if: steps.verify-android-changed-files.outputs.files_changed == 'true'
with:
path: |
~/.gradle/caches
Expand All @@ -81,40 +98,46 @@ jobs:

- name: Set up Ruby
uses: ruby/setup-ruby@v1
if: steps.verify-android-changed-files.outputs.files_changed == 'true'
with:
ruby-version: 2.7
bundler-cache: true

- name: Setup node 16
uses: actions/setup-node@v3
if: steps.verify-android-changed-files.outputs.files_changed == 'true'
with:
node-version: '16'

- name: Set up JDK
uses: actions/setup-java@v3
if: steps.verify-android-changed-files.outputs.files_changed == 'true'
with:
distribution: 'zulu'
java-version: 11

- name: Install Gradle dependencies
if: steps.cache-gradle.outputs.cache-hit != 'true'
if: steps.cache-gradle.outputs.cache-hit != 'true' && steps.verify-android-changed-files.outputs.files_changed == 'true'
run: |
cd example/android
./gradlew build --stacktrace
- name: Run unit tests
if: steps.verify-android-changed-files.outputs.files_changed == 'true'
run: |
cd example/android
./gradlew test --stacktrace
- name: Build APK
if: steps.verify-android-changed-files.outputs.files_changed == 'true'
run: |
npm run prepack
cd example/android
./gradlew assembleRelease
mv app/build/outputs/apk/release/app-release.apk app-release-${{ github.sha }}.apk
- name: Upload APK
if: steps.verify-android-changed-files.outputs.files_changed == 'true'
uses: actions/upload-artifact@v3
with:
name: app-release-${{ github.sha }}.apk
Expand All @@ -132,8 +155,20 @@ jobs:
- name: Checkout the code
uses: actions/checkout@v4

- name: Verify Android Changed files
uses: tj-actions/[email protected]
id: verify-android-changed-files
with:
files: |
android/**
src/**
assets/**
package.json
!example/ios/**
- uses: actions/cache@v3
name: Cache node_modules
if: steps.verify-android-changed-files.outputs.files_changed == 'true'
id: cache-node-modules
with:
path: |
Expand All @@ -144,6 +179,7 @@ jobs:

- uses: actions/cache@v3
name: Cache Gradle dependencies
if: steps.verify-android-changed-files.outputs.files_changed == 'true'
id: cache-gradle
with:
path: |
Expand All @@ -154,23 +190,27 @@ jobs:

- name: Set up Ruby
uses: ruby/setup-ruby@v1
if: steps.verify-android-changed-files.outputs.files_changed == 'true'
with:
ruby-version: 2.7
bundler-cache: true

- name: Setup node 16
uses: actions/setup-node@v3
if: steps.verify-android-changed-files.outputs.files_changed == 'true'
with:
node-version: '16'

- name: Set up JDK
uses: actions/setup-java@v3
if: steps.verify-android-changed-files.outputs.files_changed == 'true'
with:
distribution: 'zulu'
java-version: 11

- name: Instrumentation Tests
uses: reactivecircus/android-emulator-runner@v2
if: steps.verify-android-changed-files.outputs.files_changed == 'true'
with:
api-level: ${{ matrix.api-level }}
target: ${{ matrix.target }}
Expand All @@ -181,10 +221,10 @@ jobs:
- name: Upload Reports
uses: actions/upload-artifact@v3
if: steps.verify-android-changed-files.outputs.files_changed == 'true'
with:
name: Test-Reports
path: ${{ github.workspace }}/example/android/app/build/reports
if: always()

ios-build-test:
runs-on: macos-latest
Expand All @@ -197,9 +237,21 @@ jobs:
- name: Checkout the code
uses: actions/checkout@v4

- name: Verify iOS Changed files
uses: tj-actions/[email protected]
id: verify-iOS-changed-files
with:
files: |
ios/**
src/**
assets/**
package.json
!example/android/**
- uses: actions/cache@v3
name: Cache node_modules
id: cache-node-modules
if: steps.verify-iOS-changed-files.outputs.files_changed == 'true'
with:
path: |
node_modules
Expand All @@ -210,37 +262,47 @@ jobs:
- name: Cache Pods
id: cache-pods
uses: actions/cache@v3
if: steps.verify-iOS-changed-files.outputs.files_changed == 'true'
with:
path: example/ios/Pods
key: ${{ runner.os }}-pods-${{ matrix.cocoapods }}-${{ hashFiles('**/Podfile.lock') }}

- name: Set up Ruby
uses: ruby/setup-ruby@v1
if: steps.verify-iOS-changed-files.outputs.files_changed == 'true'
with:
ruby-version: 2.7
bundler-cache: true

- name: Install Cocoapods
if: steps.verify-iOS-changed-files.outputs.files_changed == 'true'
run: gem install cocoapods -v ${{ matrix.cocoapods }}

- name: Setup node 16
if: steps.verify-iOS-changed-files.outputs.files_changed == 'true'
uses: actions/setup-node@v3
with:
node-version: '16'

- name: Install Pods
if: steps.cache-pods.outputs.cache-hit != 'true'
if: steps.cache-pods.outputs.cache-hit != 'true' && steps.verify-iOS-changed-files.outputs.files_changed == 'true'
run: |
cd example/ios
pod cache clean --all
pod install
- name: Install xcpretty
if: steps.verify-iOS-changed-files.outputs.files_changed == 'true'
run: gem install xcpretty

- name: Build
if: steps.verify-iOS-changed-files.outputs.files_changed == 'true'
run: |
cd example/ios
xcodebuild -workspace ImageMarkerExample.xcworkspace -scheme ImageMarkerExample -configuration Release -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 12' | xcpretty
- name: Test
if: steps.verify-iOS-changed-files.outputs.files_changed == 'true'
run: |
cd example/ios
xcodebuild -workspace ImageMarkerExample.xcworkspace -scheme ImageMarkerExample -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 12' test | xcpretty
Expand Down
75 changes: 0 additions & 75 deletions .github/workflows/jekyll-gh-pages-build.yml

This file was deleted.

21 changes: 17 additions & 4 deletions .github/workflows/jekyll-gh-pages-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
name: Deploy Jekyll with GitHub Pages

on:
# Runs on pushes targeting the default branch
push:
branches: ["master"]
pull_request:
types: [closed]
paths:
- "docs/**"
- "src/**"
- "assets/**"
- "README.MD"
- "README.0.9.2.MD"

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand All @@ -27,9 +29,20 @@ jobs:
# Build job
build:
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true
steps:
- name: Checkout
uses: actions/checkout@v3

- uses: actions/setup-node@v2
with:
node-version: 16
- name: Install dependencies
run: npm install

- name: Build docs
run: npm run docs

- name: Setup Pages
uses: actions/configure-pages@v3
- name: Build with Jekyll
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,5 @@ android/keystores/debug.keystore

# generated by bob
lib/

docs/**/*.html
Loading

0 comments on commit 69fc683

Please sign in to comment.