Skip to content

Commit

Permalink
Merge pull request #73 from epics-extensions/release-2.0.0rc1
Browse files Browse the repository at this point in the history
Release 2.0.0rc1
  • Loading branch information
minijackson authored Dec 13, 2023
2 parents e0f0882 + bf76e98 commit e5ab8fb
Show file tree
Hide file tree
Showing 16 changed files with 122 additions and 38 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ruff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ jobs:
- uses: cachix/install-nix-action@v24
- name: "Check Ruff lints"
if: steps.changed-files.outputs.any_changed == 'true'
run: nix run 'nixpkgs#ruff' -- check . --output-format=github ${{ steps.changed-files.outputs.all_changed_files }}
run: nix run 'nixpkgs#ruff' -- check --output-format=github ${{ steps.changed-files.outputs.all_changed_files }}
70 changes: 70 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Changelog

All notable changes to this project are documented in this file.

## [2.0.0rc1] - 2023-12-13

### Highlights

This release drops support for Python 2.7.
This version should be compatible with Python 3.7 and later.

The build system was also switched to Poetry.

Nix files were also added as a way to build and test the project.

No changes were made to the scenario YAML format.
You can update the version in your YAML files to `2.0.0`.

### Bug Fixes

- Crash when creating PDF report
- Fix reader tests
- Don't run CI on every push
- Only run Ruff GitHub Action on changed Python files
- Correctly parse Python versions
- Fix Ruff action ignoring changed files

### Features

- Configure ruff in pyproject.toml
- Add ruff check as GitHub action
- Add editor config file
- Add editor config check as GitHub action
- Add support for Nix without flakes
- Add Nix build as GitHub action
- Generate Nix bundle archives on tagged releases
- Add CHANGELOG generation support with git-cliff

### Miscellaneous Tasks

- [**breaking**] convert codebase to Python 3
- [**breaking**] switch build system to Poetry
- Add Nix build
- Support more architectures with Nix, add a simple test
- Ruff format everything
- Run ruff check --fix
- Run ruff check --fix --unsafe-fixes
- Other ruff lint manual fixes
- Correct spelling toogle -> toggle
- Remove trailing whitespace, ensure final newlines
- Update README installation instructions
- README formatting and wording
- Add metadata to the Nix WeTest package
- Improve project metadata
- [**breaking**] Add pytest, bump min Python version to 3.7
- Move tests to own directory
- Don't ask compatibility question
- Link to repository instead of print changelog
- Remove non-working tests
- Rename Ruff lint action workflow, make it clearer
- Update install-nix-action in CI
- Run Nix checks instead of build on CI
- Use Python3.9 in the Nix build

### Refactor

