File tree Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Original file line number Diff line number Diff line change 1
1
name : PyPI release
2
2
on :
3
+ pull_request :
4
+ branches : [main]
5
+ push :
6
+ branches : [main]
3
7
release :
4
8
types : [published]
5
9
@@ -24,16 +28,18 @@ jobs:
24
28
cd test-sdist
25
29
python -m venv venv-sdist
26
30
venv-sdist/bin/python -m pip install ../dist/CausalPy*.tar.gz
27
- # check import
28
- venv-sdist/bin/python -c "import causalpy; assert causalpy.__version__ == '${{ github.ref_name }}'"
31
+ echo "Checking import and version number (on release)"
32
+ venv-sdist/bin/python -c "import causalpy; assert causalpy.__version__ == '${{ github.ref_name }}' if '${{ github.ref_type }}' == 'tag' else causalpy.__version__; print(causalpy.__version__)"
33
+ cd ..
29
34
- name : Check the bdist installs and imports
30
35
run : |
31
36
mkdir -p test-bdist
32
37
cd test-bdist
33
38
python -m venv venv-bdist
34
39
venv-bdist/bin/python -m pip install ../dist/CausalPy*.whl
35
- # check import
36
- venv-bdist/bin/python -c "import causalpy; assert causalpy.__version__ == '${{ github.ref_name }}'"
40
+ echo "Checking import and version number (on release)"
41
+ venv-bdist/bin/python -c "import causalpy; assert causalpy.__version__ == '${{ github.ref_name }}' if '${{ github.ref_type }}' == 'tag' else causalpy.__version__; print(causalpy.__version__)"
42
+ cd ..
37
43
- uses : actions/upload-artifact@v3
38
44
with :
39
45
name : artifact
59
65
python-version : 3.8
60
66
- name : Test pip install from test.pypi
61
67
run : |
68
+ # Give time to test.pypi to update its index. If we don't wait,
69
+ # we might request to install before test.pypi is aware that it actually has the package
70
+ sleep 5s
62
71
python -m venv venv-test-pypi
63
- venv-test-pypi/bin/python -m pip install --index-url https://test.pypi.org/simple/ causalpy
64
- # check import
72
+ venv-test-pypi/bin/python -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple causalpy
73
+ echo "Checking import and version number"
65
74
venv-test-pypi/bin/python -c "import causalpy; assert causalpy.__version__ == '${{ github.ref_name }}'"
66
75
67
76
publish :
You can’t perform that action at this time.
0 commit comments