diff --git a/.github/workflows/smoke_tests.yaml b/.github/workflows/smoke_tests.yaml new file mode 100644 index 00000000..f096dfa9 --- /dev/null +++ b/.github/workflows/smoke_tests.yaml @@ -0,0 +1,19 @@ +name: Smoke Tests + +on: [push, pull_request] + +jobs: + git-url: + # see the following for valid dependency specifiers + # https://packaging.python.org/en/latest/specifications/dependency-specifiers/#dependency-specifiers + # we construct from the GitHub Actions context + name: Install and import from git url + runs-on: ubuntu-latest + steps: + - uses: astral-sh/setup-uv@v7 + with: + ignore-empty-workdir: "true" # resolve warning about "Empty workdir detected. This may cause unexpected behavior. You can enable ignore-empty-workdir to mute this warning." + cache-dependency-glob: "" # resolve warning about "No file matched to ... The cache will never get invalidated. Make sure you have checked out the target repository and configured the cache-dependency-glob input correctly." + - run: uv init --bare --name smoke-test + - run: uv add "espei @ git+https://github.com/${{ github.repository }}.git@${{ github.sha }}" + - run: uv run python -c "import espei; print(espei.__version__)" \ No newline at end of file diff --git a/espei/__init__.py b/espei/__init__.py index 8501ee90..7957b535 100644 --- a/espei/__init__.py +++ b/espei/__init__.py @@ -9,8 +9,10 @@ # source control management system at the project root. __version__ = get_version(root='..', relative_to=__file__) del get_version -except ImportError: +except (ImportError, LookupError): # Fall back on the metadata of the installed package + # ImportError occurs if there's no ._dev + # LookupError occurs if get_version fails from importlib.metadata import version __version__ = version("espei") del version