Repository navigation
41 lines (41 loc) · 1.63 KB
/
Copy pathpackage.yml
File metadata and controls
41 lines (41 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
name: Validate distributions
on:
workflow_call:
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- run: python -m pip install build twine
- run: python -m build
- run: python -m twine check --strict dist/*
- name: Check release tag matches package version
if: startsWith(github.ref, 'refs/tags/')
run: |
python - <<'PY'
import ast, os
from pathlib import Path
tree = ast.parse(Path('src/sysmlv2_client/__init__.py').read_text())
version = next(ast.literal_eval(node.value) for node in tree.body
if isinstance(node, ast.Assign)
and any(isinstance(t, ast.Name) and t.id == '__version__' for t in node.targets))
assert os.environ['GITHUB_REF_NAME'] == f'v{version}', 'Tag must match package version'
PY
- name: Test installed wheel outside checkout
run: |
python -m venv /tmp/wheel-test
/tmp/wheel-test/bin/python -m pip install dist/*.whl pytest requests-mock
cd /tmp
/tmp/wheel-test/bin/python -c "import sysml_api; from sysmlv2_client import SysMLV2Client"
/tmp/wheel-test/bin/python -m pytest --import-mode=importlib "$GITHUB_WORKSPACE/tests"
- name: Build wheel from source distribution
run: python -m pip wheel --no-deps dist/*.tar.gz --wheel-dir /tmp/sdist-wheels
- uses: actions/upload-artifact@v4
with:
name: distributions
path: dist/*