Skip to content

Commit

Permalink
Merge pull request #58 from sissaschool/release/1.0.0
Browse files Browse the repository at this point in the history
Release SporTran `v1.0.0rc1`
  • Loading branch information
rikigigi authored and lorisercole committed Mar 3, 2022
2 parents e668980 + 71dd3c4 commit 6abc44e
Show file tree
Hide file tree
Showing 148 changed files with 207,494 additions and 44,824 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/check_release_tag.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
"""Check that the GitHub release tag matches the package version."""
import argparse
import json

if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('GITHUB_REF', help='The GITHUB_REF environmental variable')
parser.add_argument('SETUP_PATH', help='Path to the setup.json')
args = parser.parse_args()
assert args.GITHUB_REF.startswith('refs/tags/v'), f'GITHUB_REF should start with "refs/tags/v": {args.GITHUB_REF}'
tag_version = args.GITHUB_REF[11:]
with open(args.SETUP_PATH, encoding='utf8') as handle:
data = json.load(handle)
pypi_version = data['version']
assert tag_version == pypi_version, f'The tag version {tag_version} != {pypi_version} specified in `setup.json`'
69 changes: 69 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: continuous-integration

on: [push, pull_request]

jobs:
pre-commit:

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Cache python dependencies
id: cache-pip
uses: actions/cache@v1
with:
path: ~/.cache/pip
key: pip-pre-commit-${{ hashFiles('**/setup.json') }}
restore-keys:
pip-pre-commit-

- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install python dependencies
run:
pip install -e .[pre-commit,tests]

- name: Run pre-commit
run:
pre-commit run --all-files || ( git status --short ; git diff ; exit 1 )

tests:

runs-on: ubuntu-latest

strategy:
matrix:
python-version: [3.6, 3.7, 3.8]

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Cache python dependencies
id: cache-pip
uses: actions/cache@v1
with:
path: ~/.cache/pip
key: pip-pre-commit-${{ hashFiles('**/setup.json') }}
restore-keys:
pip-pre-commit-

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install python dependencies
run: |
pip install --upgrade setuptools
pip install -e .[tests]
- name: Test with pytest
run: |
pytest -sv tests
115 changes: 115 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
name: release

# Automate deployment to PyPI when creating a release tag vX.Y.Z
# will only be published to PyPI if the git tag matches the release version
# and the pre-commit and tests pass

on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+*"
jobs:

check-release-tag:

# Only run this job on the main repository and not on forks
if: github.repository == 'sissaschool/sportran'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: '3.8'
- run: python .github/workflows/check_release_tag.py $GITHUB_REF setup.json

pre-commit:

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Cache python dependencies
id: cache-pip
uses: actions/cache@v1
with:
path: ~/.cache/pip
key: pip-pre-commit-${{ hashFiles('**/setup.json') }}
restore-keys:
pip-pre-commit-

- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install python dependencies
run:
pip install -e .[pre-commit,tests]

- name: Run pre-commit
run:
pre-commit run --all-files || ( git status --short ; git diff ; exit 1 )

tests:

runs-on: ubuntu-latest

strategy:
matrix:
python-version: [3.6, 3.7, 3.8]

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Cache python dependencies
id: cache-pip
uses: actions/cache@v1
with:
path: ~/.cache/pip
key: pip-pre-commit-${{ hashFiles('**/setup.json') }}
restore-keys:
pip-pre-commit-

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install python dependencies
run: |
pip install --upgrade setuptools
pip install -e .[tests]
- name: Test with pytest
run: |
pytest -sv tests
publish:

name: Publish to PyPI

needs: [check-release-tag, pre-commit, tests]

runs-on: ubuntu-latest

steps:
- name: Checkout source
uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: '3.8'
- name: Build package
run: |
pip install wheel
python setup.py sdist bdist_wheel
- name: Publish to PyPI
uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_SPORTRAN }}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ wheels/
*.egg-info/
.installed.cfg
*.egg
metadata.json

# PyInstaller
# Usually these files are written by a python script from a template
Expand All @@ -46,6 +47,9 @@ coverage.xml
*.cover
.hypothesis/

# Visual Studio Code
.vscode/

# Translations
*.mo
*.pot
Expand Down
36 changes: 20 additions & 16 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Install pre-commit hooks via
# pre-commit install

repos:
- repo: local
hooks:
# yapf = yet another python formatter
Expand All @@ -12,13 +13,15 @@
args: ["-i"]
exclude: &exclude_files >
(?x)^(
thermocepstrum_gui/utils/tk_html_widgets/*.py|
sportran/utils/obsolete/.*|
sportran_gui/utils/tk_html_widgets/*.py|
docs/.*|
tests/test_cli/.*|
examples/.*|
setup.py|
)$

- repo: git://github.com/pre-commit/pre-commit-hooks
- repo: https://github.com/pre-commit/pre-commit-hooks.git
rev: v2.3.0
hooks:
- id: check-yaml
Expand All @@ -28,24 +31,25 @@
- id: check-executables-have-shebangs
- id: double-quote-string-fixer
- id: end-of-file-fixer
exclude: >
(?x)^(
tests/test_cli/.*|
sportran/utils/obsolete/.*|
)$
- id: trailing-whitespace
exclude: >
(?x)^(
thermocepstrum_gui/utils/tk_html_widgets/*.py|
sportran/utils/obsolete/.*|
sportran_gui/utils/tk_html_widgets/.*py|
docs/.*|
tests/test_cli/.*|
tests/test_notebooks/.*|
examples/.*|
)$
# # prospector: collection of linters
# - id: prospector
# language: system
# types: [file, python]
# name: prospector
# description: "This hook runs Prospector: https://github.com/landscapeio/prospector"
# entry: prospector
#
# - id: version-number
# name: Check version numbers
# entry: python ./.travis-data/check_version.py
# language: system
# files: '^(setup.json)|(aiida_diff/__init__.py)'
#- repo: https://github.com/PyCQA/pylint
# rev: v2.12.2
# hooks:
# - id: pylint
# language: system
# exclude: *exclude_files
32 changes: 32 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the version of Python and other tools you might need
build:
os: ubuntu-20.04
tools:
python: "3.9"
# You can also specify other tool versions:
# nodejs: "16"
# rust: "1.55"
# golang: "1.17"

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/source/conf.py

# If using Sphinx, optionally build your docs in additional formats such as PDF
# formats:
# - pdf

# Optionally declare the Python requirements required to build your docs
python:
install:
- method: pip
path: .
extra_requirements:
- doc
File renamed without changes.
16 changes: 8 additions & 8 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
recursive-include examples *
include LICENSE.txt
include setup.json
include thermocepstrum/README.md
include thermocepstrum/metadata.json
include thermocepstrum/utils/plot_style.mplstyle
exclude thermocepstrum/utils/blocks.py
exclude thermocepstrum/utils/blockanalysis.py
include thermocepstrum_gui/README_GUI.md
include thermocepstrum_gui/assets/icon.gif
include thermocepstrum_gui/assets/languages.json
include sportran/README.md
include sportran/metadata.json
include sportran/utils/plot_style.mplstyle
exclude sportran/utils/blocks.py
exclude sportran/utils/blockanalysis.py
include sportran_gui/README_GUI.md
include sportran_gui/assets/icon.gif
include sportran_gui/assets/languages.json
Loading

0 comments on commit 6abc44e

Please sign in to comment.