Skip to content

Commit

Permalink
Merge pull request #259 from rsagroup/publishing
Browse files Browse the repository at this point in the history
Publishing from CI
  • Loading branch information
JasperVanDenBosch authored Nov 6, 2022
2 parents 9bbaca7 + c4da990 commit 25cfa25
Show file tree
Hide file tree
Showing 8 changed files with 111 additions and 26 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@


name: Publish

on:
push:
branches:
- main
release:
types: [published]

permissions:
contents: read

jobs:
call-test-build:
uses: ./.github/workflows/testbuild.yml

publish-artifacts:
environment: production
needs: call-test-build
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v3
with:
path: artifacts
- name: List files
run: ls -R artifacts
- name: Gather artifacts
run: |
mkdir dist
mv artifacts/source/*.tar.gz dist/
mv artifacts/wheels-macos-latest/*.whl dist/
mv artifacts/wheels-ubuntu-latest/*.whl dist/
mv artifacts/wheels-windows-latest/*.whl dist/
- name: Publish package
uses: pypa/gh-action-pypi-publish@v1.5.1
with:
verbose: true
password: ${{ secrets.API_TOKEN_PYPI }}
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
name: pull_request_builds
name: Test and Build

on:
pull_request:
types: [opened, synchronize, reopened]
workflow_call:

permissions:
contents: read

jobs:

tests:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: '3.10'
Expand All @@ -35,6 +41,8 @@ jobs:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
Expand All @@ -58,6 +66,10 @@ jobs:
run: pip install -r tests/requirements.txt
- name: Unit tests
run: pytest
- name: Check package compliance
run: |
pip install -q twine
twine check dist/*
- name: Store artifact
uses: actions/upload-artifact@v3
with:
Expand All @@ -74,6 +86,8 @@ jobs:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: '3.10'
Expand All @@ -85,8 +99,10 @@ jobs:
uses: pypa/cibuildwheel@v2.11.1
with:
output-dir: dist
- name: Install test dependencies
run: pip install -r tests/requirements.txt
- name: Check package compliance
run: |
pip install -q twine
twine check dist/*
- name: Store artifact
uses: actions/upload-artifact@v3
with:
Expand Down
14 changes: 14 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ Your cycle
5. When you're done with the feature, ask for reviews from two team members or ask the maintainers for help.
6. When the reviewers have approved the Pull Request, they will merge it into the master branch. At this point you want to checkout the master branch again and pull so that you have your latest changes, and can open a new branch for a new feature.

Here is an example shell command to build rsatoolbox, install it in your environment, and run the unit tests on it, in one go:

```sh
python -m build && sleep 1 && pip install --pre --force-reinstall dist/*.whl && pytest
```


Rules
=====
Expand All @@ -22,6 +28,14 @@ Rules
or alternatively, ping @ilogue or @HeikoSchuett and we will assign reviewers.


Deployment
==========


- when a PR is merged into the branch main, it is build as a pre-release (or "development") package and uploaded to pypi. The latest pre-release version can be installed using `pip install --pre rsatoolbox`
- when a release tag is added to the branch main, the package is instead marked as a released (or "stable") version.


Naming scheme
=============

Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ Conceived during the RSA retreat 2019 in Blue Mountains.

#### Getting Started

The easiest way to install rsatoolbox is with pip:
To install the latest stable version of rsatoolbox with pip:

```sh
pip install rsatoolbox
```


here is a simple code sample:

```python
Expand Down
8 changes: 5 additions & 3 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#
import os
import sys
from pkg_resources import get_distribution
sys.path.insert(0, os.path.abspath('.'))
sys.path.insert(0, os.path.abspath('../'))

Expand All @@ -23,10 +24,11 @@
copyright = '2021, rsatoolbox authors'
author = 'rsatoolbox authors'

# The full version
release = get_distribution('rsatoolbox').version

# The short X.Y version
version = '0.0'
# The full version, including alpha/beta/rc tags
release = '0.0.5'
version = '.'.join(release.split('.')[:2])


# -- General configuration ---------------------------------------------------
Expand Down
10 changes: 9 additions & 1 deletion docs/source/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,20 @@
Getting started
===============

The easiest way to install rsatoolbox is with pip:
To install the latest release of rsatoolbox:

.. code-block:: sh
pip install rsatoolbox
To get the bleeding edge or "pre-release" version:

.. code-block:: sh
pip install --pre rsatoolbox
To use rsatoolbox:

.. code-block:: python
Expand Down
22 changes: 14 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
[build-system]
requires = [
"setuptools~=65.3",
"setuptools-scm",
"setuptools-scm[toml]~=7.0.0",
"wheel",
"numpy>=1.21.2",
"scipy",
"cython~=3.0.0a11"
"cython~=3.0.0a11",
"twine~=4.0.1"
]
build-backend = "setuptools.build_meta"

[project]
name = "rsatoolbox"
description = "Representational Similarity Analysis (RSA) in Python"
requires-python = ">=3.7,<3.11"
version = "0.0.5"
authors = [
{name="rsatoolbox authors"},
]
keywords = ["neuroscience "]
keywords = ["neuroscience"]
license = {file = "LICENSE"}
classifiers = [
'Programming Language :: Python',
Expand All @@ -31,11 +31,17 @@ classifiers = [
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
]
dynamic = ["readme", "dependencies"]
dynamic = ["readme", "dependencies", "version"]

[tool.setuptools]
packages = ["rsatoolbox"]
package-dir = {"" = "src"}
[project.urls]
homepage = "https://github.com/rsagroup/rsatoolbox"
documentation = "https://rsatoolbox.readthedocs.io/"

[tool.setuptools_scm]
local_scheme = "no-local-version"

[tool.setuptools.packages.find]
where = ["src"]

[tool.setuptools.dynamic]
readme = {file = "README.md"}
Expand Down
17 changes: 7 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
"""Setup.py now only remains as a build script for the cython extensions.
Using setup.py for other things is now deprecated:
setup.py test -> pytest
setup.py develop -> pip install -e
"""
from setuptools import setup, Extension
from Cython.Build import build_ext ## missing dev time req
from os.path import isfile
import setuptools_scm # noqa # pylint: disable=unused-import
from Cython.Build import build_ext

test_requires = []
if isfile('tests/requirements.txt'):
with open('tests/requirements.txt') as reqfile:
test_requires = reqfile.read().splitlines()

setup(
tests_require=test_requires,
test_suite='tests',
url = "https://github.com/rsagroup/rsatoolbox",
zip_safe = False,
ext_modules = [
Extension(
"rsatoolbox.cengine.similarity",
Expand Down

0 comments on commit 25cfa25

Please sign in to comment.