-
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integrate flatpak build into build system (#458)
- Loading branch information
1 parent
fda3bd4
commit b848654
Showing
7 changed files
with
122 additions
and
26 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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: | ||
|
@@ -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: | | ||
|
@@ -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 | ||
|
@@ -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 |
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 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 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 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 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
67 changes: 67 additions & 0 deletions
67
build-aux/linux/flatpak/release/com.inochi2d.inochi-creator.yml
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
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: . |