Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/dark-moons-love.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"app-builder-lib": minor
"builder-util": minor
---

feat: adding support for core24 snapcraft and refactoring support to a new config property `snapcraft` to maintain backward compatibility
49 changes: 36 additions & 13 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -322,13 +322,14 @@ jobs:
retention-days: 1
if-no-files-found: error

test-linux-native:
name:
Test Linux Native (non-Docker)
# disabled for now
if: false
test-snap:
name: Test Snap (${{ matrix.core }})
runs-on: ubuntu-24.04
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
core: [core18, core20, core22, core24]
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

Expand All @@ -339,25 +340,47 @@ jobs:
cache-key: v-35.7.5-native-electron
reset-vitest-smart-cache: ${{ inputs.reset-vitest-smart-cache }}

- name: Install dependencies
- name: Test snap ${{ matrix.core }} (Docker)
run: SNAP_CORE=${{ matrix.core }} ./test/src/linux/test-snap.sh
env:
VITEST_SMART_CACHE_FILE: ${{ github.workspace }}/test/vitest-scripts/_vitest-smart-cache.json
RESET_VITEST_SHARD_CACHE: ${{ inputs.reset-vitest-smart-cache }}

# Native install+launch test — core24 only; requires snapcraft + unsquashfs on the runner.
- name: Disable background apt services (prevent apt lock contention)
if: matrix.core == 'core24'
run: |
sudo systemctl stop unattended-upgrades apt-daily.service apt-daily-upgrade.service || true
sudo systemctl disable apt-daily.timer apt-daily-upgrade.timer || true
sudo systemctl kill --kill-who=all apt-daily.service apt-daily-upgrade.service || true
while sudo fuser /var/lib/apt/lists/lock /var/lib/dpkg/lock /var/lib/dpkg/lock-frontend >/dev/null 2>&1; do
echo "Waiting for apt lock to be released…"
sleep 2
done

- name: Install snapcraft natively
if: matrix.core == 'core24'
run: |
sudo apt-get update
sudo apt-get install -y rpm flatpak flatpak-builder snapd
sudo apt-get install -y squashfs-tools xvfb
sudo snap install snapcraft --classic

- name: Test
run: |
pnpm ci:test
- name: Test snap core24 native (install + launch)
if: matrix.core == 'core24'
run: pnpm ci:test
env:
TEST_FILES: flatpakTest,snapHeavyTest
TEST_FILES: snapHeavyTest
SNAP_TEST_CORES: core24
SNAPCRAFT_BUILD_ENVIRONMENT: host
RUN_SNAP_TESTS: "true"
VITEST_SMART_CACHE_FILE: ${{ github.workspace }}/test/vitest-scripts/_vitest-smart-cache.json
RESET_VITEST_SHARD_CACHE: ${{ inputs.reset-vitest-smart-cache }}

- name: Upload smart cache artifact
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1
if: always()
with:
name: vitest-smart-cache-linux-native
name: vitest-smart-cache-snap-${{ matrix.core }}
path: ${{ github.workspace }}/test/vitest-scripts/_vitest-smart-cache.json
retention-days: 1
if-no-files-found: error
Expand Down Expand Up @@ -431,7 +454,7 @@ jobs:
# -------------------------

merge-smart-cache:
needs: [test-linux, test-windows, test-macos, test-e2e, test-updater, test-linux-native]
needs: [test-linux, test-windows, test-macos, test-e2e, test-updater, test-snap]
if: always()
runs-on: ubuntu-latest
timeout-minutes: 10
Expand Down
1,463 changes: 1,369 additions & 94 deletions packages/app-builder-lib/scheme.json

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions packages/app-builder-lib/src/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { MsiOptions } from "./options/MsiOptions"
import { MsiWrappedOptions } from "./options/MsiWrappedOptions"
import { PkgOptions } from "./options/pkgOptions"
import { PlatformSpecificBuildOptions } from "./options/PlatformSpecificBuildOptions"
import { SnapOptions } from "./options/SnapOptions"
import { SnapcraftOptions, SnapOptions } from "./options/SnapOptions"
import { SquirrelWindowsOptions } from "./options/SquirrelWindowsOptions"
import { WindowsConfiguration } from "./options/winOptions"
import { BuildResult } from "./packager"
Expand Down Expand Up @@ -96,9 +96,14 @@ export interface CommonConfiguration {
*/
readonly deb?: DebOptions | null
/**
* Snap options.
* @deprecated Use `snapcraft` instead, which supersedes any `snap` configuration.
* Will be removed in a future major release.
*/
readonly snap?: SnapOptions | null
/**
* Snapcraft options.
*/
readonly snapcraft?: SnapcraftOptions | null
/**
* AppImage options.
*/
Expand Down
2 changes: 1 addition & 1 deletion packages/app-builder-lib/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export { MsiOptions } from "./options/MsiOptions"
export { MsiWrappedOptions } from "./options/MsiWrappedOptions"
export { BackgroundAlignment, BackgroundScaling, PkgBackgroundOptions, PkgOptions } from "./options/pkgOptions"
export { AsarOptions, FileSet, FilesBuildOptions, PlatformSpecificBuildOptions, Protocol, ReleaseInfo } from "./options/PlatformSpecificBuildOptions"
export { PlugDescriptor, SlotDescriptor, SnapOptions } from "./options/SnapOptions"
export { PlugDescriptor, SlotDescriptor, SnapcraftOptions, SnapOptions } from "./options/SnapOptions"
export { SquirrelWindowsOptions } from "./options/SquirrelWindowsOptions"
export { WindowsAzureSigningConfiguration, WindowsConfiguration, WindowsSigntoolConfiguration } from "./options/winOptions"
export { BuildResult, Packager } from "./packager"
Expand Down
4 changes: 2 additions & 2 deletions packages/app-builder-lib/src/linuxPackager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import AppImageTarget from "./targets/appimage/AppImageTarget"
import FlatpakTarget from "./targets/FlatpakTarget"
import FpmTarget from "./targets/FpmTarget"
import { LinuxTargetHelper } from "./targets/LinuxTargetHelper"
import SnapTarget from "./targets/snap"
import SnapTarget from "./targets/snap/SnapTarget"
import { createCommonTarget } from "./targets/targetFactory"

export class LinuxPackager extends PlatformPackager<LinuxConfiguration> {
Expand Down Expand Up @@ -44,7 +44,7 @@ export class LinuxPackager extends PlatformPackager<LinuxConfiguration> {
case "appimage":
return require("./targets/appimage/AppImageTarget").default
case "snap":
return require("./targets/snap").default
return require("./targets/snap/SnapTarget").default
case "flatpak":
return require("./targets/FlatpakTarget").default
case "deb":
Expand Down
Loading
Loading