Skip to content

Commit

Permalink
CI update
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeshingles committed Jun 18, 2024
1 parent 522cbc7 commit fb64ed9
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 143 deletions.
77 changes: 43 additions & 34 deletions .github/workflows/deploypypi.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
---
name: Build wheels and deploy to PyPI
name: Build and deploy to TestPyPI

on:
release:
types: [published, edited]
push:
branches:
- '*'
tags:
- 'v*'
- '*'
release:
types: [published, edited]
repository_dispatch:
types: [trigger_checks]
workflow_dispatch:

jobs:
Expand All @@ -16,29 +20,25 @@ jobs:
strategy:
matrix:
# macos-13 is an intel runner, macos-14 is apple silicon
os: [ubuntu-latest, macos-13, macos-14]
os: [ubuntu-24.04, macos-13, macos-14]
fail-fast: false
env:
CIBW_BEFORE_ALL_LINUX: curl -sSf https://sh.rustup.rs | sh -s -- -y
CIBW_ENVIRONMENT_LINUX: 'PATH=$HOME/.cargo/bin:$PATH'
CIBW_ENVIRONMENT_PASS_LINUX: SETUPTOOLS_SCM_PRETEND_VERSION_FOR_ARTISTOOLS

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install setuptools_scm
if: matrix.os == 'macos-13' || matrix.os == 'macos-14'
run: |
python3 -m pip install --upgrade --break-system-packages --user setuptools setuptools_scm[toml] setuptools-rust
- name: Install setuptools_scm
if: matrix.os != 'macos-13' && matrix.os != 'macos-14'
run: |
python3 -m pip install --upgrade setuptools setuptools_scm[toml] setuptools-rust
- uses: actions/setup-python@v5
with:
python-version-file: .python-version

- name: Run setuptools_scm
- name: Install dependencies
run: |
python3 -m setuptools_scm --strip-dev
python3 -m pip install --upgrade uv
python3 -m uv pip install --upgrade setuptools setuptools_scm[toml] setuptools-rust wheel twine build
echo "SETUPTOOLS_SCM_PRETEND_VERSION_FOR_ARTISTOOLS=$(python3 -m setuptools_scm --strip-dev)" >> $GITHUB_ENV
- name: Build wheels
uses: pypa/[email protected]
Expand All @@ -50,53 +50,62 @@ jobs:

build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Run setuptools_scm
- uses: actions/setup-python@v5
with:
python-version-file: .python-version

- name: Install dependencies
run: |
python3 -m pip install --upgrade setuptools setuptools_scm[toml] setuptools-rust
python3 -m setuptools_scm --strip-dev
python3 -m pip install --upgrade setuptools setuptools_scm[toml] setuptools-rust wheel twine build
echo "SETUPTOOLS_SCM_PRETEND_VERSION_FOR_ARTISTOOLS=$(python3 -m setuptools_scm --strip-dev)" >> $GITHUB_ENV
- name: Build sdist
run: pipx run build --sdist
run: |
export SETUPTOOLS_SCM_PRETEND_VERSION_FOR_ARTISTOOLS=$(python3 -m setuptools_scm --strip-dev)
python3 -m build --sdist
- uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz

upload_pypi:
deploy:
name: Upload to PyPI
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
environment: release
runs-on: ubuntu-24.04
environment: test
permissions:
id-token: write
#if: github.event_name == 'release' && github.event.action == 'published'
# or, alternatively, upload to PyPI on every tag starting with 'v' (remove on: release above to use this)
#if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-python@v5
with:
python-version-file: .python-version

- uses: actions/download-artifact@v4
with:
# unpacks all CIBW artifacts into dist/
pattern: cibw-*
path: dist
merge-multiple: true

- name: Run setuptools_scm
- name: Install dependencies
run: |
python3 -m pip install --upgrade setuptools setuptools_scm[toml] setuptools-rust
python3 -m setuptools_scm --strip-dev
python3 -m pip install --upgrade uv
python3 -m uv pip install --upgrade setuptools setuptools_scm[toml] setuptools-rust wheel twine build
echo "SETUPTOOLS_SCM_PRETEND_VERSION_FOR_ARTISTOOLS=$(python3 -m setuptools_scm --strip-dev)" >> $GITHUB_ENV
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: false
skip-existing: true
verbose: false
109 changes: 0 additions & 109 deletions .github/workflows/deploytestpypi.yml

This file was deleted.

0 comments on commit fb64ed9

Please sign in to comment.