Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Current »

for the policies_android_app_java and claims_android_app_java the github actions use 2 workflows for the CD. We have the automatic build workflow in the file main.yml and the manual build workflow in the file manual.yml.

The automatic build workflow

name: CI

on:
  push:
    branches:
      - 'main-csu'
#    tags:
#      - '!v*'

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2

      - name: Setup JDK 17
        uses: actions/setup-java@v2
        with:
          distribution: 'temurin'
          java-version: '17'
          cache: 'gradle'

      - name: Environment info
        run: |
          gradle --version

      - name: show gradlew permission
        run: |
          chmod +x gradlew

      - name: build
        run: |
          ./gradlew assembleDebug --stacktrace

      - name: Environment info
        run: |
          gradle --version

      - uses: actions/upload-artifact@v4
        with:
          name: openimis-policies-apk-${{github.run_number}}-${{github.sha}}
          path: ./app/build/outputs/**/*.apk

      - name: build
        run: |
          ./gradlew bundleDebug --stacktrace

      - name: Environment info
        run: |
          gradle --version

      - uses: actions/upload-artifact@v4
        with:
          name: openimis-policies-aab-${{github.run_number}}-${{github.sha}}
          path: ./app/build/outputs/**/*.aab

We also have manual build and deployment. In this workflow, when the user set the branch, he can set the api_base_url of deployment, app name, application_id and more others fields. After that he has to click on run workflows button to start the CD and generate the android package file (apk)

name: manualbuild

on:
  workflow_dispatch:
    inputs:
      api_base_url:
        description: URL of the REST API
        required: true
        default: https://test-csuapps.minsante.cm/rest/
      app_name:
        description: Display name of the application
        required: false
        default: Policies Manual
      app_dir:
        description: Name of the folder in Documents, default IMIS-CLI
        required: false
      application_id:
        description: Fully qualified name of the app
        required: true
        default: org.openimis.imispolicies.cli
      cli_java_dir:
        description: java source folder for custom functions. Only works with application_id_suffix .cli
        required: false
      cli_res_dir:
        description: Resources folder for icons. Only works with application_id_suffix .cli
        required: false
      cli_assets_dir:
        description: Asserts folder for images, json files.... Only works with .cli
        required: false
# Branch is chosen by default in github manual actions

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2

      - name: Setup JDK 17
        uses: actions/setup-java@v2
        with:
          distribution: 'temurin'
          java-version: '17'
          cache: 'gradle'
          
      - uses: actions/cache@v4
        with:
          path: |
            ~/.gradle/caches
            ~/.gradle/wrapper
          key: ${{ runner.os }}-${{ github.event.inputs.application_id }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/buildSrc/**/*.kt') }}

      - uses: actions/cache@v4
        with:
          path: |
            ~/.android
          key: ${{ runner.os }}-${{ github.event.inputs.application_id }}

      - name: Environment info
        run: |
          gradle --version
          echo url ${{ github.event.inputs.api_base_url }}

      - name: show gradlew permission
        run: |
          chmod +x gradlew

      - name: build
        run: |
          ./gradlew assembleDebug --stacktrace
        env:
          API_BASE_URL: "${{ github.event.inputs.api_base_url }}"

      - name: Environment info
        run: |
          gradle --version

      - uses: actions/upload-artifact@v4
        with:
          name: openimis-policies-apk-${{github.run_number}}-${{github.sha}}
          path: ./app/build/outputs/**/*.apk

If the user want ton build a specific variant in build.gradle, he as to replace assembleDebug by assemble{variant_name}Debug in the build task. For example if i want to build demo variant, the command in build task will become

./gradlew assembledemoProdDebug --stacktrace

  • No labels