Skip to content

Merge pull request #37 from Digiratory/add-example-for-multiscale-ana… #44

Merge pull request #37 from Digiratory/add-example-for-multiscale-ana…

Merge pull request #37 from Digiratory/add-example-for-multiscale-ana… #44

name: Test and release
on:
push:
tags:
- 'release/[0-9]+.[0-9]+.[0-9]+*'
jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.11"]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies on MacOS
if: matrix.os == 'macos-latest'
shell: bash
run: |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install numpy scipy
python -m pip install --upgrade pip wheel setuptools
pip install -r requirements.txt
pip install pytest
- name: Install dependencies
if: matrix.os != 'macos-latest'
shell: bash
run: |
python -m pip install --upgrade pip wheel
pip install -r requirements.txt
pip install pytest
- name: Install FluctuationAnalysisTools
shell: bash
run: |
pip install .
- name: Run tests
run: |
pytest tests/
build-wheels:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.11"]
fail-fast: false
runs-on: ${{ matrix.os }}
needs: test
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install build dependencies
run: |
python -m pip install --upgrade pip setuptools wheel build setuptools-scm
- name: Build wheels
if: matrix.os != 'ubuntu-latest'
run: |
python -m build --wheel --outdir wheelhouse
- name: Repair Linux wheels
if: matrix.os == 'ubuntu-latest'
run: |
python -m build --sdist --outdir sdisthouse
- name: Upload wheels as artifacts
uses: actions/upload-artifact@v4
with:
name: fluctuation-analysis-tools-${{ matrix.os }}-${{ matrix.python-version }}
path: ./wheelhouse/*.whl
- name: Upload sdist as artifacts
uses: actions/upload-artifact@v4
with:
name: fluctuation-analysis-tools-${{ matrix.os }}-${{ matrix.python-version }}
path: ./sdisthouse/*.tar.gz
deploy:
runs-on: ubuntu-latest
needs: build-wheels
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Get release name
id: get-release
run: |
TAG=$(git describe --tags --abbrev=0)
RELEASE_NAME=$(echo "$TAG" | sed 's|^release/||')
echo "tag=$TAG" >> $GITHUB_OUTPUT
echo "release_name=$RELEASE_NAME" >> $GITHUB_OUTPUT
- name: Download sdist artifact
uses: actions/download-artifact@v4
with:
pattern: fluctuation-analysis-tools-*.tar.gz
path: ./artifacts
- name: Download wheels artifact
uses: actions/download-artifact@v4
with:
pattern: fluctuation-analysis-tools-*
path: ./artifacts
- name: Copy .whl files to dist directory
run: |
mkdir -p dist
find ./artifacts -name "*.whl" -exec cp {} ./dist \;
- name: Copy .tar.gz files to dist directory
run: |
mkdir -p dist
find ./artifacts -name "*.tar.gz" -exec cp {} ./dist \;
- name: Create Github Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.get-release.outputs.tag }}
name: fluctuation-analysis-tools ${{ steps.get-release.outputs.release_name }}
draft: false
prerelease: false
body: |
This release was created based on the tag **${{ steps.get-release.outputs.tag }}**.
files: |
./dist/*.whl
./dist/*.tar.gz
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}