diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml index 3899fabbd..7ca92c954 100644 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/CI.yaml @@ -11,18 +11,19 @@ jobs: CI: runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: recursive - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: node-version: 20 cache: "npm" - name: Install host dependencies run: | - sudo apt-get install flatpak mutter flatpak-builder + sudo apt update + sudo apt-get install flatpak mutter flatpak-builder gjs # Restore caches - name: Restore Flatpak dependencies diff --git a/.gitignore b/.gitignore index 661831257..5bce70690 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,5 @@ __pycache__ .idea target + +.frun diff --git a/.vscode/settings.json b/.vscode/settings.json index b793c9a7a..90c67624a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -29,5 +29,8 @@ "build", "builddir" ], - "vala.languageServerPath": "${workspaceFolder}/.flatpak/vala-language-server.sh" + "vala.languageServerPath": "${workspaceFolder}/.flatpak/vala-language-server.sh", + "yaml.schemas": { + "https://json.schemastore.org/github-workflow.json": "file:///home/sonny/Projects/Workbench/.github/workflows/deploy.yaml" + } } diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7883f3db7..f801425f9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -26,10 +26,10 @@ We provide a couple of tools to make the development process pleasant. ```sh # Ubuntu requirements -# sudo apt install flatpak flatpak-builder nodejs make gcc g++ +# sudo apt install flatpak flatpak-builder gjs nodejs make gcc g++ # Fedora requirements -# sudo dnf install flatpak flatpak-builder nodejs make gcc gcc-c++ +# sudo dnf install flatpak flatpak-builder gjs nodejs make gcc gcc-c++ cd Workbench make diff --git a/Makefile b/Makefile index d949809cf..91dd9ece1 100644 --- a/Makefile +++ b/Makefile @@ -17,9 +17,7 @@ stable: flatpak-builder --delete-build-dirs --disable-updates --build-only --ccache --force-clean flatpak build-aux/re.sonny.Workbench.json devel: -# flatpak --user run org.flatpak.Builder --delete-build-dirs --disable-updates --build-only --ccache --force-clean flatpak build-aux/re.sonny.Workbench.Devel.json - flatpak-builder --delete-build-dirs --disable-updates --build-only --ccache --force-clean flatpak build-aux/re.sonny.Workbench.Devel.json - + ./build-aux/wip/run.js --build build-aux/re.sonny.Workbench.Devel.json build: devel @@ -65,8 +63,6 @@ test: unit lint # ./build-aux/wip/run.js build-aux/re.sonny.Workbench.Devel.json -- workbench-cli ci demos/src/Welcome/ ci: setup build test -# See Permissions.js -# flatpak override --user --share=network --socket=pulseaudio --device=input re.sonny.Workbench.Devel ./build-aux/fun workbench-cli ci demos/src/* # Note that if you have Sdk extensions installed they will be used diff --git a/build-aux/fun b/build-aux/fun index dfee6c60f..16ff2227f 100755 --- a/build-aux/fun +++ b/build-aux/fun @@ -1,5 +1,7 @@ #!/usr/bin/env sh # fun stands for Flatpak Run -flatpak-builder --run $(dirname $0)/../flatpak $(dirname $0)/re.sonny.Workbench.Devel.json "$@" +# flatpak-builder --run $(dirname $0)/../flatpak $(dirname $0)/re.sonny.Workbench.Devel.json "$@" # flatpak-builder --env=G_MESSAGES_DEBUG=workbench-cli --run flatpak build-aux/re.sonny.Workbench.Devel.json "$@" + +$(dirname $0)/wip/run.js $(dirname $0)/re.sonny.Workbench.Devel.json -- "$@" diff --git a/build-aux/wip/run.js b/build-aux/wip/run.js index 80e9ada97..e34d5374f 100755 --- a/build-aux/wip/run.js +++ b/build-aux/wip/run.js @@ -49,14 +49,14 @@ function exists(path) { return result; } -if (!exists(`${path}/.flatpak/repo`)) { +if (!exists(`${path}/.frun/repo`)) { const { runtime, sdk } = manifest; const runtime_version = manifest["runtime-version"]; // initializes repo await run([ "flatpak", "build-init", - `${path}/.flatpak/repo`, + `${path}/.frun/repo`, flatpak_id, sdk, runtime, @@ -71,9 +71,9 @@ const prefix = [ "--disable-updates", ]; const suffix = [ - `--state-dir=${path}/.flatpak/flatpak-builder`, + `--state-dir=${path}/.frun/flatpak-builder`, `--stop-at=${app_module.name}`, - `${path}/.flatpak/repo`, + `${path}/.frun/repo`, Gio.File.new_for_path(path).get_relative_path(manifest_file), ]; @@ -93,23 +93,23 @@ async function buildModules() { ]); } -if (!exists(`${path}/.flatpak/flatpak-builder`)) { +if (!exists(`${path}/.frun/flatpak-builder`)) { await downloadSources(); await buildModules(); } // builds workbench -if (!exists(`${path}/_build`)) { +if (!exists(`${path}/.frun/_build`)) { await buildCommand([ "meson", "--prefix", "/app", - "_build", + ".frun/_build", "-Dprofile=development", ]); } -await buildCommand(["meson", "install", "-C", "_build"]); +await buildCommand(["meson", "install", "-C", ".frun/_build"]); // await buildCommand([ // `troll/gjspack/bin/gjspack`, // `--appid=${flatpak_id}`, @@ -123,10 +123,12 @@ await buildCommand(["meson", "install", "-C", "_build"]); // ]); // starts workbench -const command = argv["--"].length ? argv["--"] : [manifest.command]; -await runCommand(command); +if (argv.build !== true) { + const command = argv["--"].length ? argv["--"] : [manifest.command]; + await runCommand(command); +} -function buildCommand(argv) { +function getCommonArguments() { let PATH = "/app/bin:/app/bin:/app/bin:/usr/bin:${home}/.var/app/com.visualstudio.code/data/node_modules/bin:/app/bin:/usr/bin"; const append_path = manifest["build-options"]?.["append-path"]; @@ -137,6 +139,10 @@ function buildCommand(argv) { manifest["build-options"]?.["append-ls-library-path"]; if (append_ld_library_path) LD_LIBRARY_PATH += `:${append_ld_library_path}`; + return [`--env=PATH=${PATH}`, `--env=LD_LIBRARY_PATH=${LD_LIBRARY_PATH}`]; +} + +function buildCommand(argv) { const PKG_CONFIG_PATH = "/usr/local/lib64/pkgconfig:/usr/local/lib/pkgconfig:/usr/local/share/pkgconfig:/usr/lib64/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig:/app/lib/pkgconfig:/app/share/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig"; @@ -145,12 +151,11 @@ function buildCommand(argv) { "build", "--share=network", `--filesystem=${path}`, - `--filesystem=${path}/.flatpak/repo`, - `--env=PATH=${PATH}`, - `--env=LD_LIBRARY_PATH=${LD_LIBRARY_PATH}`, + `--filesystem=${path}/.frun/repo`, + ...getCommonArguments(), `--env=PKG_CONFIG_PATH=${PKG_CONFIG_PATH}`, - `--filesystem=${path}/_build`, - `${path}/.flatpak/repo`, + `--filesystem=${path}/.frun/_build`, + `${path}/.frun/repo`, ...argv, ]); } @@ -165,12 +170,14 @@ async function runCommand(argv) { `--bind-mount=/run/user/1000/doc=/run/user/1000/doc/by-app/${flatpak_id}`, ...manifest["finish-args"], + ...getCommonArguments(), + // Non default permissions, see Permissions.js // consider getting installed overrides instead with // flatpak override --user --show re.sonny.Workbench.Devel "--share=network", "--socket=pulseaudio", - "--device=input", + "--device=all", // using "all" instead of "device" for broader compatibility "--talk-name=org.freedesktop.portal.*", "--talk-name=org.a11y.Bus", @@ -183,7 +190,7 @@ async function runCommand(argv) { `--filesystem=${home}/.cache/fontconfig:ro`, `--bind-mount=/run/host/user-fonts-cache=${home}/.cache/fontconfig`, `--bind-mount=/run/host/font-dirs.xml=${home}/.cache/font-dirs.xml`, - `${path}/.flatpak/repo`, + `${path}/.frun/repo`, ...argv, ], { verbose: true }, @@ -233,7 +240,7 @@ async function exec(argv, { cancellable = null /*, verbose = false*/ }) { // ? Gio.SubprocessFlags.NONE // : Gio.SubprocessFlags.STDOUT_SILENCE; - const flags = Gio.SubprocessFlags.NONE; + const flags = Gio.SubprocessFlags.STDIN_INHERIT; const proc = new Gio.Subprocess({ argv,