for 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. this workflow start automatically
The automatic build workflow has configured to start in every push on the repository branch. It takes place at 3 stages:
setup the JDK version
build apk file for debug package
build aab file for release package
Code Block |
---|
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 The manual workflow is configured to take many field like api_base_url of deployment, app application_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)
Code Block |
---|
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 at the enter before run workflow. First we have to choose the branch and define the field to start the deployment.
View file | ||
---|---|---|
|
For this 2 workflows, if the user want ton build a specific variant in build.gradle, he as to must replace assembleDebug by assemble{variant_name}Debug in the build task. For example if i we want to build demo variant, the command in build task will become
...