Skip to content

Update setup methods and Python version requirements #96

Update setup methods and Python version requirements

Update setup methods and Python version requirements #96

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: libstempo CI tests
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
release:
types:
- published
jobs:
tests:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ['3.8', '3.9', '3.10', '3.11']
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install tempo2 on mac
if: runner.os == 'macOS'
run: |
brew unlink gcc && brew link gcc
brew install automake libtool
./install_tempo2.sh
- name: Install tempo2 on linux
if: runner.os == 'Linux'
run: |
./install_tempo2.sh
- name: Install dependencies and package
run: |
python -m pip install --upgrade pip
pip install -e .[astropy,dev]
- name: Run lint
run: make lint
- name: Test with pytest
run: make test
build:
needs: [tests]
name: Build source distribution
runs-on: ubuntu-latest
if: github.event_name == 'release'
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.10'
- name: Install tempo2 on mac
if: runner.os == 'macOS'
run: |
brew unlink gcc && brew link gcc
brew install automake
./install_tempo2.sh
- name: Install tempo2 on linux
if: runner.os == 'Linux'
run: |
./install_tempo2.sh
- name: Build
run: |
python -m pip install --upgrade pip setuptools wheel build
python -m build --sdist --outdir dist
make dist
- name: Test the sdist
run: |
mkdir tmp
cd tmp
python -m venv venv-sdist
venv-sdist/bin/python -m pip install --upgrade pip setuptools
venv-sdist/bin/python -m pip install ../dist/libstempo*.tar.gz
venv-sdist/bin/python -c "import libstempo;print(libstempo.__version__)"
- uses: actions/upload-artifact@v2
with:
name: dist
path: dist/*
deploy:
needs: [tests, build]
runs-on: ubuntu-latest
if: github.event_name == 'release'
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Download wheel/dist from build
uses: actions/download-artifact@v2
with:
name: dist
path: dist
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
twine upload dist/*