Skip to content

Commit

Permalink
fix[ci]: fix commithash calculation for pypi release (#4309)
Browse files Browse the repository at this point in the history
there is a mismatch between the commit hash in the binary of the github
release vs the pypi release. for example,
```bash
~ $ vyper --version  # pipx install vyper==0.4.0
0.4.0+commit.e9db8d9
```
```bash
~ $ .vvm/vyper-0.4.0 --version
0.4.0+commit.e9db8d9f
```

this is due to how git computes the shorthash. when checkout is run for
release-pypi.yml, it doesn't fetch the full commit history, and so there
are fewer commits, so `git rev-parse --short HEAD` returns a smaller
fingerprint for the commit hash.

this commit amends the pypi release checkout step so that it matches the
github release workflow.

it also adds a debug step to the relevant workflows so that we can debug
the commit hash during the github action.
  • Loading branch information
charles-cooper authored Oct 15, 2024
1 parent 8f9a8ca commit 039d369
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ jobs:
# need to fetch unshallow so that setuptools_scm can infer the version
fetch-depth: 0

# debug
- name: Git shorthash
run: git rev-parse --short HEAD

- name: Python
uses: actions/setup-python@v5
with:
Expand Down Expand Up @@ -60,6 +64,10 @@ jobs:
# need to fetch unshallow so that setuptools_scm can infer the version
fetch-depth: 0

# debug
- name: Git shorthash
run: git rev-parse --short HEAD

- name: Python
uses: actions/setup-python@v5
with:
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/release-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
# fetch unshallow so commit hash matches github release.
# see https://github.com/vyperlang/vyper/blob/8f9a8cac49aafb3fbc9dde78f0f6125c390c32f0/.github/workflows/build.yml#L27-L32
fetch-depth: 0

# debug
- name: Git shorthash
run: git rev-parse --short HEAD

- name: Python
uses: actions/setup-python@v5
Expand Down

0 comments on commit 039d369

Please sign in to comment.