diff --git a/.github/workflows/build_and_tests.yml b/.github/workflows/build_and_tests.yml index 462d880..2914da3 100644 --- a/.github/workflows/build_and_tests.yml +++ b/.github/workflows/build_and_tests.yml @@ -23,6 +23,7 @@ jobs: name: Build, install and test the Ledgered Python package runs-on: ubuntu-latest strategy: + fail-fast: false matrix: python_version: ['3.8', '3.9', '3.10', '3.11'] steps: @@ -43,9 +44,10 @@ jobs: run: pytest -v --tb=short tests/ --cov ledgered --cov-report xml - name: Upload coverage to Codecov - uses: codecov/codecov-action@v1 + uses: codecov/codecov-action@v4 with: name: codecov-ledgered + token: ${{ secrets.CODECOV_TOKEN }} package_and_deploy: diff --git a/CHANGELOG.md b/CHANGELOG.md index 941d19e..8af414b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [0.5.0] - 2024-??-?? +### Added + +- ledger-manifest: "Europa" is now a valid `app.devices` value. + ### Removed - BREAKING: removing references to `LegacyManifest` and `RepoManifest`. Only `Manifest` is to be diff --git a/src/ledgered/manifest/cli.py b/src/ledgered/manifest/cli.py index 18d9db9..c1a8f56 100644 --- a/src/ledgered/manifest/cli.py +++ b/src/ledgered/manifest/cli.py @@ -165,14 +165,12 @@ def main(): # pragma: no cover display_content["tests"]["dependencies"] = dependencies if args.output_tests_unit_directory: - if repo_manifest.tests is None or repo_manifest.tests.unit_directory is None or str( - repo_manifest.tests.unit_directory) is None: + if repo_manifest.tests is None or repo_manifest.tests.unit_directory is None: logger.error("This manifest does not contains the 'tests.unit_directory' field") sys.exit(2) display_content["tests"]["unit_directory"] = str(repo_manifest.tests.unit_directory) if args.output_tests_pytest_directory: - if repo_manifest.tests is None or repo_manifest.tests.pytest_directory is None or str( - repo_manifest.tests.pytest_directory) is None: + if repo_manifest.tests is None or repo_manifest.tests.pytest_directory is None: logger.error("This manifest does not contains the 'tests.pytest_directory' field") sys.exit(2) display_content["tests"]["pytest_directory"] = str(repo_manifest.tests.pytest_directory) diff --git a/src/ledgered/manifest/constants.py b/src/ledgered/manifest/constants.py index 86b97c7..6d1161e 100644 --- a/src/ledgered/manifest/constants.py +++ b/src/ledgered/manifest/constants.py @@ -1,3 +1,3 @@ -EXISTING_DEVICES = ["nanos", "nanox", "nanos+", "stax"] +EXISTING_DEVICES = ["nanos", "nanox", "nanos+", "stax", "europa"] MANIFEST_FILE_NAME = "ledger_app.toml" DEFAULT_USE_CASE = "default" diff --git a/src/ledgered/manifest/errors.py b/src/ledgered/manifest/errors.py new file mode 100644 index 0000000..8e4de81 --- /dev/null +++ b/src/ledgered/manifest/errors.py @@ -0,0 +1,2 @@ +class MissingField(ValueError): + pass diff --git a/src/ledgered/manifest/tests.py b/src/ledgered/manifest/tests.py index 77dc432..e4c3249 100644 --- a/src/ledgered/manifest/tests.py +++ b/src/ledgered/manifest/tests.py @@ -4,6 +4,7 @@ from urllib.parse import urlparse from .constants import DEFAULT_USE_CASE +from .errors import MissingField from .types import Jsonable, JsonDict, JsonSet from .utils import getLogger @@ -15,10 +16,6 @@ class DuplicateDependencyError(ValueError): pass -class MissingPytestDirectory(ValueError): - pass - - @dataclass class TestsDependencyConfig(Jsonable): __test__ = False # deactivate pytest discovery warning @@ -96,7 +93,7 @@ def __init__(self, self.dependencies = None else: if self.pytest_directory is None: - raise MissingPytestDirectory() + raise MissingField("[tests] pytest_directory") self.dependencies = JsonDict() for key, value in dependencies.items(): logger.info("Parsing dependencies for '%s' tests", key) diff --git a/tests/_data/ledger_app.toml b/tests/_data/ledger_app.toml index 165b364..4c1991d 100644 --- a/tests/_data/ledger_app.toml +++ b/tests/_data/ledger_app.toml @@ -1,7 +1,7 @@ [app] sdk = "Rust" build_directory = "" -devices = ["nanos", "Stax"] +devices = ["nanos", "Stax", "EUROPA"] [tests] unit_directory = "unit" diff --git a/tests/unit/manifest/test_manifest.py b/tests/unit/manifest/test_manifest.py index dcbbfe5..2d7f5fa 100644 --- a/tests/unit/manifest/test_manifest.py +++ b/tests/unit/manifest/test_manifest.py @@ -10,7 +10,7 @@ class TestManifest(TestCase): def check_ledger_app_toml(self, manifest: Manifest) -> None: self.assertEqual(manifest.app.sdk, "rust") - self.assertEqual(manifest.app.devices, {"nanos", "stax"}) + self.assertEqual(manifest.app.devices, {"nanos", "stax", "europa"}) self.assertEqual(manifest.app.build_directory, Path("")) self.assertTrue(manifest.app.is_rust) self.assertFalse(manifest.app.is_c) @@ -19,7 +19,7 @@ def check_ledger_app_toml(self, manifest: Manifest) -> None: self.assertEqual(manifest.tests.pytest_directory, Path("pytest")) def test___init__ok(self): - app = {"sdk": "rust", "devices": ["NANOS", "stAX"], "build_directory": ""} + app = {"sdk": "rust", "devices": ["NANOS", "stAX", "europa"], "build_directory": ""} tests = {"unit_directory": "unit", "pytest_directory": "pytest"} self.check_ledger_app_toml(Manifest(app, tests)) diff --git a/tests/unit/manifest/test_tests.py b/tests/unit/manifest/test_tests.py index e1b38bf..bed3898 100644 --- a/tests/unit/manifest/test_tests.py +++ b/tests/unit/manifest/test_tests.py @@ -2,6 +2,7 @@ from unittest import TestCase from ledgered.manifest.constants import DEFAULT_USE_CASE +from ledgered.manifest.errors import MissingField from ledgered.manifest.tests import DuplicateDependencyError, TestsConfig, TestsDependencyConfig, \ TestsDependenciesConfig, APPLICATION_DIRECTORY_KEY, APPLICATION_DIRECTORY_NAME @@ -99,9 +100,12 @@ def test____init___ok_complete(self): # the rest of the json can be compared self.assertDictEqual(result_json, {"unit_directory": str(ud), "pytest_directory": str(pd)}) - def test___init___nok_empty(self): config = TestsConfig(**dict()) self.assertIsNone(config.unit_directory) self.assertIsNone(config.pytest_directory) self.assertIsNone(config.dependencies) + + def test___init__missing_field(self): + with self.assertRaises(MissingField): + TestsConfig(dependencies="something")