Skip to content

Maintenance; bump versions #444

Maintenance; bump versions

Maintenance; bump versions #444

Workflow file for this run

name: linux
# Only build PRs, the main branch, and releases.
on:
pull_request:
push:
branches:
- main
release:
types:
- published
schedule:
- cron: "14 14 20 * *"
# Use bash by default in all jobs
defaults:
run:
# Using "-l {0}" is necessary for conda environments to be activated
# But this breaks on MacOS if using actions/setup-python:
# https://github.com/actions/setup-python/issues/132
shell: bash
jobs:
test:
name: ${{ matrix.case.os }} py${{ matrix.case.python-version }} ${{ matrix.case.name }}
runs-on: ${{ matrix.case.os }}-latest
strategy:
fail-fast: false
matrix:
os: [ubuntu, ] # macos, windows] # Only Linux currently.
case:
- python-version: "3.9"
name: minimal
os: ubuntu
conda: "'scipy=1.8' 'numba=0.53'"
- python-version: "3.10"
name: full
os: ubuntu
conda: "numba scipy xarray empymod h5py scooby discretize matplotlib" # tqdm
- python-version: "3.10"
name: plain
os: ubuntu
conda: "numba scipy"
- python-version: "3.11"
name: plain
os: ubuntu
conda: "numba scipy"
- python-version: "3.11"
name: full
os: ubuntu
conda: "numba scipy xarray tqdm empymod h5py scooby discretize matplotlib"
- python-version: "3.12"
name: plain
os: ubuntu
conda: "numba scipy"
- python-version: "3.12"
name: full
os: ubuntu
conda: "numba scipy xarray tqdm empymod h5py scooby discretize matplotlib"
env:
# Used to for coveralls flag
OS: ${{ matrix.case.os }}
PYTHON: ${{ matrix.case.python-version }}
steps:
# Cancel any previous run of the test job; [pin v0.12.1 (2024-01-25)]
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa
with:
access_token: ${{ github.token }}
# Checks-out your repository under $GITHUB_WORKSPACE
- name: Checkout
uses: actions/checkout@v2
with:
# Need to fetch more than the last commit so that setuptools-scm can
# create the correct version string. If the number of commits since
# the last release is greater than this, the version still be wrong.
# Increase if necessary.
fetch-depth: 100
# The GitHub token is preserved by default but this job doesn't need
# to be able to push to GitHub.
persist-credentials: false
# Need the tags so that setuptools-scm can form a valid version number
- name: Fetch git tags
run: git fetch origin 'refs/tags/*:refs/tags/*'
- name: Setup miniconda
# [pin v3.0.1 (2023-11-29)]
uses: conda-incubator/setup-miniconda@11b562958363ec5770fef326fe8ef0366f8cbf8a
with:
auto-update-conda: true
python-version: ${{ matrix.case.python-version }}
miniforge-version: "latest"
miniforge-variant: Mambaforge
use-mamba: true
- name: Install dependencies
shell: bash -l {0}
run: |
conda config --set always_yes yes --set changeps1 no
conda config --show-sources
conda config --show
conda info -a
conda install ${{ matrix.case.conda }} pytest pytest-cov pytest-console-scripts coveralls flake8 setuptools-scm
- name: Conda list
shell: bash -l {0}
run: conda list
- name: Flake8
shell: bash -l {0}
run: flake8 docs/ setup.py emg3d/ tests/
- name: Test with pytest
shell: bash -l {0}
run: |
python -m pip install .
pytest --cov=emg3d
- name: Coveralls
# [pin v20201129]
uses: AndreMiras/coveralls-python-action@f5fd5c309b39d01599fb92c72d4f7409ea78aec9
with:
parallel: true
flag-name: ${{ matrix.case.python-version }} ${{ matrix.case.name }} (${{ matrix.case.os }})
coveralls_finish:
needs: test
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
# [pin v20201129]
uses: AndreMiras/coveralls-python-action@f5fd5c309b39d01599fb92c72d4f7409ea78aec9
with:
parallel-finished: true
deploy:
needs: test
name: Deploy to PyPI
runs-on: ubuntu-latest
# Only from the origin repository, not forks; only main and tags.
if: github.repository_owner == 'emsig' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/'))
steps:
# Checks-out your repository under $GITHUB_WORKSPACE
- name: Checkout
uses: actions/checkout@v2
with:
# Need to fetch more than the last commit so that setuptools-scm can
# create the correct version string. If the number of commits since
# the last release is greater than this, the version will still be
# wrong. Increase if necessary.
fetch-depth: 100
# The GitHub token is preserved by default but this job doesn't need
# to be able to push to GitHub.
persist-credentials: false
# Need the tags so that setuptools-scm can form a valid version number
- name: Fetch git tags
run: git fetch origin 'refs/tags/*:refs/tags/*'
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: "3.9"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install build setuptools-scm
- name: Build source and wheel distributions
if: github.ref == 'refs/heads/main'
run: |
# Change setuptools-scm local_scheme to "no-local-version" so the
# local part of the version isn't included, making the version string
# compatible with Test PyPI.
sed --in-place 's/"root"/"local_scheme":"no-local-version","root"/g' setup.py
- name: Build source and wheel distributions
run: |
# Build source and wheel packages
python -m build
echo ""
echo "Generated files:"
ls -lh dist/
- name: Publish to Test PyPI
if: success()
# Hash corresponds to v1.4.1
uses: pypa/gh-action-pypi-publish@54b39fb9371c0b3a6f9f14bb8a67394defc7a806
with:
user: __token__
password: ${{ secrets.TEST_PYPI_PASSWORD }}
repository_url: https://test.pypi.org/legacy/
# Allow existing releases on test PyPI without errors.
# NOT TO BE USED in PyPI!
skip_existing: true
- name: Publish to PyPI
# Only for releases
if: success() && github.event_name == 'release'
# Hash corresponds to v1.4.1
uses: pypa/gh-action-pypi-publish@54b39fb9371c0b3a6f9f14bb8a67394defc7a806
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}