- Make validate_file return boolean
- Rename _version_is_supported -> supports_version
- Better fetch of WeTest version
- Use semver for version comparison
2 changes: 1 addition & 1 deletion nix/checks/simple.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pkgs.nixosTest {

testScript = let
scenario = pkgs.writeText "simple.yml" ''
version: {major: 1, minor: 2, bugfix: 2}
version: {major: 2, minor: 0, bugfix: 0}
config:
type: unit
Expand Down
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "wetest"
version = "1.2.2"
version = "2.0.0rc1"
description = "WeTest enables you to test EPICS modules"
license = "EPICS"
authors = [
Expand Down Expand Up @@ -38,6 +38,7 @@ pyepics = "^3.5.1"
pykwalify = "^1.8.0"
reportlab = "^3.6.8"
semver = "^3.0.2"
packaging = "^23.2"

[tool.poetry.group.dev.dependencies]
pytest = "^7.4.3"
Expand Down Expand Up @@ -67,6 +68,8 @@ ignore = [
]

# https://git-cliff.org/docs/configuration
# Run:
# git-cliff -c pyproject.toml --bump -u --prepend CHANGELOG.md
[tool.git-cliff.changelog]
header = """
# Changelog\n
Expand Down
6 changes: 3 additions & 3 deletions tests/acceptance-demo.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version:
major: 1
minor: 2
bugfix: 2
major: 2
minor: 0
bugfix: 0

config:
type: functional
Expand Down
6 changes: 3 additions & 3 deletions tests/bad.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version:
major: 1
minor: 2
bugfix: 2
major: 2
minor: 0
bugfix: 0

config:
type: unit
Expand Down
6 changes: 3 additions & 3 deletions tests/mks946-testing.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version:
major: 1
minor: 2
bugfix: 2
major: 2
minor: 0
bugfix: 0

config:
type: unit
Expand Down
6 changes: 3 additions & 3 deletions tests/mks946.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version:
major: 1
minor: 2
bugfix: 2
major: 2
minor: 0
bugfix: 0

config:
type: unit
Expand Down
6 changes: 3 additions & 3 deletions tests/scenario_example01.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version:
major: 1
minor: 2
bugfix: 2
major: 2
minor: 0
bugfix: 0

config:
type: "unit"
Expand Down
6 changes: 3 additions & 3 deletions tests/scenario_example02.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version:
major: 1
minor: 2
bugfix: 2
major: 2
minor: 0
bugfix: 0

config: {}

Expand Down
6 changes: 3 additions & 3 deletions tests/scenario_example03.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version:
major: 1
minor: 2
bugfix: 2
major: 2
minor: 0
bugfix: 0

config:
type: functional
Expand Down
6 changes: 3 additions & 3 deletions tests/scenario_example04.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version:
major: 1
minor: 2
bugfix: 2
major: 2
minor: 0
bugfix: 0

config:
type: functional
Expand Down
6 changes: 3 additions & 3 deletions tests/scenario_example05.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version:
major: 1
minor: 2
bugfix: 2
major: 2
minor: 0
bugfix: 0

config:
type: functional
Expand Down
6 changes: 3 additions & 3 deletions tests/suite_example01.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version:
major: 1
minor: 2
bugfix: 2
major: 2
minor: 0
bugfix: 0

name: "ExampleSuite01"

Expand Down
5 changes: 1 addition & 4 deletions tests/test_testing_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@

def test_yaml_version_checker():
"""Test supported versions are well identified."""
assert ScenarioReader.supports_version(major=1, minor=0, bugfix=0)
assert ScenarioReader.supports_version(major=1, minor=1, bugfix=0)
assert ScenarioReader.supports_version(major=1, minor=2, bugfix=0)
assert ScenarioReader.supports_version(major=1, minor=2, bugfix=2)
assert ScenarioReader.supports_version(major=2, minor=0, bugfix=0)
with pytest.raises(UnsupportedFileFormatError):
ScenarioReader.supports_version(major=0, minor=0, bugfix=0)
with pytest.raises(UnsupportedFileFormatError):
Expand Down
16 changes: 15 additions & 1 deletion wetest/testing/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import sys

import yaml
from packaging.version import Version as PyPIVersion
from pkg_resources import resource_filename
from pykwalify import errors
from pykwalify.core import Core
Expand Down Expand Up @@ -57,8 +58,21 @@

WETEST_METADATA = importlib.metadata.metadata("WeTest")

def _convert2semver(ver: PyPIVersion) -> Version:
if ver.epoch != 0:
err = "Can't convert an epoch to semver"
raise ValueError(err)
if ver.post is not None:
err = "Can't convert a post part to semver"
raise ValueError(err)

pre = None if not ver.pre else "".join([str(i) for i in ver.pre])
return Version(*ver.release, prerelease=pre, build=ver.dev)

# Maximum file version supported
VERSION = Version.parse(importlib.metadata.version("WeTest"))
VERSION = _convert2semver(PyPIVersion(importlib.metadata.version("WeTest")))
# ignore pre-releases when comparing versions
VERSION = VERSION.finalize_version()

REPOSITORY = WETEST_METADATA["Home-page"]

Expand Down

0 comments on commit e5ab8fb

Please sign in to comment.