File tree Expand file tree Collapse file tree 4 files changed +96
-0
lines changed
Expand file tree Collapse file tree 4 files changed +96
-0
lines changed Original file line number Diff line number Diff line change 1+ # This workflow builds and checks the package for release
2+ name : Build
3+
4+ on :
5+ pull_request :
6+ branches : [main]
7+
8+ jobs :
9+ build :
10+ runs-on : ubuntu-22.04
11+
12+ steps :
13+ - uses : actions/checkout@v4
14+ - name : Set up Python
15+ uses : actions/setup-python@v5
16+ with :
17+ python-version : " 3.12"
18+ - run : pip install tox
19+
20+ - name : Test build integrity
21+ run : tox -e build
22+ env :
23+ # Use the CPU only version of torch when building/running the code
24+ PIP_EXTRA_INDEX_URL : https://download.pytorch.org/whl/cpu
Original file line number Diff line number Diff line change 1+ name : Release
2+
3+ on :
4+ push :
5+ tags : ["*"]
6+
7+ jobs :
8+ build :
9+ name : Build distribution
10+ runs-on : ubuntu-latest
11+ environment :
12+ name : pypi
13+ url : https://pypi.org/project/shiftml
14+ permissions :
15+ id-token : write
16+ contents : write
17+
18+ steps :
19+ - uses : actions/checkout@v4
20+ with :
21+ fetch-depth : 0
22+ - name : setup Python
23+ uses : actions/setup-python@v5
24+ with :
25+ python-version : " 3.12"
26+ - run : python -m pip install tox
27+ - name : Build package
28+ run : tox -e build
29+ - name : Publish distribution to PyPI
30+ if : startsWith(github.ref, 'refs/tags/v')
31+ uses : pypa/gh-action-pypi-publish@release/v1
32+ - name : Publish to GitHub release
33+ if : startsWith(github.ref, 'refs/tags/v')
34+ uses : softprops/action-gh-release@v2
35+ with :
36+ files : |
37+ dist/*.tar.gz
38+ dist/*.whl
39+ prerelease : ${{ contains(github.ref, '-rc') }}
40+ env :
41+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change 1+ graft src
2+
3+ include LICENSE
4+ include README.md
5+ include CONTRIBUTORS
6+
7+ prune docs
8+ prune tests
9+ prune .github
10+ prune .tox
11+
12+ exclude .gitignore
13+ exclude tox.ini
14+
15+ global-exclude *.py[cod] __pycache__/* *.so *.dylib
Original file line number Diff line number Diff line change 33envlist =
44 lint
55 tests
6+ build
67
78[testenv:tests]
89description = Run the tests of the Python package
@@ -32,6 +33,21 @@ commands =
3233 blackdoc --check --diff src tests
3334 isort --check-only --diff --extend-skip-glob " */build/*" src tests
3435
36+ [testenv:build]
37+ description = builds the package and checks integrity
38+ usedevelop = true
39+ deps =
40+ build
41+ check-manifest
42+ twine
43+ allowlist_externals = rm
44+ commands_pre =
45+ rm -f {toxinidir}/dist/*.whl
46+ rm -f {toxinidir}/dist/*.tar.gz
47+ commands =
48+ python -m build
49+ twine check dist/*.tar.gz dist/*.whl
50+ check-manifest {toxinidir}
3551
3652[testenv:format]
3753description = Abuse tox to do actual formatting on all files.
You can’t perform that action at this time.
0 commit comments