This repository has been archived by the owner on Sep 9, 2024. It is now read-only.
Build #430
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
name: Build | |
env: | |
SOURCE_PATH: './packages/kaiteki' | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- 'packages/**' | |
- '!packages/kaiteki/storybook/**' | |
- '!packages/kaiteki/tools/**' | |
- '!packages/kaiteki/README.md' | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
outputs: | |
build-name: ${{steps.build-variables.outputs.BUILD_NAME}} | |
make-args: ${{steps.build-variables.outputs.MAKE_ARGS}} | |
defaults: | |
run: | |
working-directory: ${{ env.SOURCE_PATH }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Setup Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: 'master' | |
cache: true | |
- name: Activate Melos | |
run: 'flutter pub global activate melos' | |
- name: Bootstrap packages | |
run: 'melos bootstrap' | |
- name: Generate Localizations | |
run: 'melos run gen_l10n' | |
- name: Analyze | |
uses: invertase/github-action-dart-analyzer@v2.0.0 | |
with: | |
working-directory: ${{ env.SOURCE_PATH }} | |
- name: Test | |
run: 'melos run test' | |
- name: Provide build variables | |
id: build-variables | |
run: | | |
echo "BUILD_NAME=$(date +%Y-%U)" >> $GITHUB_OUTPUT | |
echo "MAKE_ARGS=RELEASE=TRUE SPLIT_PER_ABI=TRUE" >> $GITHUB_OUTPUT | |
- name: Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
files: coverage/lcov.info | |
build-linux: | |
name: Build for Linux | |
runs-on: ubuntu-latest | |
needs: test | |
defaults: | |
run: | |
working-directory: ${{ env.SOURCE_PATH }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Setup Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: 'master' | |
cache: true | |
- name: Install Linux build requirements | |
run: | | |
sudo apt-get update --fix-missing | |
sudo apt-get install clang cmake ninja-build pkg-config libgtk-3-dev libblkid-dev libhandy-1-dev | |
- name: Activate Melos | |
run: 'flutter pub global activate melos' | |
- name: Bootstrap packages | |
run: 'melos bootstrap' | |
- name: Generate Localizations | |
run: 'melos run gen_l10n' | |
- name: Build | |
run: 'melos run build:linux -- ${{needs.test.outputs.build-args}}' | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: linux | |
path: '${{ env.SOURCE_PATH }}/build/linux/x64/release/bundle/' | |
package-appimage: | |
name: Package (AppImage) | |
runs-on: ubuntu-latest | |
needs: build-linux | |
if: github.event_name != 'pull_request' | |
steps: | |
- name: Install packaging dependencies | |
run: 'sudo apt-get install -y python3-pip python3-setuptools patchelf desktop-file-utils libgdk-pixbuf2.0-dev fakeroot strace fuse' | |
- name: Download AppImageTool | |
run: | | |
wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage -O appimagetool | |
chmod +x appimagetool | |
- name: Download artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: linux | |
path: 'kaiteki.AppDir' | |
- name: Prepare directory | |
run: | | |
chmod +x kaiteki.AppDir/kaiteki | |
wget https://raw.githubusercontent.com/Craftplacer/Kaiteki/master/assets/icons/windows/kaiteki.png -O kaiteki.AppDir/kaiteki.png | |
wget https://raw.githubusercontent.com/Craftplacer/Kaiteki/master/assets/icons/windows/kaiteki.png -O kaiteki.AppDir/.DirIcon | |
wget https://raw.githubusercontent.com/Craftplacer/Kaiteki/master/packaging/linux/kaiteki.desktop -O kaiteki.AppDir/kaiteki.desktop | |
wget https://raw.githubusercontent.com/Craftplacer/Kaiteki/master/packaging/linux/AppRun -O kaiteki.AppDir/AppRun | |
chmod +x kaiteki.AppDir/AppRun | |
- name: Make AppImage | |
run: | | |
./appimagetool --appimage-extract | |
./squashfs-root/AppRun kaiteki.AppDir/ | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: appimage | |
path: 'Kaiteki-x86_64.AppImage' | |
package-flatpak: | |
name: Package (Flatpak) | |
runs-on: ubuntu-latest | |
needs: build-linux | |
if: github.event_name != 'pull_request' | |
container: | |
image: bilelmoussaoui/flatpak-github-actions:gnome-44 | |
options: --privileged | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Download artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: linux | |
path: './packages/kaiteki/build/linux/x64/release/bundle/' | |
- name: Build Flatpak | |
uses: flatpak/flatpak-github-actions/flatpak-builder@v6.1 | |
with: | |
bundle: moe.craftplacer.kaiteki.flatpak | |
manifest-path: ./packaging/linux/moe.craftplacer.kaiteki.yaml | |
cache-key: flatpak-builder-${{ github.sha }} | |
build-android: | |
name: Build for Android | |
runs-on: ubuntu-latest | |
needs: test | |
defaults: | |
run: | |
working-directory: ${{ env.SOURCE_PATH }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Setup Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: 'master' | |
cache: true | |
- name: Activate Melos | |
run: 'flutter pub global activate melos' | |
- name: Bootstrap packages | |
run: 'melos bootstrap' | |
- name: Generate Localizations | |
run: 'melos run gen_l10n' | |
- name: Dump signing key | |
uses: timheuer/base64-to-file@v1.2 | |
if: github.event_name != 'pull_request' | |
with: | |
fileName: 'keystore.pfx' | |
fileDir: '${{ env.SOURCE_PATH }}/android/app/' | |
encodedString: ${{ secrets.ANDROID_KEYSTORE }} | |
- name: Build | |
run: 'melos run build:android:free -- ${{needs.test.outputs.build-args}}' | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
if: github.event_name != 'pull_request' | |
with: | |
name: android | |
path: '${{ env.SOURCE_PATH }}/build/app/outputs/flutter-apk/app-*.apk' | |
build-windows: | |
name: Build for Windows | |
runs-on: windows-latest | |
needs: test | |
defaults: | |
run: | |
working-directory: ${{ env.SOURCE_PATH }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Setup Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: 'master' | |
cache: true | |
- name: Activate Melos | |
run: 'flutter pub global activate melos' | |
- name: Bootstrap packages | |
run: 'melos bootstrap' | |
- name: Generate Localizations | |
run: 'melos run gen_l10n' | |
- name: Build | |
run: 'melos run build:windows -- ${{needs.test.outputs.build-args}}' | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: windows | |
path: '${{ env.SOURCE_PATH }}/build/windows/x64/runner/Release/' | |
build-web: | |
name: Build for Web | |
runs-on: ubuntu-latest | |
needs: test | |
defaults: | |
run: | |
working-directory: ${{ env.SOURCE_PATH }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Setup Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: 'master' | |
cache: true | |
- name: Activate Melos | |
run: 'flutter pub global activate melos' | |
- name: Bootstrap packages | |
run: 'melos bootstrap' | |
- name: Generate Localizations | |
run: 'melos run gen_l10n' | |
- name: Build | |
run: 'melos run build:web -- ${{needs.test.outputs.build-args}}' | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: web | |
path: '${{ env.SOURCE_PATH }}/build/web/*' |