Skip to content

fix: UI & features #326

fix: UI & features

fix: UI & features #326

name: Mobile CI Doctor App Edgar
on:
workflow_dispatch:
pull_request:
# Only following types are handled by the action, but one can default to all as well
types: [opened, reopened, synchronize]
paths:
- "medecin_mobile/**"
defaults:
run:
working-directory: ./medecin_mobile
jobs:
analyze:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java Environment
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: corretto
- name: Make envfile
uses: SpicyPizza/create-envfile@v2.0.3
with:
envkey_URL: ${{ secrets.URL }}/demo/
envkey_WEBSOCKET_URL: ${{ secrets.WEBSOCKET_URL }}/demo/
envkey_APP_NAME: edgar
directory: medecin_mobile
file_name: .env
fail_on_empty: true
- name: Setup Flutter Environment
uses: subosito/flutter-action@v2
with:
channel: 'stable'
- name: Get Packages
run: flutter pub get
- name: Analyze
run: flutter analyze
tests:
runs-on: ubuntu-latest
needs: analyze
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java Environment
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: corretto
- name: Make envfile
uses: SpicyPizza/create-envfile@v2.0.3
with:
envkey_URL: ${{ secrets.URL }}/demo/
envkey_WEBSOCKET_URL: ${{ secrets.WEBSOCKET_URL }}/demo/
envkey_APP_NAME: edgar
directory: medecin_mobile
file_name: .env
fail_on_empty: true
- name: Setup Flutter Environment
uses: subosito/flutter-action@v2
with:
channel: 'stable'
- name: Get Packages
run: flutter pub get
- name: Run Tests
run: flutter test
build-apk:
runs-on: ubuntu-latest
needs: analyze
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java Environment
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: corretto
- name: Make envfile
uses: SpicyPizza/create-envfile@v2.0.3
with:
envkey_URL: ${{ secrets.URL }}/demo/
envkey_WEBSOCKET_URL: ${{ secrets.WEBSOCKET_URL }}/demo/
envkey_APP_NAME: edgar
directory: medecin_mobile
file_name: .env
fail_on_empty: true
- name: Setup Flutter Environment
uses: subosito/flutter-action@v2
with:
channel: 'stable'
- name: Get Packages
run: flutter pub get
- name: Build Apk
run: flutter build apk --release
- name: Upload Apk to artifacts
uses: actions/upload-artifact@v4
with:
name: apk-doctor-${{ github.head_ref }}.apk
path: medecin_mobile/build/app/outputs/apk/release/app-release.apk
build-dev:
runs-on: ubuntu-latest
needs: analyze
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java Environment
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: corretto
- name: Make envfile
uses: SpicyPizza/create-envfile@v2.0.3
with:
envkey_URL: ${{ secrets.URL }}/demo/
envkey_WEBSOCKET_URL: ${{ secrets.WEBSOCKET_URL }}/demo/
envkey_APP_NAME: edgar
directory: medecin_mobile
file_name: .env
fail_on_empty: true
- name: Setup Flutter Environment
uses: subosito/flutter-action@v2
with:
channel: 'stable'
- name: Get Packages
run: flutter pub get
- name: Build Apk
run: flutter build apk --debug
- name: Upload Apk to artifacts
uses: actions/upload-artifact@v4
with:
name: apk-dev-doctor-${{ github.head_ref }}.apk
path: medecin_mobile/build/app/outputs/apk/debug/app-debug.apk
deploy-apk:
runs-on: ubuntu-latest
needs: build-apk
permissions:
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download Apk
uses: actions/download-artifact@v4
with:
name: apk-doctor-${{ github.head_ref }}.apk
path: medecin_mobile
- name: Extract Apk Name depending on branch
run: echo apk_name=preview.pro.edgar-${{ github.head_ref }}.apk >> $GITHUB_OUTPUT
id: extract_apk_name
- name: Rename Apk Name
run: mv ./app-release.apk ./${{ steps.extract_apk_name.outputs.apk_name }}
- name: Setup AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ secrets.AWS_REGION }}
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Export Apk to S3
run: aws s3 cp *.apk s3://${{ secrets.BUCKET_NAME }} --acl public-read
- name: Add PR Comment
uses: mshick/add-pr-comment@v2.8.2
with:
message-id: edgar-pro-apk-message
refresh-message-position: true
message: |
**APK** is ready to download [preview.pro.edgar-${{ github.head_ref }}](https://edgar-care-apk.s3.eu-west-3.amazonaws.com/${{ steps.extract_apk_name.outputs.apk_name }})