Skip to content

Commit

Permalink
*
Browse files Browse the repository at this point in the history
  • Loading branch information
aaarrti committed Jun 15, 2023
1 parent 90a1282 commit 0c0cdf6
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 32 deletions.
27 changes: 0 additions & 27 deletions .github/workflows/pre-release.yml

This file was deleted.

3 changes: 2 additions & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
name: Python package

on:
# Run tests every night, to catch potentially breaking changes in dependencies.
schedule:
- cron: '* 8 * * *'
- cron: '0 0 * * *'
push:
branches:
- main
Expand Down
45 changes: 45 additions & 0 deletions .github/workflows/snapshot-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Python package

on:
# Publish snapshot release every night.
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
inputs:
index:
type: choice
description: Index to publish snapshot release to
options:
- https://test.pypi.org/simple/
- https://pypi.org/simple/
default: https://test.pypi.org/simple/



jobs:
build:
runs-on: ubuntu-latest
name: Pre Release
steps:
- uses: actions/checkout@v3
- name: Setup python
uses: actions/setup-python@v4
with:
cache: 'pip'
python-version: "3.10"
- name: Install tox-gh
run: pip install tox-gh
- name: Setup test environment
run: tox run --notest
- name: Test with PyTest
run: tox run
- name: Test building package
run: tox run -e build
- name: Publish package
uses: pypa/gh-action-pypi-publish/v1
env:
SNAPSHOT_RELEASE: 1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
repository-url: ${{ github.event.inputs.index }}
17 changes: 13 additions & 4 deletions quantus/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,20 @@
# You should have received a copy of the GNU Lesser General Public License along with Quantus. If not, see <https://www.gnu.org/licenses/>.
# Quantus project URL: <https://github.com/understandable-machine-intelligence-lab/Quantus>.
import subprocess
import os

commit_sha = subprocess.check_output(['git', 'rev-parse', 'HEAD']).strip().decode('utf-8')
version = subprocess.check_output(['git', 'describe', '--tags', '--always', '--dirty=-pre', commit_sha]).strip().decode('utf-8')

__version__ = version
if "SNAPSHOT_RELEASE" in os.environ:
commit_sha = (
subprocess.check_output(["git", "rev-parse", "HEAD"]).strip().decode("utf-8")
)
version = (
subprocess.check_output(["git", "describe", "--tags", "--always", commit_sha])
.strip()
.decode("utf-8")
)
__version__ = version
else:
__version__ = "0.4.1"

# Expose quantus.evaluate to the user.
from quantus.evaluation import evaluate
Expand Down
2 changes: 2 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ deps =
.
build
twine
pass_env =
SNAPSHOT_RELEASE
commands =
python3 -m build .
python3 -m twine check ./dist/* --strict
Expand Down

0 comments on commit 0c0cdf6

Please sign in to comment.