From 9f824d310cc3c25b9465e2a0c83ebc4b8e7ebcee Mon Sep 17 00:00:00 2001 From: Adam Janovsky Date: Mon, 25 Apr 2022 21:42:33 +0200 Subject: prepare draft release on commit (just testing) --- .github/workflows/draft_release.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/workflows/draft_release.yml (limited to '.github/workflows/draft_release.yml') diff --git a/.github/workflows/draft_release.yml b/.github/workflows/draft_release.yml new file mode 100644 index 00000000..32d058f0 --- /dev/null +++ b/.github/workflows/draft_release.yml @@ -0,0 +1,21 @@ +name: Main + +on: + push: + # branches: + # - "main" + # tags: + # - "*.*.*" + # Uncomment after testing + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Release + uses: softprops/action-gh-release@v1 + with: + draft: true + generate_release_notes: true -- cgit v1.3.1 From 66cadc5e78556de4f9c6ba684e74f1e776449b05 Mon Sep 17 00:00:00 2001 From: Adam Janovsky Date: Mon, 25 Apr 2022 21:59:46 +0200 Subject: limit release draft on main and tagged commits --- .github/workflows/draft_release.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to '.github/workflows/draft_release.yml') diff --git a/.github/workflows/draft_release.yml b/.github/workflows/draft_release.yml index 32d058f0..99638f49 100644 --- a/.github/workflows/draft_release.yml +++ b/.github/workflows/draft_release.yml @@ -1,12 +1,11 @@ -name: Main +name: Create release draft on: push: - # branches: - # - "main" - # tags: - # - "*.*.*" - # Uncomment after testing + branches: + - "main" + tags: + - "*.*.*" jobs: build: -- cgit v1.3.1 From 09d65719c133a2c5b378f0ca95e6d4c2cffe60e8 Mon Sep 17 00:00:00 2001 From: Adam Janovsky Date: Mon, 25 Apr 2022 22:54:32 +0200 Subject: alpha version file --- .github/workflows/draft_release.yml | 24 +++++++++++++++++++----- VERSION | 1 + 2 files changed, 20 insertions(+), 5 deletions(-) create mode 100644 VERSION (limited to '.github/workflows/draft_release.yml') diff --git a/.github/workflows/draft_release.yml b/.github/workflows/draft_release.yml index 99638f49..1d18367f 100644 --- a/.github/workflows/draft_release.yml +++ b/.github/workflows/draft_release.yml @@ -2,13 +2,27 @@ name: Create release draft on: push: - branches: - - "main" - tags: - - "*.*.*" + # branches: + # - "main" + # tags: + # - "*.*.*" jobs: - build: + check-version: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Read VERSION file + run: echo "ACTUAL_VERSION=$(cat VERSION)" >> $GITHUB_ENV + - name: Check versions + run: | + if (!(${{env.PACKAGE_NUMBER}} = ${{github.ref_name}})) ; then + echo "Tag does not match version number in VERSION file" + exit 1 + fi + + draft-release: runs-on: ubuntu-latest steps: - name: Checkout diff --git a/VERSION b/VERSION new file mode 100644 index 00000000..1750564f --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.0.6 -- cgit v1.3.1 From 5299ce3fb27a7c20601bf0cb62355fa9fdb5058f Mon Sep 17 00:00:00 2001 From: Adam Janovsky Date: Mon, 25 Apr 2022 22:56:02 +0200 Subject: fix version check --- .github/workflows/draft_release.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to '.github/workflows/draft_release.yml') diff --git a/.github/workflows/draft_release.yml b/.github/workflows/draft_release.yml index 1d18367f..8cc05eba 100644 --- a/.github/workflows/draft_release.yml +++ b/.github/workflows/draft_release.yml @@ -17,11 +17,10 @@ jobs: run: echo "ACTUAL_VERSION=$(cat VERSION)" >> $GITHUB_ENV - name: Check versions run: | - if (!(${{env.PACKAGE_NUMBER}} = ${{github.ref_name}})) ; then + if (!(${{env.PACKAGE_NUMBER}} == ${{github.ref_name}})) ; then echo "Tag does not match version number in VERSION file" exit 1 fi - draft-release: runs-on: ubuntu-latest steps: -- cgit v1.3.1 From 51f3120a9b33a8e4d303c76a6e39bed13f679f71 Mon Sep 17 00:00:00 2001 From: Adam Janovsky Date: Mon, 25 Apr 2022 23:07:03 +0200 Subject: . --- .github/workflows/draft_release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.github/workflows/draft_release.yml') diff --git a/.github/workflows/draft_release.yml b/.github/workflows/draft_release.yml index 8cc05eba..4490c0d0 100644 --- a/.github/workflows/draft_release.yml +++ b/.github/workflows/draft_release.yml @@ -17,7 +17,7 @@ jobs: run: echo "ACTUAL_VERSION=$(cat VERSION)" >> $GITHUB_ENV - name: Check versions run: | - if (!(${{env.PACKAGE_NUMBER}} == ${{github.ref_name}})) ; then + if ((${{env.PACKAGE_NUMBER}} != ${{github.ref_name}})) ; then echo "Tag does not match version number in VERSION file" exit 1 fi -- cgit v1.3.1 From 2ada5810445ff7122c585752c8d01e712a395394 Mon Sep 17 00:00:00 2001 From: Adam Janovsky Date: Tue, 26 Apr 2022 08:21:14 +0200 Subject: . --- .github/workflows/docs.yml | 16 ++++++++++++---- .github/workflows/draft_release.yml | 21 ++++----------------- .gitignore | 2 ++ CONTRIBUTING.md | 23 +++++++++++++++++++---- VERSION | 1 - docs/conf.py | 8 ++++---- pyproject.toml | 26 +++++++++++++++----------- requirements/requirements.in | 1 + requirements/requirements.txt | 8 ++++++++ setup.py | 2 -- 10 files changed, 65 insertions(+), 43 deletions(-) delete mode 100644 VERSION (limited to '.github/workflows/draft_release.yml') diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 4971a49d..056153c8 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -6,8 +6,16 @@ jobs: docs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - uses: ammaraskar/sphinx-action@master + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 with: - pre-build-command: python -m pip install -r requirements/dev_requirements.txt - docs-folder: "docs/" + python-version: 3.8 + - name: Install sec-certs and deps + run: | + pip install -r requirements/requirements.txt + pip install -r requirements/dev_requirements.txt + pip install -e . + - name: Build docs + run: | + cd docs + make html diff --git a/.github/workflows/draft_release.yml b/.github/workflows/draft_release.yml index 4490c0d0..95e2cadc 100644 --- a/.github/workflows/draft_release.yml +++ b/.github/workflows/draft_release.yml @@ -2,25 +2,12 @@ name: Create release draft on: push: - # branches: - # - "main" - # tags: - # - "*.*.*" + branches: + - "main" + tags: + - "*.*.*" jobs: - check-version: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Read VERSION file - run: echo "ACTUAL_VERSION=$(cat VERSION)" >> $GITHUB_ENV - - name: Check versions - run: | - if ((${{env.PACKAGE_NUMBER}} != ${{github.ref_name}})) ; then - echo "Tag does not match version number in VERSION file" - exit 1 - fi draft-release: runs-on: ubuntu-latest steps: diff --git a/.gitignore b/.gitignore index 3176de71..1d2da538 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,8 @@ # results folder results*/ +# version file by setuptools-scm +sec_certs/_version.py # Byte-compiled / optimized / DLL files __pycache__/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index afefc20b..80585c2d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -25,11 +25,26 @@ Requirements are maintained with [pip-tools](https://github.com/jazzband/pip-too - Additionally, [compile.sh](https://github.com/crocs-muni/sec-certs/blob/main/requirements/compile.sh) script is used to compile pinned versions of requirements that reside in `.txt` files in the same folder. - Tests, linting and Docker all run against this reproducible environment of pinned requirements. -## Branches and releases +## Branches + +`main` is the default branch against which all pull requests are to be made. This branch is not neccessarily stable, only the releases are. + +## Releases and version strings + +- On each revision pushed onto `main` that has `*.*.*` tag, a draft release is created with prepared changelog (this step can be skipped and the Release created right from the GitHub GUI). +- This draft release is to be published manually by the maintainer. +- Version string is not indexed in `git` but can be retreived maintained by `setuptools-scm` from git tags instead. +- `setuptools-scm` will automatically, upon editable/real install of a package, infer its version and write it to `sec_certs/_version.py`. This file is not indexed as well. See more at [setuptools-scm GitHub](https://github.com/pypa/setuptools_scm) +- On publishing a release, the tool is automatically published to [PyPi](https://pypi.org/project/sec-certs/) and [DockerHub](https://hub.docker.com/repository/docker/seccerts/sec-certs). + +Note on single-sourcing the package version: More can be read [here](https://packaging.python.org/en/latest/guides/single-sourcing-package-version/). The downside of our approach is that `.git` folder and editable/real install is needed to infer the version of the package. Releases can be infered without installing the project. + +### Currently, the release process is as follows + +1. (skip this optionally) Tag a revision with `*.*.*` tag -- this will create a draft release in GitHub. +2. Modify changelog and publish the release (or create it from scratch with new tag). +3. This will automatically update PyPi and DockerHub packages. -- `main` is the default branch against which all pull requests are to be made. This branch is not neccessarily stable, only the releases are. -- [Releases](https://github.com/crocs-muni/sec-certs/releases) are prepared manually by tagging revisions of `main` branch with `x.y.z` according to [semantic versioning](https://semver.org). -- Upon each release, the tool is automatically published to [PyPi](https://pypi.org/project/sec-certs/) and [DockerHub](https://hub.docker.com/repository/docker/seccerts/sec-certs). ## Quality assurance diff --git a/VERSION b/VERSION deleted file mode 100644 index 1750564f..00000000 --- a/VERSION +++ /dev/null @@ -1 +0,0 @@ -0.0.6 diff --git a/docs/conf.py b/docs/conf.py index 092fe3c4..6eb14738 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -12,8 +12,8 @@ # # import os # import sys -# sys.path.insert(0, os.path.abspath('.')) - +# sys.path.insert(0, os.path.abspath(".")) +from importlib.metadata import version # -- Project information ----------------------------------------------------- @@ -22,8 +22,8 @@ copyright = "2022, Adam Janovsky, Petr Svenda, Jan Jancar, Jiri Michalik, Stanis author = "Adam Janovsky, Petr Svenda, Jan Jancar, Jiri Michalik, Stanislav Bobon" # The full version, including alpha/beta/rc tags -release = "0.0.4" - +# Note thas this inference won't work from Docker: https://github.com/pypa/setuptools_scm/#usage-from-docker +release = version("sec-certs") # -- General configuration --------------------------------------------------- diff --git a/pyproject.toml b/pyproject.toml index 7ac509d6..6bae9df8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,9 @@ +[build-system] +requires = ["setuptools>=45", "setuptools_scm[toml]>=6.2"] + +[tool.setuptools_scm] +write_to = "sec_certs/_version.py" + [tool.black] line-length = 120 exclude = ''' @@ -16,21 +22,19 @@ exclude = ''' ''' [tool.isort] -multi_line_output=3 -include_trailing_comma=true -force_grid_wrap=0 -use_parentheses=true -ensure_newline_before_comments=true -line_length=120 -skip=["certsvenv", "build"] +multi_line_output = 3 +include_trailing_comma = true +force_grid_wrap = 0 +use_parentheses = true +ensure_newline_before_comments = true +line_length = 120 +skip = ["certsvenv", "build"] [tool.mypy] plugins = ["numpy.typing.mypy_plugin"] ignore_missing_imports = true -exclude="build/" +exclude = "build/" [tool.pytest.ini_options] -markers = [ - "slow: marks tests as slow (deselect with '-m \"not slow\"')" -] +markers = ["slow: marks tests as slow (deselect with '-m \"not slow\"')"] addopts = "--cov sec_certs" diff --git a/requirements/requirements.in b/requirements/requirements.in index f7fc03a3..4b67a179 100644 --- a/requirements/requirements.in +++ b/requirements/requirements.in @@ -19,3 +19,4 @@ requests scikit-learn tabula-py tqdm +setuptools-scm diff --git a/requirements/requirements.txt b/requirements/requirements.txt index f72cd3f3..a66833ac 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -50,6 +50,7 @@ packaging==21.3 # via # matplotlib # pikepdf + # setuptools-scm pandas==1.4.2 # via # -r requirements.in @@ -88,6 +89,8 @@ scikit-learn==1.0.2 # via -r requirements.in scipy==1.8.0 # via scikit-learn +setuptools-scm==6.4.2 + # via -r requirements.in six==1.16.0 # via # html5lib @@ -98,6 +101,8 @@ tabula-py==2.3.0 # via -r requirements.in threadpoolctl==3.1.0 # via scikit-learn +tomli==2.0.1 + # via setuptools-scm tqdm==4.64.0 # via -r requirements.in urllib3==1.26.9 @@ -106,3 +111,6 @@ webencodings==0.5.1 # via html5lib zipp==3.8.0 # via importlib-resources + +# The following packages are considered to be unsafe in a requirements file: +# setuptools diff --git a/setup.py b/setup.py index 802dc9c9..79c76d9b 100644 --- a/setup.py +++ b/setup.py @@ -5,8 +5,6 @@ setup( name="sec-certs", author="Petr Svenda, Stanislav Bobon, Jan Jancar, Adam Janovsky, Jiri Michalik", author_email="svenda@fi.muni.cz", - version_config=True, - setup_requires=["setuptools-git-versioning"], packages=find_packages(), license="MIT", description="Tool for analysis of security certificates", -- cgit v1.3.1