Skip to content

Commit

Permalink
versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
jgoeders committed Feb 12, 2024
1 parent d550698 commit 6ed3c87
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
IN_ENV := . .venv/bin/activate;

env:
python3 -m venv .venv

check_version_increase:
$(IN_ENV) pip uninstall -y yinstruments
$(IN_ENV) pip install yinstruments
$(IN_ENV) echo `python print_version.py` > pypi_version.txt
$(IN_ENV) pip uninstall -y yinstruments
$(IN_ENV) pip install ..
$(IN_ENV) echo `python print_version.py` > current_version.txt
$(IN_ENV) pip uninstall -y yinstruments
$(IN_ENV) python compare_versions.py pypi_version.txt current_version.txt
13 changes: 13 additions & 0 deletions .github/compare_versions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import sys
from packaging import version

pypi_version_path = sys.argv[1]
this_version_path = sys.argv[2]

pypi_version = version.parse(open(pypi_version_path).read())
this_version = version.parse(open(this_version_path).read())

if this_version <= pypi_version:
raise Exception(
f"This version ({this_version}) is not greater than the pypi version ({pypi_version})"
)
4 changes: 4 additions & 0 deletions .github/print_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import pkg_resources # part of setuptools

version = pkg_resources.require("yaccounts")[0].version
print(version)
19 changes: 19 additions & 0 deletions .github/workflows/versioning.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Versioning Check

on:
pull_request:


jobs:
version_check:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Environment
run: cd .github && make env

- name: Check version increase
run: cd .github && make check_version_increase

0 comments on commit 6ed3c87

Please sign in to comment.