Skip to content

[geovista.ci] conda lock auto-update #404

[geovista.ci] conda lock auto-update

[geovista.ci] conda lock auto-update #404

Workflow file for this run

# Reference:
# - https://github.com/actions/cache
# - https://github.com/actions/checkout
# - https://github.com/actions/download-artifact
# - https://github.com/actions/setup-python
# - https://github.com/actions/upload-artifact
# - https://github.com/pypa/build
# - https://github.com/pypa/gh-action-pypi-publish
# - https://test.pypi.org/help/#apitoken
name: ci-wheels
on:
pull_request:
push:
branches:
- "main"
- "v*x"
- "!conda-lock-auto-update"
- "!pre-commit-ci-update-config"
- "!dependabot/*"
tags:
- "v*"
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-artifacts:
name: "build pypi artifacts"
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: "build sdist and wheel"
run: |
# slam is a pure python package, so simply use pypa/build
pipx run build
- name: "show sdist and wheel"
run: |
ls -l ${{ github.workspace }}/dist
- uses: actions/upload-artifact@v4
with:
name: pypi-artifacts-${{ github.job }}-${{ strategy.job-index }}
path: ${{ github.workspace }}/dist
test-artifacts:
needs: [build-artifacts]
name: "test wheel (${{ matrix.python-version }})"
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
env:
ENV_NAME: "ci-wheels"
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: "configure environment"
run: |
PREFIX="py$(echo '${{ matrix.python-version }}' | tr -d '.')"
echo "LOCK_FILE=requirements/locks/${PREFIX}-lock-linux-64.txt" >> ${GITHUB_ENV}
- name: "mambaforge setup (python ${{ matrix.python-version }})"
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-variant: Mambaforge
miniforge-version: latest
activate-environment: ${{ env.ENV_NAME }}
auto-update-conda: false
environment-file: ${{ env.LOCK_FILE }}
- uses: actions/download-artifact@v4
with:
pattern: pypi-artifacts-*
path: ${{ github.workspace }}/dist
merge-multiple: true
- name: "test wheel (${{ matrix.python-version }})"
run: |
WHEEL=$(ls -1 dist/*.whl)
python -m pip install --no-deps ${WHEEL}
python -c "import slam; print(f'slam version = {slam.__version__}')"
show-artifacts:
needs: [build-artifacts]
name: "show artifacts"
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
pattern: pypi-artifacts-*
path: ${{ github.workspace }}/dist
merge-multiple: true
- shell: bash
run: |
ls -l ${{ github.workspace }}/dist
publish-artifacts-test-pypi:
needs: [test-artifacts]
name: "Publish to Test PyPI"
runs-on: ubuntu-latest
# upload to Test PyPI for every commit on main branch
if: github.event_name == 'push' && github.event.ref == 'refs/heads/main'
steps:
- uses: actions/download-artifact@v4
with:
pattern: pypi-artifacts-*
path: ${{ github.workspace }}/dist
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
skip_existing: true
print_hash: true
publish-artifacts-pypi:
needs: [test-artifacts]
name: "Publish to PyPI"
runs-on: ubuntu-latest
# upload to PyPI for every tag starting with 'v'
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
steps:
- uses: actions/download-artifact@v4
with:
pattern: pypi-artifacts-*
path: ${{ github.workspace }}/dist
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
print_hash: true