Skip to content

MacOS - Test and Build #20

MacOS - Test and Build

MacOS - Test and Build #20

# This is a basic workflow to help you get started with Actions
name: MacOS - Test and Build
# Controls when the workflow will run
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# allows that other workflows can run this one
workflow_call:
#secrets:
#env:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: macos-13
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
# get versions from pubspec
- name: set env variables
run: |
python3 ./.github/workflows/building.py set_env_flutter_version
python3 ./.github/workflows/building.py set_env_dakanji_version
- name: Install and set Flutter version
uses: subosito/flutter-action@v2
with:
flutter-version: ${{env.FLUTTER_VERSION}}
channel: stable
- name: setup-cocoapods
uses: maxim-lobanov/setup-cocoapods@v1
with:
version: 1.14.3
- name: Restore packages
run: flutter pub get
# get / set dakanji assets from cache
- name: Check dakanji assets in cache
id: cache-dakanji-assets-restore
uses: actions/cache/restore@v3
with:
path: tmp
key: dakanji-assets
- name: Download DaKanji assets if necessary
if: steps.cache-dakanji-assets-restore.outputs.cache-hit != 'true'
run: |
python3 setup.py --download-all --no-delete
- name: Move DaKanji assets if in cache
if: steps.cache-dakanji-assets-restore.outputs.cache-hit == 'true'
run: |
python3 setup.py --no-download
- name: Save dakanji assets to cache if not saved
if: steps.cache-dakanji-assets-restore.outputs.cache-hit != 'true'
id: cache-dakanji-assets-save
uses: actions/cache/save@v3
with:
path: tmp
key: dakanji-assets
- name: enable macos
run: flutter config --enable-macos-desktop
- name: Run integration tests
run: |
pod --version
flutter drive --driver=test_driver/integration_test.dart --target=integration_test/draw_screen_test.dart --profile -d mac
- name: build macos executable
run: |
flutter build macos --release
ditto -c -k --sequesterRsrc --keepParent build/macos/Build/Products/Release/DaKanji.app/ DaKanji_${{env.DAKANJI_VERSION}}_app.zip
- name: Archive production artifacts
uses: actions/upload-artifact@v3
with:
name: DaKanji_${{env.DAKANJI_VERSION}}_app.zip
path: DaKanji_${{env.DAKANJI_VERSION}}_app.zip