perf: use numpy conversions for Vector.from_numpy() #96
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish to PyPI | |
on: | |
push: | |
branches: ["*"] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.12' | |
- name: Install Poetry | |
run: | | |
curl -sSL https://install.python-poetry.org | python3 - | |
echo "$HOME/.local/bin" >> $GITHUB_PATH | |
shell: bash | |
- name: Configure Poetry to use virtual environment inside the project | |
run: poetry config virtualenvs.in-project true | |
- name: Install dependencies | |
run: poetry install | |
- name: Run Tests | |
run: poetry run pytest | |
- name: Build the package | |
run: poetry build | |
- name: Check if version exists on PyPI | |
id: check-version | |
run: | | |
PACKAGE_NAME=$(poetry version | awk '{print $1}') | |
PACKAGE_VERSION=$(poetry version | awk '{print $2}') | |
RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" https://pypi.org/pypi/$PACKAGE_NAME/$PACKAGE_VERSION/json) | |
if [ "$RESPONSE" == "200" ]; then | |
echo "Version $PACKAGE_VERSION already exists on PyPI. Skipping publish step." | |
echo "exists=true" >> $GITHUB_ENV | |
else | |
echo "exists=false" >> $GITHUB_ENV | |
fi | |
shell: bash | |
- name: Publish to PyPI (release only) | |
if: env.exists == 'false' | |
run: poetry publish --no-interaction --username __token__ --password ${{ secrets.PYPI_TOKEN }} |