Skip to content

Commit 817c110

Browse files
added release test
1 parent 7d1a233 commit 817c110

File tree

1 file changed

+88
-0
lines changed

1 file changed

+88
-0
lines changed
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: Build and Upload to TestPyPI
2+
3+
on:
4+
push:
5+
branches:
6+
- "main"
7+
pull_request:
8+
types: [opened, reopened, synchronize, labeled]
9+
branches:
10+
- "*"
11+
workflow_dispatch:
12+
13+
# no need for concurrency limits
14+
15+
jobs:
16+
build-artifacts:
17+
if: ${{ contains( github.event.pull_request.labels.*.name, 'test-build') && github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' }}
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v3
21+
with:
22+
fetch-depth: 0
23+
24+
- uses: actions/setup-python@v4
25+
name: Install Python
26+
with:
27+
python-version: "3.10"
28+
29+
- name: Install dependencies
30+
run: |
31+
python -m pip install --upgrade pip
32+
python -m pip install build twine
33+
python -m pip install tomli tomli_w
34+
35+
# - name: Disable local versions
36+
# run: |
37+
# python .github/workflows/configure-testpypi-version.py pyproject.toml
38+
# git update-index --assume-unchanged pyproject.toml
39+
# cat pyproject.toml
40+
41+
- name: Build tarball and wheels
42+
run: |
43+
git clean -xdf
44+
python -m build
45+
46+
- name: Check built artifacts
47+
run: |
48+
python -m twine check --strict dist/*
49+
if [ -f dist/py-cordex-0.0.0.tar.gz ]; then
50+
echo "❌ INVALID VERSION NUMBER"
51+
exit 1
52+
else
53+
echo "✅ Looks good"
54+
fi
55+
56+
- uses: actions/upload-artifact@v3
57+
with:
58+
name: releases
59+
path: dist
60+
61+
test-built-dist:
62+
needs: build-artifacts
63+
runs-on: ubuntu-latest
64+
steps:
65+
- uses: actions/setup-python@v4
66+
name: Install Python
67+
with:
68+
python-version: "3.10"
69+
- uses: actions/download-artifact@v3
70+
with:
71+
name: releases
72+
path: dist
73+
- name: List contents of built dist
74+
run: |
75+
ls -ltrh
76+
ls -ltrh dist
77+
78+
- name: Verify the built dist/wheel is valid
79+
run: |
80+
python -m pip install --upgrade pip
81+
python -m pip install dist/py-cordex*.whl
82+
83+
# - name: Publish package to TestPyPI
84+
# uses: pypa/[email protected]
85+
# with:
86+
# password: ${{ secrets.TESTPYPI_TOKEN }}
87+
# repository_url: https://test.pypi.org/legacy/
88+
# verbose: true

0 commit comments

Comments
 (0)