Skip to content

Commit

Permalink
Merge pull request #1248 from Dessia-tech/fix_ci
Browse files Browse the repository at this point in the history
Try: Fix Test Pypi
  • Loading branch information
WirajanDASILVA authored Feb 14, 2024
2 parents c398a15 + 5f5afd7 commit e32e52f
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 22 deletions.
16 changes: 9 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
run: |
python -m cibuildwheel --output-dir wheelhouse
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl
Expand All @@ -40,7 +40,9 @@ jobs:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Build sdist
run: pipx run build --sdist
Expand All @@ -51,6 +53,7 @@ jobs:
path: dist/*.tar.gz

upload_pypi:
name: Upload to PyPi
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
environment: pypi
Expand All @@ -63,11 +66,10 @@ jobs:
steps:
- uses: actions/download-artifact@v4
with:
# unpacks all CIBW artifacts into dist/
pattern: cibw-*
path: dist
merge-multiple: true
path: dist/

- name: Display structure of downloaded files
run: ls -R dist
- uses: pypa/gh-action-pypi-publish@release/v1
with:
# To test: repository_url: https://test.pypi.org/legacy/
packages-dir: dist/*
24 changes: 14 additions & 10 deletions .github/workflows/test-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ on:
push:
branches:
- testing
- fix_ci

jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
name: Build distribution on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand All @@ -33,7 +34,7 @@ jobs:
run: |
python -m cibuildwheel --output-dir wheelhouse
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl
Expand All @@ -42,18 +43,20 @@ jobs:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Build sdist
run: |
python setup.py sdist
run: pipx run build --sdist

- uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz

upload_pypi:
name: upload to TestPyPi
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
environment: testpypi
Expand All @@ -65,11 +68,12 @@ jobs:
steps:
- uses: actions/download-artifact@v4
with:
# unpacks all CIBW artifacts into dist/
pattern: cibw-*
path: dist
merge-multiple: true
path: dist/
- name: Display structure of downloaded files
run: ls -R dist

- uses: pypa/gh-action-pypi-publish@release/v1
with:
repository_url: https://test.pypi.org/legacy/
repository-url: https://test.pypi.org/legacy/
verbose: true
packages-dir: dist/*
10 changes: 5 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import re
from os.path import dirname, isdir, join
from subprocess import CalledProcessError, check_output
from subprocess import CalledProcessError, check_output, STDOUT

import numpy as np
from setuptools import setup
Expand Down Expand Up @@ -90,10 +90,10 @@ def get_version():
if isdir(join(d, ".git")):
cmd = "git describe --tags"
try:
version = check_output(cmd.split()).decode().strip()[:]

except CalledProcessError:
raise RuntimeError("Unable to get version number from git tags")
version = check_output(cmd.split(), stderr=STDOUT).decode().strip()[:]
except CalledProcessError as exception:
raise RuntimeError("Unable to get version number from git tags, rc=", exception.returncode,
"output=", exception.output)

return version_from_git_describe(version)
else:
Expand Down

0 comments on commit e32e52f

Please sign in to comment.