Skip to content

add fetch tags

add fetch tags #17

Workflow file for this run

name: Build and upload to PyPI
on:
pull_request:
branches:
- "package-*"
push:
branches:
- "package-*"
tags:
- "package-*"
release:
types:
- published
schedule:
# 3 am Tuesdays and Fridays
- cron: "0 3 * * 2,5"
concurrency:
group: "${{ github.ref }}-${{ github.head_ref }}-${{ github.workflow }}"
cancel-in-progress: true
defaults:
run:
shell: bash -l {0}
jobs:
build_wheels:
if: "github.repository == 'lilyminium/lipyds'"
name: Build wheels
runs-on: ${{ matrix.buildplat[0] }}
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
buildplat:
- [ubuntu-22.04, manylinux_x86_64, x86_64]
- [macos-12, macosx_*, x86_64]
- [macos-14, macosx_*, arm64]
python: ["cp310", "cp311", "cp312", "cp313"]
defaults:
run:
working-directory: .
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: See versioning
run: git describe
- name: Build wheels
uses: pypa/[email protected]
with:
package-dir: .
env:
CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }}
CIBW_ARCHS: ${{ matrix.buildplat[2] }}
CIBW_BUILD_VERBOSITY: 1
- name: upload artifacts
if: |
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/package')) ||
(github.event_name == 'release' && github.event.action == 'published')
uses: actions/upload-artifact@v3
with:
path: wheelhouse/*.whl
retention-days: 7
build_sdist:
if: "github.repository == 'lilyminium/lipyds'"
name: build package source distribution
runs-on: ubuntu-latest
timeout-minutes: 10
defaults:
run:
working-directory: .
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Build sdist
run: pipx run build --sdist
- name: upload artifacts
if: |
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/package')) ||
(github.event_name == 'release' && github.event.action == 'published')
uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz
retention-days: 7
upload_testpypi_lipyds:
if: |
github.repository == 'lilyminium/lipyds' &&
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/package'))
name: testpypi_upload_lipyds
environment:
name: deploy
url: https://test.pypi.org/p/lipyds
permissions:
id-token: write
runs-on: ubuntu-latest
needs: [build_wheels, build_sdist]
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist
- name: upload_source_and_wheels
uses: pypa/[email protected]
with:
skip_existing: true
repository_url: https://test.pypi.org/legacy/
upload_pypi_lipyds:
if: |
github.repository == 'lilyminium/lipyds' &&
github.event_name == 'release' && github.event.action == 'published'
name: pypi_upload_lipyds
environment:
name: deploy
url: https://pypi.org/p/lipyds
permissions:
id-token: write
runs-on: ubuntu-latest
needs: [build_wheels, build_sdist]
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist
- name: upload_source_and_wheels
uses: pypa/[email protected]
check_testpypi:
if: |
github.repository == 'lilyminium/lipyds' &&
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/package'))
name: testpypi check
runs-on: ${{ matrix.os }}
timeout-minutes: 60
needs: [upload_testpypi_lipyds]
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ["3.10", "3.11", "3.12", "3.13"]
env:
MPLBACKEND: agg
steps:
- uses: actions/checkout@v4
- name: setup_micromamba
uses: mamba-org/setup-micromamba@v2
with:
environment-name: mda
environment-file: devtools/conda-envs/test_env.yaml
create-args: >-
python=${{ matrix.python-version }}
packaging
pip
condarc: |
channels:
- conda-forge
- name: install_from_pip
run: |
ver=$(awk '/__version__ =/ {print $3}' lipyds/_version.py)
echo "Installing version $ver"
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple lipyds==$ver
- name: run_tests
run: |
pytest --timeout=200 -n auto --pyargs lipyds.tests