pypa / setuptools_scm

the blessed package to manage your versions by scm tags
https://setuptools-scm.readthedocs.io/en/latest/
MIT License
833 stars 211 forks source link

Package version incorrectly inferred when bulding wheels via CI. #952

Closed zoj613 closed 8 months ago

zoj613 commented 9 months ago

I have a package I have been trying to make a release for but it won't upload to PyPI because the version on the wheel is not correctly inferred. Building the wheels locally using cibuildwheel the versioning is correct. What could be possibly wrong with my workflow steps?

Here is the CI job: https://github.com/zoj613/polyagamma/actions/runs/6401828361/job/17377514857#step:5:12306

the package version is supposed to be 1.3.6 but it is shown as 0.1. Locally it is inferred correctly. Here is the corresponding workflow file: https://github.com/zoj613/polyagamma/actions/runs/6401828361/workflow . The issue persists even if I skip the QEMU step. Any suggestions?

RonnyPfannschmidt commented 9 months ago

Does it's create the tag before or after the release publishing

I believe the pipeline needs to run on the tag event on top of the tagged commit

There is no support for inferring more details from GitHub ci

zoj613 commented 9 months ago

Does it's create the tag before or after the release publishing

I believe the pipeline needs to run on the tag event on top of the tagged commit

There is no support for inferring more details from GitHub ci

I believe the workflow is ran after a manual tagged release has been made. The workflow worked just fine a few months ago when the current version was release here: https://github.com/zoj613/polyagamma/actions/runs/4380135801 with correctly versioned wheels: https://pypi.org/project/polyagamma/#files

i'm not sure what could have caused setuptools-scm to now use an incorrect version when running the CI job but still work correctly when run locally.

RonnyPfannschmidt commented 9 months ago

If the checkout action goes for plain commit no tags land in the checkout

zoj613 commented 9 months ago

If the checkout action goes for plain commit no tags land in the checkout

I tried adding

      - uses: actions/checkout@v3
        with:
          ref: ${{  github.ref_name }}
          fetch-tags: 'true'

in there but it still changes nothing: https://github.com/zoj613/polyagamma/actions/runs/6409235631/job/17400001083 . The wheels are versioned as 0.1.dev...

zoj613 commented 9 months ago

@RonnyPfannschmidt any other ideas I could try to resolve this? I'm not even sure if this is a bug in setuptools-scm or im just not doing things correctly.

RonnyPfannschmidt commented 9 months ago

Set the SETUOTOOLS_SCM_DEBUG env variable and get the output added

zoj613 commented 8 months ago

Set the SETUOTOOLS_SCM_DEBUG env variable and get the output added

I added the variable, here is a CI run with it enabled: https://github.com/zoj613/polyagamma/actions/runs/6442982408/job/17494400442#step:5:1

RonnyPfannschmidt commented 8 months ago

Ok, the checkout has no tags your need to make Git fetch them

zoj613 commented 8 months ago

Ok, the checkout has no tags your need to make Git fetch them

The workflow file has these lines: https://github.com/zoj613/polyagamma/actions/runs/6442982408/workflow#L26-L30 is there something on top of that need to ensure tags are fetched. It seems like these options are not enough.

zoj613 commented 8 months ago

@RonnyPfannschmidt It looks like the source of the problem is that actions/checkout introduced a breaking change as explained at https://github.com/actions/checkout/issues/1471 where the tags no longer get fetched using the default settings. I had to set fetch-depth=0 in order for all tags to be fetched. Introducing this "fix" results in setuptools-scm versioning the wheels correctly.