Skip to content

Commit

Permalink
Integrate flatpak build into build system
Browse files Browse the repository at this point in the history
  • Loading branch information
grillo-delmal committed Oct 17, 2024
1 parent fda3bd4 commit faa3169
Show file tree
Hide file tree
Showing 7 changed files with 122 additions and 26 deletions.
50 changes: 33 additions & 17 deletions .github/workflows/build-flatpak.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,17 @@ name: 'Build Inochi Creator (Flatpak)'

on:
workflow_call:
flatpak_branch:
required: true
type: string

inputs:
target_ref:
required: true
type: string
flatpak_branch:
required: true
type: string
postfix:
required: false
type: string
default: ''

jobs:
build-flatpak:
Expand All @@ -15,15 +22,15 @@ jobs:
options: --privileged

env:
MANIFEST_PATH: build-aux/linux/flatpak/com.inochi2d.inochi-creator.yml
MANIFEST_PATH: build-aux/linux/flatpak/${{ inputs.flatpak_branch }}/com.inochi2d.inochi-creator.yml
FLATPAK_BRANCH: ${{ inputs.flatpak_branch }}
FLATPAK_BUILD_DIR: build-dir
FLATPAK_BUILD_REPO: build-repo

steps:
- uses: actions/[email protected]
with:
submodules: true
ref: '${{ inputs.target_ref }}'

- name: Dump canonical manifest
run: |
Expand All @@ -38,7 +45,7 @@ jobs:
flatpak-builder --default-branch=${FLATPAK_BRANCH} --download-only /dev/null ${MANIFEST_PATH}
- name: Prime cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
.flatpak-builder/ccache
Expand All @@ -54,42 +61,51 @@ jobs:
- name: Upload flatpak repo
uses: actions/upload-artifact@v4
with:
name: ${{ env.FLATPAK_BUILD_REPO }}
name: ${{ env.FLATPAK_BUILD_REPO }}${{ inputs.postfix }}
path: |
${{ env.FLATPAK_BUILD_REPO }}
!${{ env.FLATPAK_BUILD_REPO }}/.lock
retention-days: 1

build-flatpak-bundle:
needs: build-flatpak
runs-on: ubuntu-latest

env:
APP_ID: com.inochi2d.inochi-creator
FLATPAK_BUNDLE: inochi-creator
FLATPAK_BRANCH: ${{ inputs.flatpak_branch }}
FLATPAK_BUILD_REPO: build-repo

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Install flatpak
run: |
set -e
sudo apt install -y flatpak
sudo apt-get update && sudo apt-get -y --no-install-recommends install flatpak
- name: Download flatpak repo
uses: actions/download-artifact@v4
with:
name: ${{ env.FLATPAK_BUILD_REPO }}
name: ${{ env.FLATPAK_BUILD_REPO }}${{ inputs.postfix }}
path: ${{ env.FLATPAK_BUILD_REPO }}

- name: Create flatpak bundle
run: |
set -e
mkdir -p ${FLATPAK_BUILD_REPO}/{extensions,refs/{mirrors,remotes},state,tmp/cache}
flatpak build-bundle --runtime-repo=https://flathub.org/repo/flathub.flatpakrepo ${FLATPAK_BUILD_REPO} ${FLATPAK_BUNDLE}.flatpak ${APP_ID} ${FLATPAK_BRANCH}
mkdir -p {out,${FLATPAK_BUILD_REPO}/{extensions,refs/{mirrors,remotes},state,tmp/cache}}
flatpak build-bundle --runtime-repo=https://flathub.org/repo/flathub.flatpakrepo ${FLATPAK_BUILD_REPO} inochi-creator.flatpak ${APP_ID} ${FLATPAK_BRANCH}
flatpak build-bundle --runtime ${FLATPAK_BUILD_REPO} inochi-creator.debug.flatpak ${APP_ID/-/_}.Debug ${FLATPAK_BRANCH}
mv inochi-creator.flatpak inochi-creator.debug.flatpak out/
touch .flatpak
- name: Upload flatpak bundle
- name: Make Artifact
uses: actions/upload-artifact@v4
with:
name: "build-flatpak"
path: ${{ env.FLATPAK_BUNDLE }}.flatpak
name: build-flatpak${{ inputs.postfix }}
path: |
out/inochi-creator.flatpak
out/inochi-creator.debug.flatpak
.flatpak
overwrite: true
retention-days: 1
2 changes: 2 additions & 0 deletions .github/workflows/publish-gh.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,6 @@ jobs:
out/inochi-creator-osx.zip
out/inochi-creator-win32.msi
out/Install_Inochi_Creator.dmg
out/inochi-creator.flatpak
out/inochi-creator.debug.flatpak
generate_release_notes: ${{ inputs.generate-notes }}
8 changes: 7 additions & 1 deletion .github/workflows/release-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ jobs:
generate_version: true
do_package: true

