diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6dee1a4..b26ab00 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -139,6 +139,7 @@ jobs: build-snap: runs-on: ${{ matrix.os }} + if: github.repository == 'tldr-pages/tldr-python-client' && github.ref == 'refs/heads/main' needs: ['build-linux'] strategy: @@ -152,6 +153,7 @@ jobs: id: snapcraft-build with: snapcraft-args: "-v" + path: "snap/test-snapcraft.yaml" - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: diff --git a/snap/test-snapcraft.yaml b/snap/test-snapcraft.yaml new file mode 100644 index 0000000..04671e8 --- /dev/null +++ b/snap/test-snapcraft.yaml @@ -0,0 +1,76 @@ +name: tldr +base: core24 +summary: tldr python client +description: Python command-line client for tldr pages. + +grade: stable +confinement: strict + +platforms: + amd64: + build-on: [amd64] + build-for: [amd64] + arm64: + build-on: [arm64] + build-for: [arm64] + armhf: + build-on: [armhf] + build-for: [armhf] + ppc64el: + build-on: [ppc64el] + build-for: [ppc64el] + s390x: + build-on: [s390x] + build-for: [s390x] + +parts: + tldr: + plugin: python + source: https://github.com/tldr-pages/tldr-python-client.git + source-type: git + build-environment: + - PATH: ${CRAFT_PART_INSTALL}/bin:${PATH} + - PYTHONPATH: ${CRAFT_PART_INSTALL}/lib/python3.12/site-packages + override-pull: | + craftctl default + sed -i "/data_files=\[('share\/man\/man1', \['docs\/man\/tldr\.1'\])\],/d" setup.py + override-build: | + craftctl default + cd $CRAFT_PART_SRC/docs + make man + mkdir -p $CRAFT_PART_INSTALL/share/man/man1 + cp -r $CRAFT_PART_SRC/docs/man/tldr.1 $CRAFT_PART_INSTALL/share/man/man1/tldr.1 + python-packages: + - Sphinx + - sphinx-argparse + prime: + - -include + - -bin/activate + - -bin/activate.csh + - -bin/activate.fish + - -bin/Activate.ps1 + - -bin/python + - -bin/python3 + - -bin/python3.12 + - -lib/*/*/sphinx* + - -lib/*/*/setuptools* + - -lib/*/*/pip* + - -lib/*/*/pkg_resources + - -bin/pip + - -bin/pip3 + - -bin/pip3.12 + - -bin/[a-s, u-z, _]* + - -pyvenv.cfg + - -lib/*/*/[a-b, d-r, u-z, A-B, D-R, U-Z, _]* + - -lib/*/*/certifi* + - -lib/*/*/charset* + - -lib/*/*/snowballs* + +apps: + tldr: + command: bin/tldr + environment: + PYTHONPATH: $SNAP/lib/python3.12/site-packages:$PYTHONPATH + plugs: + - network + - home