Skip to content

Commit 0a63139

Browse files
authored
feat(flatpak-builder): Allow configurable build/repo/state dirs (#237)
* feat(flatpak-builder): Allow configurable build/repo/state dirs Previously, the flatpak-builder action used hardcoded directories for the build output, local repository, and build state. This change introduces new input parameters to make these directories configurable: - 'build-dir': Specifies the directory for the application build output. - 'repo-name': Specifies the directory for the flatpak repository. - 'state-dir': Specifies the directory to store the build cache. This flexibility is crucial for environments like GitHub Actions, where default working directories might have limited space. By allowing users to specify paths, they can leverage volume mountpoints (e.g., /mnt) that offer more disk space, preventing "running out of space" errors during the build process. Signed-off-by: Zeglius <33781398+Zeglius@users.noreply.github.com> * feat(ci): Add flatpak-builder dedicated path params test job Signed-off-by: Zeglius <33781398+Zeglius@users.noreply.github.com> * refactor: Rename repo-name to repo-dir for clarity Signed-off-by: Zeglius <33781398+Zeglius@users.noreply.github.com> * ci: Add verification for created flatpak directories Signed-off-by: Zeglius <33781398+Zeglius@users.noreply.github.com> * ci: update flatpak-builder action repo-dir parameter Signed-off-by: Zeglius <33781398+Zeglius@users.noreply.github.com> --------- Signed-off-by: Zeglius <33781398+Zeglius@users.noreply.github.com>
1 parent ad1b66e commit 0a63139

5 files changed

Lines changed: 2180 additions & 2130 deletions

File tree

.github/workflows/flatpak-test.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,34 @@ jobs:
8686
cache-key: flatpak-builder-${{ github.sha }}-no-cache-restored
8787
verbose: true
8888

89+
flatpak-builder-dedicated-path-params:
90+
name: Flatpak Builder with Dedicated Path Params
91+
runs-on: ubuntu-latest
92+
container:
93+
image: ghcr.io/flathub-infra/flatpak-github-actions:gnome-48
94+
options: --privileged
95+
volumes:
96+
- /mnt/flatpak_workflow:/mnt/flatpak_workflow
97+
steps:
98+
- uses: actions/checkout@v4
99+
- uses: ./flatpak-builder
100+
with:
101+
manifest-path: ./flatpak-builder/tests/test-project/org.example.MyApp.yaml
102+
build-dir: /mnt/flatpak_workflow/build-dir
103+
repo-dir: /mnt/flatpak_workflow/repo
104+
state-dir: /mnt/flatpak_workflow/.flatpak-builder
105+
verbose: true
106+
- name: Verify created directories
107+
shell: bash
108+
run: |
109+
for d in \
110+
/mnt/flatpak_workflow/build-dir \
111+
/mnt/flatpak_workflow/repo \
112+
/mnt/flatpak_workflow/.flatpak-builder
113+
do
114+
[ -d "$d" ] || { echo "::error::Directory $d does not exist"; exit 1; }
115+
done
116+
89117
tests:
90118
name: Tests
91119
runs-on: ubuntu-latest

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,15 @@ jobs:
5656
| `arch` | Specifies the CPU architecture to build for | Optional | `x86_64` |
5757
| `mirror-screenshots-url` | Specifies the URL to mirror screenshots | Optional | - |
5858
| `gpg-sign` | The key to sign the package | Optional | - |
59+
| `build-dir` | The directory to build the application in. | Optional | `flatpak_app` |
60+
| `repo-dir` | The directory of the flatpak repository. | Optional | `repo` |
61+
| `state-dir` | The directory to store the build state/cache in. | Optional | `.flatpak-builder` |
5962
| `verbose` | Enable verbosity | Optional | `false` |
6063
| `upload-artifact` | Whether to upload the resulting bundle or not as an artifact | Optional | `true` |
6164

65+
**Note**: `repo-dir` and `state-dir` must be under the same partition.
66+
67+
6268
#### Building for multiple CPU architectures
6369

6470
To build for CPU architectures other than `x86_64`, the GitHub Actions workflow has to either natively be running on that architecture (e.g. on an `aarch64` self-hosted GitHub Actions runner), or the container used must be configured to emulate the requested architecture (e.g. with QEMU).

flatpak-builder/action.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,18 @@ inputs:
7373
description: >
7474
The key to sign the package.
7575
required: false
76+
build-dir:
77+
description: >
78+
The directory to build the application in.
79+
required: false
80+
repo-dir:
81+
description: >
82+
The name of the flatpak repository.
83+
required: false
84+
state-dir:
85+
description: >
86+
The directory to store the build state/cache in.
87+
required: false
7688
verbose:
7789
description: >
7890
"Enable verbosity"

0 commit comments

Comments
 (0)