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
|
|
|
|
2024-02-21 11:33:25 +00:00
|
|
|
- name: Restore constants.dart
|
|
|
|
run: bash .github/scripts/restore_from_base64.sh "${{ secrets.CONSTANTS }}" "lib/constants.dart"
|
|
|
|
|
2022-10-25 20:03:06 +00:00
|
|
|
- uses: subosito/flutter-action@v2
|
|
|
|
with:
|
|
|
|
channel: "stable"
|
2024-04-06 17:14:37 +00:00
|
|
|
flutter-version: "3.13.9"
|
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
|