From e8dd0f5c58712bbc0f70c0c748b770e31bba9063 Mon Sep 17 00:00:00 2001 From: "K.B.Dharun Krishna" Date: Fri, 28 Mar 2025 01:02:53 +0530 Subject: [PATCH 1/6] feat: build snap from working dir of repo Signed-off-by: K.B.Dharun Krishna --- .github/workflows/test.yml | 1 - snap/snapcraft.yaml | 3 +- snap/test-snapcraft.yaml | 76 -------------------------------------- 3 files changed, 1 insertion(+), 79 deletions(-) delete mode 100644 snap/test-snapcraft.yaml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b26ab00..489175b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -153,7 +153,6 @@ 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/snapcraft.yaml b/snap/snapcraft.yaml index 83362e0..ac017c1 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -27,8 +27,7 @@ platforms: parts: tldr: plugin: python - source: https://github.com/tldr-pages/tldr-python-client.git - source-tag: $SNAPCRAFT_PROJECT_VERSION + source: . build-environment: - PATH: ${CRAFT_PART_INSTALL}/bin:${PATH} - PYTHONPATH: ${CRAFT_PART_INSTALL}/lib/python3.12/site-packages diff --git a/snap/test-snapcraft.yaml b/snap/test-snapcraft.yaml deleted file mode 100644 index 04671e8..0000000 --- a/snap/test-snapcraft.yaml +++ /dev/null @@ -1,76 +0,0 @@ -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 From 958c95663cf47c185a66dee50634dc3ffae73345 Mon Sep 17 00:00:00 2001 From: "K.B.Dharun Krishna" Date: Fri, 28 Mar 2025 01:04:50 +0530 Subject: [PATCH 2/6] fix: remove if condn from build Signed-off-by: K.B.Dharun Krishna --- .github/workflows/test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 489175b..6dee1a4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -139,7 +139,6 @@ jobs: build-snap: runs-on: ${{ matrix.os }} - if: github.repository == 'tldr-pages/tldr-python-client' && github.ref == 'refs/heads/main' needs: ['build-linux'] strategy: From 89dabd45c11df52e5dcdc4b850e9af544a1de9ce Mon Sep 17 00:00:00 2001 From: "K.B.Dharun Krishna" Date: Fri, 28 Mar 2025 01:19:58 +0530 Subject: [PATCH 3/6] test: build snap using git in main branch Signed-off-by: K.B.Dharun Krishna --- snap/snapcraft.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index ac017c1..b6d7bab 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -27,7 +27,7 @@ platforms: parts: tldr: plugin: python - source: . + source: https://github.com/tldr-pages/tldr-python-client.git build-environment: - PATH: ${CRAFT_PART_INSTALL}/bin:${PATH} - PYTHONPATH: ${CRAFT_PART_INSTALL}/lib/python3.12/site-packages From afb20ea355051ab49f3c9c429cecdb48245e246d Mon Sep 17 00:00:00 2001 From: "K.B.Dharun Krishna" Date: Fri, 28 Mar 2025 01:31:56 +0530 Subject: [PATCH 4/6] test: update snap workflow Signed-off-by: K.B.Dharun Krishna --- .github/workflows/test.yml | 3 ++- snap/snapcraft.yaml | 3 --- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6dee1a4..4a9172e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -139,7 +139,8 @@ jobs: build-snap: runs-on: ${{ matrix.os }} - needs: ['build-linux'] + # if: github.repository == 'tldr-pages/tldr-python-client' && github.ref == 'refs/heads/main' + # needs: ['build-linux'] strategy: matrix: diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index b6d7bab..ff68e9a 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -33,13 +33,10 @@ parts: - 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 From 64619a095605b6fc47fbfa4a82f7285939649946 Mon Sep 17 00:00:00 2001 From: "K.B.Dharun Krishna" Date: Fri, 28 Mar 2025 01:38:33 +0530 Subject: [PATCH 5/6] fix: add missing man build Signed-off-by: K.B.Dharun Krishna --- snap/snapcraft.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index ff68e9a..5d22e30 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -37,6 +37,8 @@ parts: 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 From dcfe398648ae33c4a4a71157cc8eca52b0e6e2db Mon Sep 17 00:00:00 2001 From: "K.B.Dharun Krishna" Date: Fri, 28 Mar 2025 01:39:42 +0530 Subject: [PATCH 6/6] feat: add back conditions to snap workflow Signed-off-by: K.B.Dharun Krishna --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4a9172e..489175b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -139,8 +139,8 @@ jobs: build-snap: runs-on: ${{ matrix.os }} - # if: github.repository == 'tldr-pages/tldr-python-client' && github.ref == 'refs/heads/main' - # needs: ['build-linux'] + if: github.repository == 'tldr-pages/tldr-python-client' && github.ref == 'refs/heads/main' + needs: ['build-linux'] strategy: matrix: