|
| 1 | +name: Storefront App CI |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: [ main ] # Trigger for PRs to main branch |
| 6 | + |
| 7 | +env: |
| 8 | + FLEETBASE_KEY: ${{ secrets.FLEETBASE_KEY }} |
| 9 | + GOOGLE_MAPS_KEY: ${{ secrets.GOOGLE_MAPS_KEY }} |
| 10 | + ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }} |
| 11 | + |
| 12 | +jobs: |
| 13 | + install_and_test: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + steps: |
| 16 | + - name: Checkout code |
| 17 | + uses: actions/checkout@v3 |
| 18 | + |
| 19 | + - name: Install Node.js |
| 20 | + uses: actions/setup-node@v1 |
| 21 | + with: |
| 22 | + node-version: 18.x |
| 23 | + |
| 24 | + - name: Install dependencies |
| 25 | + run: npm install -g yarn |
| 26 | + |
| 27 | + - name: Install dependencies |
| 28 | + run: yarn install |
| 29 | + |
| 30 | + android_build: |
| 31 | + runs-on: ubuntu-latest |
| 32 | + steps: |
| 33 | + - name: Checkout code |
| 34 | + uses: actions/checkout@v3 |
| 35 | + |
| 36 | + - name: Generate google-services.json |
| 37 | + env: |
| 38 | + GOOGLE_SERVICES_JSON: ${{ secrets.STOREFRONT_GOOGLE_SERVICES_JSON }} |
| 39 | + run: | |
| 40 | + echo "$GOOGLE_SERVICES_JSON" > google-services.json |
| 41 | + mkdir -p android/app/src |
| 42 | + mv google-services.json android/app/src |
| 43 | + |
| 44 | + - name: Install Node.js |
| 45 | + uses: actions/setup-node@v1 |
| 46 | + with: |
| 47 | + node-version: 18.x |
| 48 | + |
| 49 | + - name: Install dependencies |
| 50 | + run: npm install -g yarn |
| 51 | + |
| 52 | + - name: Install dependencies |
| 53 | + run: yarn install |
| 54 | + |
| 55 | + - name: Set up JDK 17 |
| 56 | + uses: actions/setup-java@v4 |
| 57 | + with: |
| 58 | + distribution: 'oracle' |
| 59 | + java-version: '17' |
| 60 | + |
| 61 | + - name: Cache Gradle Wrapper |
| 62 | + uses: actions/cache@v2 |
| 63 | + with: |
| 64 | + path: ~/.gradle/wrapper |
| 65 | + key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} |
| 66 | + |
| 67 | + - name: Cache Gradle Dependencies |
| 68 | + uses: actions/cache@v2 |
| 69 | + with: |
| 70 | + path: ~/.gradle/caches |
| 71 | + key: ${{ runner.os }}-gradle-caches-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} |
| 72 | + restore-keys: | |
| 73 | + ${{ runner.os }}-gradle-caches- |
| 74 | + - name: Make Gradlew Executable |
| 75 | + run: cd android && chmod +x ./gradlew |
| 76 | + |
| 77 | + - name: Build Android |
| 78 | + run: cd android && ./gradlew assembleDebug |
| 79 | + env: |
| 80 | + JVM_OPTS: '-Xmx4096m' |
| 81 | + |
| 82 | + ios_build: |
| 83 | + runs-on: macOS-latest |
| 84 | + steps: |
| 85 | + - name: Checkout code |
| 86 | + uses: actions/checkout@v3 |
| 87 | + |
| 88 | + - name: Install Node.js |
| 89 | + uses: actions/setup-node@v4 |
| 90 | + with: |
| 91 | + node-version: 18.x |
| 92 | + |
| 93 | + - name: Install dependencies |
| 94 | + run: npm install -g yarn |
| 95 | + |
| 96 | + - name: Install dependencies |
| 97 | + run: yarn install |
| 98 | + |
| 99 | + - name: Install CocoaPods |
| 100 | + run: sudo gem install cocoapods |
| 101 | + |
| 102 | + - name: Install iOS pods |
| 103 | + run: cd ios && pod install |
| 104 | + |
| 105 | + - name: Build iOS |
| 106 | + run: npx react-native run-ios --configuration Release |
0 commit comments