Skip to content

[pre-commit.ci] pre-commit autoupdate #1836

[pre-commit.ci] pre-commit autoupdate

[pre-commit.ci] pre-commit autoupdate #1836

Workflow file for this run

name: package builds
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
on:
push:
branches:
- master
tags:
- '*'
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
paths-ignore:
- 'CHANGELOG.md'
- 'doc/**'
- '!.github/workflows/build.yml'
release:
types:
- published
schedule:
- cron: '0 6 * * 1'
workflow_dispatch:
jobs:
conda:
defaults:
run:
shell: bash -l {0}
if: |
(github.event.pull_request.draft == false) ||
(github.event_name == 'workflow_dispatch') ||
(github.ref == 'refs/heads/master') ||
startsWith(github.ref, 'refs/tags/') ||
(github.event_name == 'release')
name: conda build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for all tags and branches
- name: Setup Conda Environment
uses: mamba-org/setup-micromamba@v1.8.1
with:
environment-file: ./devtools/conda.recipe/build_env.yml
environment-name: build_env
init-shell: >-
bash
powershell
cache-downloads: true
- name: activate build env
run: micromamba activate build_env
- name: conda info
run: conda info
- name: conda list
run: conda list
- name: set pkg version
run: echo "SETUPTOOLS_SCM_PRETEND_VERSION=$(python -m setuptools_scm)" >> $GITHUB_ENV
- name: Build from local conda recipe
run: conda mambabuild -c conda-forge .
pypi:
if: |
(github.event.pull_request.draft == false) ||
(github.event_name == 'workflow_dispatch') ||
startsWith(github.ref, 'refs/tags/') ||
(github.event_name == 'release')
name: pypi build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for all tags and branches
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Cache pip
uses: actions/cache@v4
env:
# Increase this value to reset cache if ./setup.cfg has not changed
CACHE_NUMBER: 0
with:
path: ~/.cache/pip
key: ubuntu-latest-pip-${{ env.CACHE_NUMBER }}-${{ hashFiles('pyproject.toml') }}
- name: pip installs
run: |
python -m pip install --upgrade pip
pip install setuptools setuptools_scm wheel twine build
- name: build package + create src archive (stored in dist folder)
run: |
python -m build
- uses: actions/upload-artifact@v4
with:
name: dist
path: ./dist/
- name: get sdist file
run: echo "SDIST_FILE=$(find ./dist/*.tar.gz | head -n 1)" >> $GITHUB_ENV
- name: pip dist install
run: |
pip install ${{ env.SDIST_FILE }}[test,media]
- name: pip list
run: |
pip list
- name: run pytest
run: |
cd /tmp
pytest -n2 --dist=loadfile --pyargs weldx
cd -
- name: set pypi test repo defaults
run: |
echo "pypi_repo=testpypi" >> $GITHUB_ENV
echo "pypi_token=${{ secrets.TESTPYPI_UPLOAD }}" >> $GITHUB_ENV
- name: set pypi main repo for release
if: github.event_name == 'release'
run: |
echo "pypi_repo=pypi" >> $GITHUB_ENV
echo "pypi_token=${{ secrets.PYPI_UPLOAD }}" >> $GITHUB_ENV
- name: pypi release
if: startsWith(github.ref, 'refs/tags/') || (github.event_name == 'release')
run: |
python -m twine upload --repository $pypi_repo dist/* -u __token__ -p $pypi_token