Linux - Test and Build #94
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a basic workflow to help you get started with Actions | |
name: Linux - 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_test: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-22.04 | |
# 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: 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: Setup DaKanji env.dart | |
env: | |
SENTRY_DSN: ${{ secrets.SENTRY_DSN }} | |
POSTHOG_API_KEY_REL: ${{ secrets.POSTHOG_API_KEY_DEV }} | |
POSTHOG_API_KEY_DEV: ${{ secrets.POSTHOG_API_KEY_DEV }} | |
run: | | |
python3 ./.github/workflows/create_dakanji_env.py | |
flutter pub run build_runner build --delete-conflicting-outputs | |
- name: install build packages | |
run: | | |
sudo apt-get update | |
sudo apt-get install clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev libmpv-dev mpv | |
- name: Run integration tests | |
run: python3 ./integration_test/run_tests.py | |
# build portable linux | |
- name: build linux executable | |
run: | | |
flutter build linux --release -v | |
zip -r DaKanji_${{env.DAKANJI_VERSION}}_ubuntu_22_04.zip build/linux/x64/release/bundle | |
- name: Archive production artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: DaKanji_${{env.DAKANJI_VERSION}}_ubuntu_22_04.zip | |
path: DaKanji_${{env.DAKANJI_VERSION}}_ubuntu_22_04.zip | |
# build flatpak and upload artifact | |
- name: Build and upload flatpak | |
working-directory: flatpak/ | |
run: | | |
sudo apt-get install flatpak flatpak-builder | |
flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo | |
flatpak install -y flathub org.gnome.Sdk//45 org.gnome.Platform//45 | |
flatpak-builder build-dir com.DaAppLab.DaKanji.yml | |
flatpak-builder --repo=repo --force-clean build-dir com.DaAppLab.DaKanji.yml | |
flatpak build-bundle repo com.DaAppLab.DaKanji.flatpak com.DaAppLab.DaKanji | |
mv com.DaAppLab.DaKanji.flatpak ../DaKanji_${{env.DAKANJI_VERSION}}.flatpak | |
- name: Archive production artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: DaKanji_${{env.DAKANJI_VERSION}}.flatpak | |
path: DaKanji_${{env.DAKANJI_VERSION}}.flatpak | |
- name: Clean after flatpak | |
run: | | |
rm DaKanji_${{env.DAKANJI_VERSION}}.flatpak | |
rm -rf flatpak/repo | |
rm -rf flatpak/build-dir | |
# build SNAP | |
# - name: prepare snap building | |
# run: | | |
# python3 ./.github/workflows/building.py update_snapcraft_yaml | |
# flutter clean | |
# flutter pub get | |
# - name: Install Snapcraft and build snap | |
# uses: snapcore/action-build@v1 | |
# id: snapcraft | |
# - name: Rename snap | |
# run: | | |
# mv ${{ steps.snapcraft.outputs.snap }} DaKanji_${{env.DAKANJI_VERSION}}.snap | |
# - name: Upload snap as artifact | |
# uses: actions/upload-artifact@v3 | |
# with: | |
# name: DaKanji_${{env.DAKANJI_VERSION}}.snap | |
# path: DaKanji_${{env.DAKANJI_VERSION}}.snap |