Added workflow checks

This commit is contained in:
Vadim 2023-08-15 20:23:13 +02:00
parent da95cb27cc
commit cabc50d2aa
4 changed files with 45 additions and 13 deletions

View file

@ -16,17 +16,27 @@ on:
- dev - dev
- prod - prod
default: 'dev' default: 'dev'
include-iap:
type: boolean
description: Include IAP package
default: false # TODO(@vodemn) when Google fixes their api
jobs: jobs:
build: build:
name: Build .apk name: Build .apk
runs-on: macos-11 runs-on: macos-11
timeout-minutes: 15 timeout-minutes: 15
steps: steps:
- uses: webfactory/ssh-agent@v0.8.0 - name: Connect private iap package
uses: webfactory/ssh-agent@v0.8.0
if: ${{ inputs.include-iap }}
with: with:
ssh-private-key: ${{ secrets.M3_LIGHTMETER_IAP_KEY }} ssh-private-key: ${{ secrets.M3_LIGHTMETER_IAP_KEY }}
- name: Override iap package with stub
if: ${{ !inputs.include-iap }}
run: |
echo "\ndependecies_override:\n m3_lightmeter_iap:\n path: iap" >> pubspec.yaml
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:

View file

@ -31,6 +31,10 @@ on:
type: boolean type: boolean
description: Create Google Play release description: Create Google Play release
default: true default: true
include-iap:
type: boolean
description: Include IAP package
default: false # TODO(@vodemn) when Google fixes their api
env: env:
BUILD_ARGS: --release --flavor prod --dart-define cameraPreviewAspectRatio=240/320 -t lib/main_prod.dart BUILD_ARGS: --release --flavor prod --dart-define cameraPreviewAspectRatio=240/320 -t lib/main_prod.dart
@ -38,14 +42,21 @@ env:
jobs: jobs:
build: build:
name: Build .apk & .aab name: Build .apk & .aab
if: ${{ inputs.github-release }} || ${{ inputs.google-play-release }} if: ${{ inputs.github-release || inputs.google-play-release }}
runs-on: macos-11 runs-on: macos-11
timeout-minutes: 30 timeout-minutes: 30
steps: steps:
- uses: webfactory/ssh-agent@v0.8.0 - name: Connect private iap package
uses: webfactory/ssh-agent@v0.8.0
if: ${{ inputs.include-iap }}
with: with:
ssh-private-key: ${{ secrets.M3_LIGHTMETER_IAP_KEY }} ssh-private-key: ${{ secrets.M3_LIGHTMETER_IAP_KEY }}
- name: Override iap package with stub
if: ${{ !inputs.include-iap }}
run: |
echo "\ndependecies_override:\n m3_lightmeter_iap:\n path: iap" >> pubspec.yaml
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:
submodules: recursive submodules: recursive

View file

@ -11,20 +11,27 @@ on:
pull_request: pull_request:
branches: ["main"] branches: ["main"]
env:
# Stub iap package if this worlflow is running from the PR from a fork
STUB_IAP: ${{ github.event.pull_request.head.repo.full_name != github.repository }}
jobs: jobs:
analyze_and_test: analyze_and_test:
name: Analyze & test name: Analyze & test
runs-on: macos-11 runs-on: macos-11
timeout-minutes: 10 timeout-minutes: 10
steps: steps:
- uses: shaunco/ssh-agent@git-repo-mapping - name: Connect private iap package
uses: webfactory/ssh-agent@v0.8.0
if: !env.STUB_IAP
with: with:
ssh-private-key: | ssh-private-key: ${{ secrets.M3_LIGHTMETER_IAP_KEY }}
${{ secrets.M3_LIGHTMETER_IAP_KEY }}
repo-mappings: | - name: Override iap package with stub
github.com/vodemn/m3_lightmeter_iap if: env.STUB_IAP
run: |
echo "\ndependecies_override:\n m3_lightmeter_iap:\n path: iap" >> pubspec.yaml
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:
submodules: recursive submodules: recursive
@ -32,7 +39,7 @@ jobs:
- uses: subosito/flutter-action@v2 - uses: subosito/flutter-action@v2
with: with:
channel: "stable" channel: "stable"
flutter-version: '3.10.0' flutter-version: "3.10.0"
- name: Prepare flutter project - name: Prepare flutter project
run: | run: |
@ -44,4 +51,4 @@ jobs:
run: flutter analyze lib --fatal-infos run: flutter analyze lib --fatal-infos
- name: Run tests - name: Run tests
run: flutter test run: flutter test

View file

@ -57,3 +57,7 @@ flutter:
flutter_intl: flutter_intl:
enabled: true enabled: true
dependecies_override:
m3_lightmeter_iap:
path: iap