Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved and optimised snap #212

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
31 changes: 31 additions & 0 deletions .github/workflows/snapcraft.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: 🧪 Test snap can be built on x86_64

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- uses: snapcore/action-build@v1
id: build

- uses: actions/upload-artifact@v3
with:
name: snap
path: ${{ steps.build.outputs.snap }}

- uses: diddlesnaps/snapcraft-review-action@v1
with:
snap: ${{ steps.build.outputs.snap }}
isClassic: 'false'
# Plugs and Slots declarations to override default denial (requires store assertion to publish)
# plugs: ./plug-declaration.json
# slots: ./slot-declaration.json

35 changes: 16 additions & 19 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ adopt-info: video-downloader

base: core22
confinement: strict

type: app
environment:
# WORKAROUND: Add python modules in Snap to search path
PYTHONPATH: ${SNAP}/lib/python3.10/site-packages:${SNAP}/usr/lib/python3/dist-packages
Expand All @@ -35,23 +35,6 @@ slots:
name: com.github.unrud.VideoDownloader

parts:
libadwaita:
plugin: meson
source: https://gitlab.gnome.org/GNOME/libadwaita/-/archive/1.2.0/libadwaita-1.2.0.tar.bz2
source-checksum: sha256/9da0df3d2f2f5c0a79becd47d09312124542545e4aa1ea151b993c5f6b939e78
override-pull: |
craftctl default
# WORKAROUND: Ignore compiler warning
sed -e 's/-W\(format-nonliteral\)\b/-Wno-\1/g' -i meson.build
meson-parameters:
# WORKAROUND: Must be installed to /usr because of GI search path
- --prefix=/usr
- -Dexamples=false
- -Dtests=false
- -Dvapi=false
stage:
- -usr/include

ffmpeg:
# WORKAROUND:
# Build from source because the ffmpeg package installs libraries as dependencies
Expand Down Expand Up @@ -112,7 +95,7 @@ parts:
- -pyvenv.cfg

video-downloader:
after: [libadwaita, yt-dlp]
after: [ffmpeg, yt-dlp]
plugin: meson
source: .
source-type: git
Expand All @@ -136,3 +119,17 @@ parts:
# WORKAROUND: Move files from fake installation location to actual target
snap/video-downloader/current/usr: usr
parse-info: [usr/share/metainfo/com.github.unrud.VideoDownloader.metainfo.xml]
cleanup:
after: # Make this part run last; list all your other parts here
- video-downloader
- ffmepg
- yt-dlp
plugin: nil
build-snaps: # List all content-snaps and base snaps you're using here
- gnome-42-2204
- core22
override-prime: |
set -eux
for snap in "gnome-42-2204" "core22"; do
cd "/snap/$snap/current" && find . -type f,l -exec rm -f "$SNAPCRAFT_PRIME/{}" \;
done