|
| 1 | +name: mocha-ios |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: |
| 6 | + - 'master' |
| 7 | + push: |
| 8 | + branches: |
| 9 | + - 'master' |
| 10 | + |
| 11 | +jobs: |
| 12 | + mocha-ios: |
| 13 | + runs-on: macos-12 |
| 14 | + timeout-minutes: 120 |
| 15 | + |
| 16 | + steps: |
| 17 | + - name: Checkout |
| 18 | + uses: actions/checkout@v3 |
| 19 | + with: |
| 20 | + fetch-depth: 1 |
| 21 | + |
| 22 | + - name: Setup Docker Colima 1 |
| 23 | + uses: douglascamata/setup-docker-macos-action@v1-alpha |
| 24 | + id: docker1 |
| 25 | + continue-on-error: true |
| 26 | + |
| 27 | + - name: Setup Docker Colima 2 |
| 28 | + if: steps.docker1.outcome != 'success' |
| 29 | + uses: douglascamata/setup-docker-macos-action@v1-alpha |
| 30 | + id: docker2 |
| 31 | + continue-on-error: true |
| 32 | + |
| 33 | + - name: Setup Docker Default |
| 34 | + if: steps.docker1.outcome != 'success' && steps.docker2.outcome != 'success' |
| 35 | + uses: docker-practice/actions-setup-docker@1.0.12 |
| 36 | + timeout-minutes: 30 |
| 37 | + |
| 38 | + - name: Run regtest setup |
| 39 | + working-directory: example/docker |
| 40 | + run: | |
| 41 | + mkdir lnd |
| 42 | + mkdir clightning |
| 43 | + chmod 777 lnd clightning |
| 44 | + docker-compose up -d |
| 45 | +
|
| 46 | + - name: Wait for electrum server |
| 47 | + timeout-minutes: 2 |
| 48 | + run: while ! nc -z '127.0.0.1' 60001; do sleep 1; done |
| 49 | + |
| 50 | + - name: Node |
| 51 | + uses: actions/setup-node@v3 |
| 52 | + with: |
| 53 | + node-version: 16 |
| 54 | + cache: 'yarn' # cache packages, but not node_modules |
| 55 | + cache-dependency-path: 'example/yarn.lock' |
| 56 | + |
| 57 | + - name: Cache lib node modules |
| 58 | + uses: actions/cache@v3 |
| 59 | + id: lib-npmcache |
| 60 | + with: |
| 61 | + path: lib/node_modules |
| 62 | + key: node-modules-${{ hashFiles('**/yarn.lock') }} |
| 63 | + |
| 64 | + - name: Install lib dependencies |
| 65 | + if: steps.lib-npmcache.outputs.cache-hit != 'true' |
| 66 | + working-directory: lib |
| 67 | + run: yarn --no-audit --prefer-offline || yarn --no-audit --prefer-offline |
| 68 | + |
| 69 | + - name: Build lib |
| 70 | + working-directory: lib |
| 71 | + run: yarn build |
| 72 | + |
| 73 | + - name: Cache app node modules |
| 74 | + uses: actions/cache@v3 |
| 75 | + id: cache-nm |
| 76 | + with: |
| 77 | + path: example/node_modules |
| 78 | + key: node-modules-${{ hashFiles('**/yarn.lock') }} |
| 79 | + |
| 80 | + - name: Rebuild detox |
| 81 | + if: steps.cache-nm.outputs.cache-hit == 'true' |
| 82 | + working-directory: example |
| 83 | + run: yarn detox clean-framework-cache && yarn detox build-framework-cache |
| 84 | + |
| 85 | + - name: Install Dependencies |
| 86 | + if: steps.cache-nm.outputs.cache-hit != 'true' |
| 87 | + working-directory: example |
| 88 | + run: yarn install --no-audit --prefer-offline && yarn rn-setup |
| 89 | + |
| 90 | + - name: Cache Pods |
| 91 | + uses: actions/cache@v3 |
| 92 | + id: podcache |
| 93 | + with: |
| 94 | + path: example/ios/Pods |
| 95 | + key: pods-${{ hashFiles('**/Podfile.lock') }} |
| 96 | + |
| 97 | + - name: Install pods |
| 98 | + working-directory: example |
| 99 | + run: | |
| 100 | + gem update cocoapods xcodeproj |
| 101 | + cd ios && pod install && cd .. |
| 102 | +
|
| 103 | + - name: Install applesimutils |
| 104 | + run: | |
| 105 | + brew tap wix/brew |
| 106 | + brew install applesimutils |
| 107 | +
|
| 108 | + - name: Build |
| 109 | + working-directory: example |
| 110 | + run: npx react-native run-ios --no-packager |
| 111 | + |
| 112 | + - name: Test iOS app |
| 113 | + working-directory: example |
| 114 | + run: yarn test:mocha:ios |
| 115 | + |
| 116 | + - name: Prepare articrafts |
| 117 | + if: failure() |
| 118 | + run: | |
| 119 | + mkdir articrafts |
| 120 | + find /Users/runner/Library/Developer/CoreSimulator/Devices/ -path '*Documents/ldk' -exec cp -r "{}" articrafts/ \; |
| 121 | +
|
| 122 | + - uses: actions/upload-artifact@v3 |
| 123 | + if: failure() |
| 124 | + with: |
| 125 | + name: ldk-data |
| 126 | + path: articrafts |
0 commit comments