diff --git a/.github/workflows/ci_beta.yml b/.github/workflows/ci_beta.yml index 1cf58ca8f..278e077c1 100644 --- a/.github/workflows/ci_beta.yml +++ b/.github/workflows/ci_beta.yml @@ -1,39 +1,90 @@ -name: CI beta +name: CI Beta on: push: branches: - openScale-3.0 + pull_request: + branches: + - openScale-3.0 workflow_dispatch: -# A workflow run is made up of one or more jobs that can run sequentially or in parallel +permissions: + contents: write + jobs: - # This workflow contains a single job called "build" build: - # The type of runner that the job will run on + name: Build Beta APK runs-on: ubuntu-latest - + defaults: run: working-directory: android_app - # 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 - uses: actions/checkout@v3 - - name: Setup JDK - uses: actions/setup-java@v3 + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup JDK 21 + uses: actions/setup-java@v4 with: - distribution: "zulu" # See 'Supported distributions' for available options - java-version: "21" - - name: Build APK - run: ./gradlew assembleBeta - - uses: "marvinpinto/action-automatic-releases@latest" + distribution: 'zulu' + java-version: '21' + cache: 'gradle' + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Build beta APK + run: ./gradlew assembleBeta --stacktrace + + - name: Upload beta APK artifact + uses: actions/upload-artifact@v4 with: - repo_token: "${{ secrets.GITHUB_TOKEN }}" - automatic_release_tag: "beta-build" + name: openScale-beta-apk + path: android_app/app/build/outputs/apk/beta/openScale-beta.apk + retention-days: 30 + + - name: Create automatic release + if: github.event_name == 'push' && github.ref == 'refs/heads/openScale-3.0' + uses: marvinpinto/action-automatic-releases@latest + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + automatic_release_tag: beta-build prerelease: true - title: "openScale 3.0 beta build" + title: openScale 3.0 beta build files: | android_app/app/build/outputs/apk/beta/openScale-beta.apk + + lint: + name: Run Lint Checks + runs-on: ubuntu-latest + + defaults: + run: + working-directory: android_app + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup JDK 21 + uses: actions/setup-java@v4 + with: + distribution: 'zulu' + java-version: '21' + cache: 'gradle' + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Run lint + run: ./gradlew lintBeta --stacktrace + + - name: Upload lint results + if: always() + uses: actions/upload-artifact@v4 + with: + name: lint-results-beta + path: android_app/app/build/reports/lint-results-beta.html + retention-days: 30 diff --git a/.github/workflows/ci_master.yml b/.github/workflows/ci_master.yml index 5e7777b02..217835d4c 100644 --- a/.github/workflows/ci_master.yml +++ b/.github/workflows/ci_master.yml @@ -1,46 +1,90 @@ -# This is a basic workflow to help you get started with Actions - name: CI -# Controls when the workflow will run on: - # Triggers the workflow on push or pull request events but only for the master branch push: branches: - 'master' - - # Allows you to run this workflow manually from the Actions tab + - master + pull_request: + branches: + - master workflow_dispatch: -# A workflow run is made up of one or more jobs that can run sequentially or in parallel +permissions: + contents: write + jobs: - # This workflow contains a single job called "build" build: - # The type of runner that the job will run on + name: Build Debug APK runs-on: ubuntu-latest - + defaults: run: working-directory: android_app - # 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 - uses: actions/checkout@v3 - - name: Setup JDK - uses: actions/setup-java@v3 + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup JDK 21 + uses: actions/setup-java@v4 + with: + distribution: 'zulu' + java-version: '21' + cache: 'gradle' + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Build debug APK + run: ./gradlew assembleDebug --stacktrace + + - name: Upload debug APK artifact + uses: actions/upload-artifact@v4 with: - distribution: "zulu" # See 'Supported distributions' for available options - java-version: "21" - - name: Build APK - run: ./gradlew assembleDebug - - uses: "marvinpinto/action-automatic-releases@latest" + name: openScale-debug-apk + path: android_app/app/build/outputs/apk/debug/openScale-debug.apk + retention-days: 30 + + - name: Create automatic release + if: github.event_name == 'push' && github.ref == 'refs/heads/master' + uses: marvinpinto/action-automatic-releases@latest with: - repo_token: "${{ secrets.GITHUB_TOKEN }}" - automatic_release_tag: "dev-build" + repo_token: ${{ secrets.GITHUB_TOKEN }} + automatic_release_tag: dev-build prerelease: true - title: "openScale development build" + title: openScale development build files: | android_app/app/build/outputs/apk/debug/openScale-debug.apk + lint: + name: Run Lint Checks + runs-on: ubuntu-latest + + defaults: + run: + working-directory: android_app + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup JDK 21 + uses: actions/setup-java@v4 + with: + distribution: 'zulu' + java-version: '21' + cache: 'gradle' + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Run lint + run: ./gradlew lintDebug --stacktrace + + - name: Upload lint results + if: always() + uses: actions/upload-artifact@v4 + with: + name: lint-results + path: android_app/app/build/reports/lint-results-debug.html + retention-days: 30