From c342b3fda2b1fc355029c1e4576c0209a6a200e5 Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Sat, 9 Dec 2023 11:44:59 +0100 Subject: [PATCH] enh(ci): Refactor build workflow and build ios app Signed-off-by: Marcel Klehr --- .github/workflows/build.yml | 87 ++++++++++++++++++++++++++++++++----- 1 file changed, 76 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 992e6060b5..407b2bb5cc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,7 +8,7 @@ on: - master jobs: - build: + js: runs-on: ubuntu-latest strategy: @@ -16,7 +16,7 @@ jobs: node-version: [20.x] npm-version: [10.x] - name: node${{ matrix.node-versions }} + name: js node${{ matrix.node-version }} steps: - uses: actions/checkout@v2 @@ -28,11 +28,6 @@ jobs: - name: Set up npm ${{ matrix.npm-version }} run: npm i -g npm@"${{ matrix.npm-version }}" - - uses: actions/setup-java@v4 - with: - distribution: 'oracle' - java-version: '17' - - name: Cache node modules uses: actions/cache@v1 env: @@ -45,13 +40,83 @@ jobs: ${{ runner.os }}-build- ${{ runner.os }}- - - name: Install dependencies & build + - name: Install dependencies run: | - echo "Install" npm ci -f - echo "Build javascript" + + - name: Install dependencies & build + run: | npm run build-release --if-present - echo "Build Java" + + - name: Save context + uses: buildjet/cache/save@v3 + with: + key: build-context-${{ github.run_id }} + path: ./ + + android: + needs: js + runs-on: ubuntu-latest + strategy: + matrix: + java-version: [ 17 ] + name: android java${{ matrix.java-version }} + steps: + - uses: actions/setup-java@v4 + with: + distribution: 'oracle' + java-version: ${{ matrix.java-version }} + + - name: Restore context + uses: buildjet/cache/restore@v3 + with: + fail-on-cache-miss: true + key: build-context-${{ github.run_id }} + path: ./ + + - name: Build android + run: | + npx cap sync cd android chmod +x gradlew ./gradlew assemble + + ios: + needs: js + runs-on: macos-latest + name: ios + steps: + - name: Restore context + uses: buildjet/cache/restore@v3 + with: + fail-on-cache-miss: true + key: build-context-${{ github.run_id }} + path: ./ + + - name: setup-cocoapods + uses: maxim-lobanov/setup-cocoapods@v1 + with: + podfile-path: ios/App/Podfile.lock + + - uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: latest-stable + + - name: Build android + env: + scheme: "Floccus" + run: | + npx cap sync + xcodebuild build-for-testing -scheme "$scheme" -workspace App.xcworkspace + + summary: + runs-on: ubuntu-latest + needs: [ js, android, ios ] + + if: always() + + name: build-summary + + steps: + - name: Summary status + run: if ${{ needs.js.result != 'success' || ( needs.android.result != 'success' && needs.selenium.result != 'skipped' ) || ( needs.ios.result != 'success' && needs.ios.result != 'skipped' ) }}; then exit 1; fi