Skip to content

Commit d9b5897

Browse files
authored
Merge pull request #4 from geekwhocodes/feature/sub-packages
add publish pypi workflow
2 parents d836665 + e59c14b commit d9b5897

File tree

5 files changed

+71
-58
lines changed

5 files changed

+71
-58
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Test and Publish to PyPI
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
test:
8+
if: startsWith(github.ref, 'refs/heads/v')
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v4
14+
15+
- name: Set up Python
16+
uses: actions/setup-python@v5
17+
with:
18+
python-version: '3.12'
19+
20+
- name: Install Poetry and dependencies
21+
run: |
22+
curl -sSL https://install.python-poetry.org | python3 -
23+
echo "$HOME/.local/bin" >> $GITHUB_PATH
24+
poetry install
25+
26+
- name: Run tests
27+
run: poetry run pytest
28+
29+
publish:
30+
if: startsWith(github.ref, 'refs/heads/v')
31+
needs: test
32+
runs-on: ubuntu-latest
33+
34+
steps:
35+
- name: Checkout code
36+
uses: actions/checkout@v4
37+
38+
- name: Set up Python
39+
uses: actions/setup-python@v5
40+
with:
41+
python-version: '3.11'
42+
43+
- name: Install Poetry and dependencies
44+
run: |
45+
curl -sSL https://install.python-poetry.org | python3 -
46+
echo "$HOME/.local/bin" >> $GITHUB_PATH
47+
poetry install
48+
49+
- name: Extract version from pyproject.toml
50+
id: get_version
51+
run: |
52+
echo "VERSION=$(poetry version --short)" >> $GITHUB_ENV
53+
54+
- name: Show extracted version
55+
run: echo "Publishing version $VERSION"
56+
57+
- name: Clean old builds
58+
run: rm -rf dist/
59+
60+
- name: Build the package
61+
run: poetry build
62+
63+
- name: Publish to PyPI
64+
env:
65+
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
66+
run: |
67+
poetry config pypi-token.pypi $POETRY_PYPI_TOKEN_PYPI
68+
poetry publish --no-interaction

.github/workflows/test.yml

Lines changed: 0 additions & 40 deletions
This file was deleted.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "pyspark_msgraph_source"
3-
version = "0.1.0"
3+
version = "0.2.0"
44
description = "Pyspark custom data source for Microsoft Graph APIs, including path and query parameters, with PySpark read examples."
55
authors = [
66
{name = "geekwhocodes",email = "ganeshraskar@outlook.com"}

tests/test_source.py

Lines changed: 0 additions & 17 deletions
This file was deleted.

tests/test_test.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
def test_fake():
2+
assert 1==1

0 commit comments

Comments
 (0)