From e96d7b01b2deb744b3108441679dc06279b7a702 Mon Sep 17 00:00:00 2001 From: Iliyan Germanov Date: Thu, 4 Nov 2021 21:31:21 +0200 Subject: [PATCH] Add build_lint workflow and refactor internal_release.yml --- .github/workflows/build_lint.yml | 66 +++++++++++++++++++++ .github/workflows/internal_release.yml | 4 +- fastlane/Fastfile | 81 +++++++++++++++----------- 3 files changed, 114 insertions(+), 37 deletions(-) create mode 100644 .github/workflows/build_lint.yml diff --git a/.github/workflows/build_lint.yml b/.github/workflows/build_lint.yml new file mode 100644 index 0000000000..931368cb49 --- /dev/null +++ b/.github/workflows/build_lint.yml @@ -0,0 +1,66 @@ +name: Build Lint + +# Controls when the workflow will run +on: + # Triggers the workflow on push or pull request events + push: + + #Triggers when a pull request event occurs (opened, synchronize, reopened) + pull_request: + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + build_lint: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - name: Checkout GIT + uses: actions/checkout@v2 + with: + fetch-depth: 0 #Fetch all history for all branches and tags + + - name: Setup Java SDK + uses: actions/setup-java@v2 + with: + distribution: 'adopt' + java-version: '11' + + - name: Setup Ruby (for Fastlane) + uses: actions/setup-ruby@v1 + with: + ruby-version: '2.7' + + - name: Install Fastlane + run: bundle install + #---------------------------------------------------- + + #Security + - name: Validate Gradle Wrapper checksum + uses: gradle/wrapper-validation-action@v1 + + - name: Make Gradle Wrapper (gradlew) executable + run: chmod +x gradlew + #---------------------------------------------------- + + #Optimization + - name: Enable Gradle Wrapper caching (optmization) + uses: actions/cache@v2 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + #--------------------------------------------------- + + #Fastlane: Verifies that the project builds and that Lint checks are passing + - name: Fastlane build_lint (Build DEBUG + Lint DEBUG) + run: bundle exec fastlane build_lint + #-------------------------------------------------------------------------- diff --git a/.github/workflows/internal_release.yml b/.github/workflows/internal_release.yml index a12f0702d1..f13483481c 100644 --- a/.github/workflows/internal_release.yml +++ b/.github/workflows/internal_release.yml @@ -1,10 +1,8 @@ -# This is a basic workflow to help you get started with Actions - name: Internal Release # Controls when the workflow will run on: - # Triggers the workflow on push or pull request events but only for the master branch + # Triggers the workflow on push of version tag push: tags: - 'v*' diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 5d85fbb227..5032117ec4 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -16,38 +16,51 @@ default_platform(:android) platform :android do - desc "Builds release app bundle (AAB) for the Google Play Store." - lane :production_build do - #gradle( - # task: "testDebugUnitTest" - #) - - gradle( - task: "clean" - ) - - gradle( - task: "lint", - build_type: "Release" - ) - - gradle( - task: "bundle", - build_type: "Release" - ) - end - - desc "Releases a generated AAB to Google PlayStore's Internal Testing" - lane :internal_release do - supply( - track: "internal", - aab: "app/build/outputs/bundle/release/app-release.aab", - release_status: "draft", - skip_upload_apk: true, - skip_upload_metadata: true, - skip_upload_changelogs: false, - skip_upload_images: true, - skip_upload_screenshots: true - ) - end + desc "Tries to build the project and then runs Lint checks for Debug" + lane :build_lint do + gradle( + task: "build", + build_type: "Debug" + ) + + gradle( + task: "lint", + build_type: "Debug" + ) + end + + desc "Builds release app bundle (AAB) for the Google Play Store." + lane :production_build do + #gradle( + # task: "testDebugUnitTest" + #) + + gradle( + task: "clean" + ) + + gradle( + task: "lint", + build_type: "Release" + ) + + gradle( + task: "bundle", + build_type: "Release" + ) + end + + desc "Releases a generated AAB to Google PlayStore's Internal Testing" + lane :internal_release do + supply( + track: "internal", + aab: "app/build/outputs/bundle/release/app-release.aab", + release_status: "draft", + skip_upload_apk: true, + skip_upload_metadata: true, + skip_upload_changelogs: false, + skip_upload_images: true, + skip_upload_screenshots: true + ) + end end