build-flatpak:
uses: './.github/workflows/build-flatpak.yml'
with:
target_ref: '${{ github.ref_name }}'
flatpak_branch: 'nightly'

steam-publish:
needs: build
uses: './.github/workflows/publish-steam.yml'
Expand All @@ -31,7 +37,7 @@ jobs:
branch: 'nightly'

gh-publish:
needs: build
needs: [build, build-flatpak]
uses: './.github/workflows/publish-gh.yml'
secrets: inherit
with:
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,15 @@ jobs:
do_package: true
postfix: '-demo'

build-flatpak-demo:
uses: './.github/workflows/build-flatpak.yml'
with:
target_ref: '${{ github.ref_name }}'
flatpak_branch: 'release'
postfix: '-demo'

gh-publish:
needs: build-demo
needs: [build-demo, build-flatpak-demo]
uses: './.github/workflows/publish-gh.yml'
secrets: inherit
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ cleanup-commands:
- mkdir -p ${FLATPAK_DEST}/lib/ffmpeg

modules:

# --- Inochi Creator ---
- name: Inochi-Creator
- name: inochi-creator
buildsystem: simple
build-options:
build-args:
Expand All @@ -48,9 +46,9 @@ modules:

sources:
- type: dir
path: ../../.. # The root of the Inochi Creator repo
path: ../../../.. # The root of the Inochi Creator repo

- name: Metadata
- name: metadata
buildsystem: simple
build-commands:

Expand All @@ -66,4 +64,4 @@ modules:
commit: a412602d346ba69c63237217ae286112e300927d

- type: dir
path: ./nightly/
path: .
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
</screenshot>
</screenshots>
<releases>
<release version="stable"/>
<release version="release"/>
</releases>
<url type="homepage">https://lunafoxgirlvt.itch.io/inochi-creator</url>
<url type="bugtracker">https://github.com/Inochi2D/inochi-creator/issues</url>
Expand Down
67 changes: 67 additions & 0 deletions build-aux/linux/flatpak/release/com.inochi2d.inochi-creator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
id: com.inochi2d.inochi-creator
runtime: org.freedesktop.Platform
runtime-version: '24.08'
sdk: org.freedesktop.Sdk
sdk-extensions:
- org.freedesktop.Sdk.Extension.ldc
- org.freedesktop.Sdk.Extension.llvm18
add-extensions:
- org.freedesktop.Platform.ffmpeg-full:
version: '24.08'
directory: lib/ffmpeg
add-ld-path: .
command: inochi-creator
finish-args:
- --device=all # OpenGL rendering, webcams (may be required? not sure)
- --socket=fallback-x11
- --share=ipc
- --socket=wayland
- --filesystem=host # This is a dev tool, it should probably have as much access to the host as it can. Also needs it for "Recent Files"
cleanup-commands:
- mkdir -p ${FLATPAK_DEST}/lib/ffmpeg

modules:
- name: inochi-creator
buildsystem: simple
build-options:
build-args:
- "--share=network"

append-path: /usr/lib/sdk/ldc/bin
prepend-path: /usr/lib/sdk/llvm18/bin
prepend-ld-library-path: /usr/lib/sdk/llvm18/lib
env:
DFLAGS: '-g --d-debug'
build-commands:
- chmod +x ./gentl.sh; ./gentl.sh
- git clone https://github.com/Inochi2D/i2d-imgui.git --recurse-submodules;
git clone https://github.com/Inochi2D/dcv-i2d;
dub add-local i2d-imgui/ "0.8.0";
dub add-local dcv-i2d/ "0.3.0";
dub build --config=update-version;
dub build --config=meta;
dub build --config=linux-demo --debug=InExperimental
- install -Dm 755 ./out/inochi-creator /app/bin/inochi-creator
- install -Dm644 ./out/*.mo /app/bin

sources:
- type: dir
path: ../../../.. # The root of the Inochi Creator repo

- name: metadata
buildsystem: simple
build-commands:

- install -Dm644 com.inochi2d.inochi-creator.metainfo.xml /app/share/metainfo/com.inochi2d.inochi-creator.metainfo.xml
- install -Dm644 ./creator/icon_128.png /app/share/icons/hicolor/128x128/apps/com.inochi2d.inochi-creator.png
- install -Dm644 ./creator/icon_256.png /app/share/icons/hicolor/256x256/apps/com.inochi2d.inochi-creator.png
- install -Dm644 ./creator/icon_512.png /app/share/icons/hicolor/512x512/apps/com.inochi2d.inochi-creator.png
- install -Dm644 inochi-creator.desktop /app/share/applications/com.inochi2d.inochi-creator.desktop

sources:
- type: git
url: https://github.com/Inochi2D/branding.git
commit: a412602d346ba69c63237217ae286112e300927d

- type: dir
path: .

0 comments on commit faa3169

Please sign in to comment.