From 6efac620c4855a1ac829bee59f04635d00f7c50d Mon Sep 17 00:00:00 2001 From: Alex Baker Date: Sat, 13 May 2023 11:43:58 -0500 Subject: [PATCH] New check and bundle actions --- .github/workflows/bundle.yml | 44 ++++++++++++++++++++++++++++ .github/workflows/check.yml | 56 ++++++++++++++++++++++++++++++++++++ .github/workflows/lint.yml | 46 ----------------------------- .github/workflows/tests.yml | 43 --------------------------- fastlane/Fastfile | 15 ++++++++++ 5 files changed, 115 insertions(+), 89 deletions(-) create mode 100644 .github/workflows/bundle.yml create mode 100644 .github/workflows/check.yml delete mode 100644 .github/workflows/lint.yml delete mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/bundle.yml b/.github/workflows/bundle.yml new file mode 100644 index 000000000..8e8f942dc --- /dev/null +++ b/.github/workflows/bundle.yml @@ -0,0 +1,44 @@ +name: Assemble bundle + +on: + push: + +permissions: + contents: read + +jobs: +# check: +# uses: ./.github/workflows/check.yml + bundle: + runs-on: ubuntu-latest +# needs: [ check ] + steps: + - name: Decode Keystore + run: | + echo ${{ secrets.KEY_STORE }} | base64 -di > "${RUNNER_TEMP}"/keystore.jks + - uses: actions/checkout@v3 + - uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '17' + cache: 'gradle' + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Bundle + env: + KEY_PATH: ${{ runner.temp }}/keystore.jks + KEY_ALIAS: ${{ secrets.KEY_ALIAS }} + KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} + KEY_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }} + MAPBOX_KEY: ${{ secrets.MAPBOX_KEY }} + GOOGLE_KEY: ${{ secrets.GOOGLE_KEY }} + run: bundle exec fastlane bundle + - name: Upload artifacts + uses: actions/upload-artifact@v3 + with: + name: release + path: app/build/outputs/** diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml new file mode 100644 index 000000000..fe8f52deb --- /dev/null +++ b/.github/workflows/check.yml @@ -0,0 +1,56 @@ +name: Run automated checks + +on: + pull_request: + workflow_call: + +permissions: + contents: read + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '17' + cache: 'gradle' + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Lint checks + run: bundle exec fastlane lint + - name: Archive lint reports + uses: actions/upload-artifact@v3 + if: ${{ always() }} + with: + name: lint-reports + path: app/build/reports/*.html + + test: + runs-on: macos-latest + steps: + - name: checkout + uses: actions/checkout@v3 + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '17' + cache: 'gradle' + - name: run tests + uses: reactivecircus/android-emulator-runner@v2 + with: + api-level: 29 + script: ./gradlew -Pcoverage app:testGoogleplayDebugUnitTest app:connectedGoogleplayDebugAndroidTest + - name: Upload test reports + uses: actions/upload-artifact@v3 + if: ${{ always() }} + with: + name: test-reports + path: app/build/reports/** diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index e4b1c9623..000000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Lint - -on: - push: - paths-ignore: - - CODE_OF_CONDUCT.md - - CONTRIBUTING.md - - README.md - - 'fastlane/**' - - .github/FUNDING.yml - pull_request: - paths-ignore: - - CODE_OF_CONDUCT.md - - CONTRIBUTING.md - - README.md - - 'fastlane/**' - - .github/FUNDING.yml - -permissions: - contents: read - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - uses: ruby/setup-ruby@v1 - with: - bundler-cache: true - - name: Set up JDK 17 - uses: actions/setup-java@v3 - with: - distribution: 'temurin' - java-version: '17' - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - name: Lint checks - run: bundle exec fastlane lint - - name: Archive lint reports - uses: actions/upload-artifact@v3 - if: ${{ always() }} - with: - name: lint-reports - path: app/build/reports/*.html diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml deleted file mode 100644 index 398afb608..000000000 --- a/.github/workflows/tests.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: Run tests - -on: - push: - paths-ignore: - - CODE_OF_CONDUCT.md - - CONTRIBUTING.md - - README.md - - 'fastlane/**' - - .github/FUNDING.yml - pull_request: - paths-ignore: - - CODE_OF_CONDUCT.md - - CONTRIBUTING.md - - README.md - - 'fastlane/**' - - .github/FUNDING.yml - -permissions: - contents: read - -jobs: - test: - runs-on: macos-latest - steps: - - name: checkout - uses: actions/checkout@v3 - - name: Set up JDK 17 - uses: actions/setup-java@v3 - with: - distribution: 'temurin' - java-version: '17' - - name: run tests - uses: reactivecircus/android-emulator-runner@v2 - with: - api-level: 29 - script: ./gradlew -Pcoverage app:testGoogleplayDebugUnitTest app:connectedGoogleplayDebugAndroidTest - - name: Upload test reports - uses: actions/upload-artifact@v3 - if: ${{ always() }} - with: - name: test-reports - path: app/build/reports/** diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 95c8ecd7d..0d684088b 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -40,4 +40,19 @@ platform :android do lane :lint do gradle(task: ":app:lintGoogleplayRelease :app:lintGenericRelease --no-configuration-cache") end + + desc "Bundle" + lane :bundle do + gradle( + task: "bundleGoogleplayRelease", + properties: { + "tasksKeyAlias": ENV["KEY_ALIAS"], + "tasksStoreFile": ENV["KEY_PATH"], + "tasksStorePassword": ENV["KEY_STORE_PASSWORD"], + "tasksKeyPassword": ENV["KEY_PASSWORD"], + "tasks_mapbox_key": ENV["MAPBOX_KEY"], + "tasks_google_key": ENV["GOOGLE_KEY"] + } + ) + end end