From 4612c2f43c7791126092be867fa5ec3adc7aa2b0 Mon Sep 17 00:00:00 2001 From: Lukas Pielsticker <50139597+lukaspie@users.noreply.github.com> Date: Wed, 17 Jul 2024 11:44:31 +0200 Subject: [PATCH 01/10] fetch submodules, git reset before build --- .github/workflows/publish.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index b72316ebf..f38b3901d 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -18,6 +18,9 @@ jobs: id-token: write steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 + submodules: recursive - name: Set up Python uses: actions/setup-python@v5 with: @@ -25,9 +28,10 @@ jobs: - name: Install dependencies run: | curl -LsSf https://astral.sh/uv/install.sh | sh - git reset --hard HEAD uv pip install build - name: Build package - run: python -m build + run: | + git reset --hard HEAD + python -m build - name: Publish package distributions to PyPI uses: pypa/gh-action-pypi-publish@release/v1 \ No newline at end of file From 7d27cfb53f80d77e376f2aaaa4e3f250105a71fe Mon Sep 17 00:00:00 2001 From: Lukas Pielsticker <50139597+lukaspie@users.noreply.github.com> Date: Wed, 17 Jul 2024 11:52:00 +0200 Subject: [PATCH 02/10] add workflow to simulate publishing --- .github/workflows/publish_test.yml | 39 ++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/publish_test.yml diff --git a/.github/workflows/publish_test.yml b/.github/workflows/publish_test.yml new file mode 100644 index 000000000..6e023c28b --- /dev/null +++ b/.github/workflows/publish_test.yml @@ -0,0 +1,39 @@ +name: Simulate Upload of Python Package + +on: + push: # workflow_dispatch: + branches: [git-reset-in-build-step] + +env: + UV_SYSTEM_PYTHON: true + +jobs: + deploy: + name: Simulate upload release to PyPI + runs-on: ubuntu-latest + # environment: + # name: pypi + # url: https://pypi.org/p/pynxtools + permissions: + id-token: write + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + submodules: recursive + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.x" + - name: Install dependencies + run: | + curl -LsSf https://astral.sh/uv/install.sh | sh + uv pip install build + - name: Build package + run: | + git status + git reset --hard HEAD + git status + python -m build + # - name: Publish package distributions to PyPI + # uses: pypa/gh-action-pypi-publish@release/v1 \ No newline at end of file From ba1a4eeb210a04158a80459fe61ffbe968698ecf Mon Sep 17 00:00:00 2001 From: domna Date: Wed, 17 Jul 2024 15:36:49 +0200 Subject: [PATCH 03/10] Add git status after build --- .github/workflows/publish_test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/publish_test.yml b/.github/workflows/publish_test.yml index 6e023c28b..c2c15feb0 100644 --- a/.github/workflows/publish_test.yml +++ b/.github/workflows/publish_test.yml @@ -35,5 +35,6 @@ jobs: git reset --hard HEAD git status python -m build + git status # - name: Publish package distributions to PyPI # uses: pypa/gh-action-pypi-publish@release/v1 \ No newline at end of file From 05197f8feeeeabe3feca5d1200cb6d10eae9e61f Mon Sep 17 00:00:00 2001 From: domna Date: Wed, 17 Jul 2024 15:41:09 +0200 Subject: [PATCH 04/10] Use `--abbrev` for git describe --- .github/workflows/check_nexus_version.yml | 2 +- src/pynxtools/_build_wrapper.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check_nexus_version.yml b/.github/workflows/check_nexus_version.yml index 51e04816a..73fa9d73d 100644 --- a/.github/workflows/check_nexus_version.yml +++ b/.github/workflows/check_nexus_version.yml @@ -17,7 +17,7 @@ jobs: git submodule update --init --recursive --jobs=4 git submodule foreach --recursive 'git fetch --tags' cd src/pynxtools/definitions - git describe --dirty --tags --long --match "*[0-9]*" > ../nexus-ref.txt + git describe --dirty --tags --long --abbrev=8 --match "*[0-9]*" > ../nexus-ref.txt cd ../ - name: Diff run: | diff --git a/src/pynxtools/_build_wrapper.py b/src/pynxtools/_build_wrapper.py index d07aa084a..6f94553a0 100644 --- a/src/pynxtools/_build_wrapper.py +++ b/src/pynxtools/_build_wrapper.py @@ -28,6 +28,7 @@ def get_vcs_version(tag_match="*[0-9]*") -> Optional[str]: "--dirty", "--tags", "--long", + "--abbrev=8", "--match", tag_match, ], From 01046115de82858441357aa4ed849a592d682a17 Mon Sep 17 00:00:00 2001 From: domna Date: Wed, 17 Jul 2024 15:42:25 +0200 Subject: [PATCH 05/10] Run diff --- .github/workflows/publish_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish_test.yml b/.github/workflows/publish_test.yml index c2c15feb0..e49274ee4 100644 --- a/.github/workflows/publish_test.yml +++ b/.github/workflows/publish_test.yml @@ -35,6 +35,6 @@ jobs: git reset --hard HEAD git status python -m build - git status + git diff # - name: Publish package distributions to PyPI # uses: pypa/gh-action-pypi-publish@release/v1 \ No newline at end of file From 467f1a5417579aebd6475845241c9af6effab91e Mon Sep 17 00:00:00 2001 From: domna Date: Wed, 17 Jul 2024 15:43:48 +0200 Subject: [PATCH 06/10] Remove newline in nexus version --- src/pynxtools/nexus-version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pynxtools/nexus-version.txt b/src/pynxtools/nexus-version.txt index afea222fd..1317bbf1c 100644 --- a/src/pynxtools/nexus-version.txt +++ b/src/pynxtools/nexus-version.txt @@ -1 +1 @@ -v2022.07-1278-g1d7000f4 +v2022.07-1278-g1d7000f4 \ No newline at end of file From 81260eec3aa9810fbf663fe864a88f33b8b4802a Mon Sep 17 00:00:00 2001 From: domna Date: Wed, 17 Jul 2024 15:45:37 +0200 Subject: [PATCH 07/10] Remove whitespace ignore param from nexus version diff --- .github/workflows/check_nexus_version.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check_nexus_version.yml b/.github/workflows/check_nexus_version.yml index 73fa9d73d..12cca7b0a 100644 --- a/.github/workflows/check_nexus_version.yml +++ b/.github/workflows/check_nexus_version.yml @@ -21,4 +21,4 @@ jobs: cd ../ - name: Diff run: | - diff -w src/pynxtools/nexus-version.txt src/pynxtools/nexus-ref.txt \ No newline at end of file + diff src/pynxtools/nexus-version.txt src/pynxtools/nexus-ref.txt \ No newline at end of file From 19c06d76c2173708d83fa313091b3b3c169c7d55 Mon Sep 17 00:00:00 2001 From: domna Date: Wed, 17 Jul 2024 15:48:44 +0200 Subject: [PATCH 08/10] Don't write newline to nexus version --- .github/workflows/check_nexus_version.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check_nexus_version.yml b/.github/workflows/check_nexus_version.yml index 12cca7b0a..d8aab2c1d 100644 --- a/.github/workflows/check_nexus_version.yml +++ b/.github/workflows/check_nexus_version.yml @@ -17,7 +17,7 @@ jobs: git submodule update --init --recursive --jobs=4 git submodule foreach --recursive 'git fetch --tags' cd src/pynxtools/definitions - git describe --dirty --tags --long --abbrev=8 --match "*[0-9]*" > ../nexus-ref.txt + printf "%s" "$(git describe --dirty --tags --long --abbrev=8 --match '*[0-9]*'" > ../nexus-ref.txt cd ../ - name: Diff run: | From 1056e852a344357b4a6da56b59e5675746eaf21e Mon Sep 17 00:00:00 2001 From: domna Date: Wed, 17 Jul 2024 15:49:21 +0200 Subject: [PATCH 09/10] Forgot a `)` --- .github/workflows/check_nexus_version.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check_nexus_version.yml b/.github/workflows/check_nexus_version.yml index d8aab2c1d..28e722e05 100644 --- a/.github/workflows/check_nexus_version.yml +++ b/.github/workflows/check_nexus_version.yml @@ -17,7 +17,7 @@ jobs: git submodule update --init --recursive --jobs=4 git submodule foreach --recursive 'git fetch --tags' cd src/pynxtools/definitions - printf "%s" "$(git describe --dirty --tags --long --abbrev=8 --match '*[0-9]*'" > ../nexus-ref.txt + printf "%s" "$(git describe --dirty --tags --long --abbrev=8 --match '*[0-9]*')" > ../nexus-ref.txt cd ../ - name: Diff run: | From ba8e7746c5119d712b125b52f2637fa3e1b8af0a Mon Sep 17 00:00:00 2001 From: domna Date: Wed, 17 Jul 2024 15:50:50 +0200 Subject: [PATCH 10/10] Remove publish test --- .github/workflows/publish_test.yml | 40 ------------------------------ 1 file changed, 40 deletions(-) delete mode 100644 .github/workflows/publish_test.yml diff --git a/.github/workflows/publish_test.yml b/.github/workflows/publish_test.yml deleted file mode 100644 index e49274ee4..000000000 --- a/.github/workflows/publish_test.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Simulate Upload of Python Package - -on: - push: # workflow_dispatch: - branches: [git-reset-in-build-step] - -env: - UV_SYSTEM_PYTHON: true - -jobs: - deploy: - name: Simulate upload release to PyPI - runs-on: ubuntu-latest - # environment: - # name: pypi - # url: https://pypi.org/p/pynxtools - permissions: - id-token: write - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - submodules: recursive - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: "3.x" - - name: Install dependencies - run: | - curl -LsSf https://astral.sh/uv/install.sh | sh - uv pip install build - - name: Build package - run: | - git status - git reset --hard HEAD - git status - python -m build - git diff - # - name: Publish package distributions to PyPI - # uses: pypa/gh-action-pypi-publish@release/v1 \ No newline at end of file