2022-10-25 19:59:56 +00:00
|
|
|
# This workflow uses actions that are not certified by GitHub.
|
|
|
|
# They are provided by a third-party and are governed by
|
|
|
|
# separate terms of service, privacy policy, and support
|
|
|
|
# documentation.
|
|
|
|
|
2023-05-04 13:44:00 +00:00
|
|
|
name: PR check
|
2022-10-25 19:59:56 +00:00
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2023-03-30 19:24:18 +00:00
|
|
|
branches: ["main"]
|
2022-10-25 19:59:56 +00:00
|
|
|
pull_request:
|
2023-03-30 19:24:18 +00:00
|
|
|
branches: ["main"]
|
2022-10-25 19:59:56 +00:00
|
|
|
|
|
|
|
jobs:
|
2024-04-12 06:07:20 +00:00
|
|
|
analyze-and-test:
|
2023-07-25 15:31:01 +00:00
|
|
|
name: Analyze & test
|
2024-04-12 08:43:19 +00:00
|
|
|
runs-on: macos-14
|
2023-10-20 14:12:43 +00:00
|
|
|
timeout-minutes: 10
|
2022-10-25 19:59:56 +00:00
|
|
|
steps:
|
2023-09-20 09:58:04 +00:00
|
|
|
- uses: 8BitJonny/gh-get-current-pr@2.2.0
|
|
|
|
id: PR
|
|
|
|
|
2023-09-02 10:45:57 +00:00
|
|
|
- uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
submodules: recursive
|
|
|
|
|
2023-09-02 08:32:08 +00:00
|
|
|
- name: Connect private iap package
|
|
|
|
uses: webfactory/ssh-agent@v0.8.0
|
2023-09-20 09:58:04 +00:00
|
|
|
id: fetch-iap
|
|
|
|
if: steps.PR.outputs.number == 'null' || github.event.pull_request.head.repo.full_name == github.repository
|
2023-09-02 08:32:08 +00:00
|
|
|
with:
|
|
|
|
ssh-private-key: ${{ secrets.M3_LIGHTMETER_IAP_KEY }}
|
|
|
|
|
|
|
|
- name: Override iap package with stub
|
2023-09-20 09:58:04 +00:00
|
|
|
id: override-iap
|
|
|
|
if: steps.fetch-iap.conclusion != 'success'
|
2023-09-02 10:45:57 +00:00
|
|
|
run: bash ./.github/scripts/stub_iap.sh
|
2023-03-30 19:24:18 +00:00
|
|
|
|
2025-01-23 17:12:57 +00:00
|
|
|
- name: Restore secrets
|
|
|
|
run: |
|
|
|
|
bash .github/scripts/restore_from_base64.sh "${{ secrets.CONSTANTS }}" "lib/constants.dart"
|
|
|
|
bash .github/scripts/restore_from_base64.sh "${{ secrets.FIREBASE_OPTIONS }}" "lib/firebase_options.dart"
|
2024-02-21 11:33:25 +00:00
|
|
|
|
2022-10-25 20:03:06 +00:00
|
|
|
- uses: subosito/flutter-action@v2
|
|
|
|
with:
|
|
|
|
channel: "stable"
|
2025-01-20 18:32:57 +00:00
|
|
|
flutter-version: "3.27.1"
|
2023-03-30 19:24:18 +00:00
|
|
|
|
2023-07-25 15:31:01 +00:00
|
|
|
- name: Prepare flutter project
|
2023-05-03 10:45:10 +00:00
|
|
|
run: |
|
2023-07-25 15:31:01 +00:00
|
|
|
flutter --version
|
|
|
|
flutter pub get
|
|
|
|
flutter pub run intl_utils:generate
|
2023-05-03 10:45:10 +00:00
|
|
|
|
2022-10-25 19:59:56 +00:00
|
|
|
- name: Analyze project source
|
2023-02-15 14:34:28 +00:00
|
|
|
run: flutter analyze lib --fatal-infos
|
2023-06-20 06:43:49 +00:00
|
|
|
|
|
|
|
- name: Run tests
|
2024-04-12 08:43:19 +00:00
|
|
|
run: |
|
|
|
|
defaults -currentHost write -g AppleFontSmoothing -int 0
|
|
|
|
flutter test --dart-define cameraStubImage=assets/camera_stub_image.jpg
|
2023-09-14 14:59:16 +00:00
|
|
|
|
|
|
|
- name: Analyze project source with stub
|
2023-09-20 09:58:04 +00:00
|
|
|
if: steps.override-iap.conclusion != 'success'
|
2023-09-14 14:59:16 +00:00
|
|
|
run: |
|
|
|
|
bash ./.github/scripts/stub_iap.sh
|
|
|
|
flutter pub get
|
2024-04-12 06:07:20 +00:00
|
|
|
flutter analyze lib --fatal-infos
|
2025-01-21 18:43:14 +00:00
|
|
|
|
|
|
|
platform-changes:
|
|
|
|
name: Checks for platform changes
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
|
|
|
android-changed: ${{ steps.platform-changes.outputs.android-changed }}
|
|
|
|
ios-changed: ${{ steps.platform-changes.outputs.ios-changed }}
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
submodules: recursive
|
|
|
|
|
|
|
|
- id: platform-changes
|
|
|
|
uses: dorny/paths-filter@v2
|
|
|
|
with:
|
|
|
|
filters: |
|
|
|
|
android-changed:
|
|
|
|
- 'android/**'
|
|
|
|
- 'pubspec.yaml'
|
|
|
|
ios-changed:
|
|
|
|
- 'ios/**'
|
|
|
|
- 'pubspec.yaml'
|
|
|
|
|
|
|
|
build-android:
|
|
|
|
name: Build Android
|
|
|
|
needs: platform-changes
|
|
|
|
if: needs.platform-changes.outputs.android-changed == 'true'
|
|
|
|
uses: ./.github/workflows/build_apk.yml
|
|
|
|
secrets: inherit
|
|
|
|
with:
|
|
|
|
binary-type: apk
|
|
|
|
flavor: prod
|
|
|
|
stage-backend: false
|
|
|
|
version: "1.0.0"
|
|
|
|
|
|
|
|
build-ios:
|
|
|
|
name: Build iOS
|
|
|
|
needs: platform-changes
|
|
|
|
if: needs.platform-changes.outputs.ios-changed == 'true'
|
|
|
|
uses: ./.github/workflows/build_ipa.yml
|
|
|
|
secrets: inherit
|
|
|
|
with:
|
|
|
|
stage-backend: false
|
|
|
|
version: "1.0.0"
|
|
|
|
|
|
|
|
cleanup:
|
|
|
|
name: Cleanup
|
|
|
|
if: ${{ always() }}
|
|
|
|
needs: [build-android, build-ios]
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Delete release artifacts
|
|
|
|
uses: geekyeggo/delete-artifact@v2
|
|
|
|
with:
|
|
|
|
failOnError: false
|
|
|
|
name: |
|
|
|
|
m3_lightmeter_apk
|
|
|
|
m3_lightmeter_appbundle
|
|
|
|
m3_lightmeter_ipa
|