Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Streamline publishing process #83

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
9c15998
update workflow before publishing python package
bisgaard-itis Oct 23, 2023
ab1bc1e
Merge branch 'master' of github.com:bisgaard-itis/osparc-simcore-clients
bisgaard-itis Oct 23, 2023
60c4f60
Merge branch 'ITISFoundation:master' into master
bisgaard-itis Oct 23, 2023
3aa7d70
fix dependency issue and bump version
bisgaard-itis Oct 23, 2023
a9810d4
Merge branch 'master' of github.com:bisgaard-itis/osparc-simcore-clients
bisgaard-itis Oct 23, 2023
5d2ceb2
point to website in project description
bisgaard-itis Oct 23, 2023
185195c
Merge branch 'ITISFoundation:master' into master
bisgaard-itis Oct 23, 2023
f58c10f
Merge branch 'ITISFoundation:master' into master
bisgaard-itis Oct 26, 2023
fdd75b7
Merge branch 'ITISFoundation:master' into master
bisgaard-itis Oct 27, 2023
8b4ab7a
add increment_version script
bisgaard-itis Oct 27, 2023
0bbc8f3
add make recipy for generating version file
bisgaard-itis Oct 27, 2023
ecf305b
add VERSION file to gitignore
bisgaard-itis Oct 27, 2023
da137a0
make sure VERSION file is generated when building client
bisgaard-itis Oct 27, 2023
7d52de8
make sure auto generated client gets correct version
bisgaard-itis Oct 27, 2023
c108b56
minor improve ments
bisgaard-itis Nov 2, 2023
84fd4a7
minor fix
bisgaard-itis Nov 2, 2023
c96352e
update versioning and github workflow
bisgaard-itis Nov 2, 2023
0d58db8
minor fix
bisgaard-itis Nov 2, 2023
b3d8538
add debug messages to bash scritp
bisgaard-itis Nov 2, 2023
fbbc449
fetch master to always have commits
bisgaard-itis Nov 2, 2023
5fdca97
debug
bisgaard-itis Nov 2, 2023
bf5b2db
fetch remote
bisgaard-itis Nov 2, 2023
93f8fa8
fetch all commits to determine versuib
bisgaard-itis Nov 2, 2023
e0fddce
remove debug info
bisgaard-itis Nov 2, 2023
d330dd6
cat VERSION for debugging
bisgaard-itis Nov 2, 2023
d7ba2c2
remove debug info
bisgaard-itis Nov 2, 2023
63fe805
only run publishing jobs when needed
bisgaard-itis Nov 2, 2023
1431d33
improve doc
bisgaard-itis Nov 2, 2023
11e369d
fix broken dependency
bisgaard-itis Nov 2, 2023
e844983
improve doc
bisgaard-itis Nov 2, 2023
c798687
Merge branch 'ITISFoundation:master' into master
bisgaard-itis Nov 2, 2023
90fc256
merge master into streamline-publishin-process
bisgaard-itis Nov 2, 2023
18e9776
fail if tag if invalid tag @wvangeit
bisgaard-itis Nov 2, 2023
99d162d
minor fix
bisgaard-itis Nov 2, 2023
39b49dd
first attempt at refactoring workflow
bisgaard-itis Nov 2, 2023
e93e462
correct workflow name in e2e testing
bisgaard-itis Nov 3, 2023
481b9cb
update publishing workflow
bisgaard-itis Nov 3, 2023
def1b4d
fix
bisgaard-itis Nov 3, 2023
f70cba4
comply with python version identification scheme @pcrespov
bisgaard-itis Nov 3, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 120 additions & 0 deletions .github/workflows/build-python-client.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
name: build-and-test-python-client
on:
workflow_dispatch:
push:
pull_request:
jobs:
build:
runs-on: ubuntu-latest
outputs:
osparc: ${{ steps.find-wheel.outputs.osparc-wheel }}
osparc_client: ${{ steps.find-wheel.outputs.osparc_client-wheel }}
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.client_payload.ref }}
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Generate version from tag
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
run: |
tag_version=$(echo ${{ github.ref }} | grep -oP '(?<=refs/tags/v)\d+\.\d+\.\d+'))
bash scripts/validate_semantic_version.bash "${tag_version}" > clients/python/client/VERSION
- name: Generate client
run: |
git status
make devenv
source .venv/bin/activate
cd clients/python
make install-dev
make dist-ci
- name: Determine wheel artifact
id: find-wheel
run: |
cd clients/python/artifacts/dist
OSPARC_WHEEL=$(ls osparc-*.whl)
OSPARC_CLIENT_WHEEL=$(ls osparc_client*.whl)
echo "osparc-wheel=${OSPARC_WHEEL}" >> $GITHUB_OUTPUT
echo "osparc_client-wheel=${OSPARC_CLIENT_WHEEL}" >> $GITHUB_OUTPUT
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: osparc_python_wheels
path: clients/python/artifacts/dist/

test-20-04:
name: python ${{ matrix.python-version }} ubuntu-20.04
runs-on: ubuntu-20.04
needs: build
strategy:
max-parallel: 4
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.client_payload.ref }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Pip cache
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-{{ matrix.python-version }}
restore-keys: |
${{ runner.os }}-pip
- name: Download wheels
uses: actions/download-artifact@v3
with:
name: osparc_python_wheels
path: clients/python/artifacts/dist/
- name: Install and Test
run: |
python -m venv .venv
source .venv/bin/activate
python -m pip install pytest
python -m pip install clients/python/artifacts/dist/${{needs.build.outputs.osparc}} --find-links=clients/python/artifacts/dist
cd clients/python
make install-test
pytest -v --ignore=/artifacts/client --ignore=test/e2e

test-latest:
name: python ${{ matrix.python-version }} ubuntu-latest
runs-on: ubuntu-latest
needs: build
strategy:
max-parallel: 4
matrix:
python-version: [3.7, 3.8, 3.9]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Pip cache
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-{{ matrix.python-version }}
restore-keys: |
${{ runner.os }}-pip
- name: Download wheels
uses: actions/download-artifact@v3
with:
name: osparc_python_wheels
path: clients/python/artifacts/dist/
- name: Install and Test
run: |
python -m venv .venv
source .venv/bin/activate
python -m pip install pytest
python -m pip install clients/python/artifacts/dist/${{needs.build.outputs.osparc}} --find-links=clients/python/artifacts/dist
cd clients/python
make install-test
pytest -v --ignore=/artifacts/client --ignore=test/e2e
160 changes: 27 additions & 133 deletions .github/workflows/publish-python-client.yml
Original file line number Diff line number Diff line change
@@ -1,174 +1,68 @@
name: publish-and-test-python-client
name: publish-python-client
on:
workflow_dispatch:
push:
pull_request:
jobs:
build-n-publish:
runs-on: ubuntu-latest
outputs:
osparc: ${{ steps.find-wheel.outputs.osparc-wheel }}
osparc_client: ${{ steps.find-wheel.outputs.osparc_client-wheel }}
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.client_payload.ref }}
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Generate client
run: |
git status
make devenv
source .venv/bin/activate
cd clients/python
make install-dev
make dist-ci
- name: Determine wheel artifact
id: find-wheel
run: |
cd clients/python/artifacts/dist
OSPARC_WHEEL=$(ls osparc-*.whl)
OSPARC_CLIENT_WHEEL=$(ls osparc_client*.whl)
echo "osparc-wheel=${OSPARC_WHEEL}" >> $GITHUB_OUTPUT
echo "osparc_client-wheel=${OSPARC_CLIENT_WHEEL}" >> $GITHUB_OUTPUT
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: osparc_python_wheels
path: clients/python/artifacts/dist/
workflow_run:
workflows: [build-and-test-python-client]
branches: [master]
types:
- completed

test-20-04:
name: python ${{ matrix.python-version }} ubuntu-20.04
runs-on: ubuntu-20.04
needs: build-n-publish
strategy:
max-parallel: 4
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.client_payload.ref }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Pip cache
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-{{ matrix.python-version }}
restore-keys: |
${{ runner.os }}-pip
- name: Download wheels
uses: actions/download-artifact@v3
with:
name: osparc_python_wheels
path: clients/python/artifacts/dist/
- name: Install and Test
run: |
python -m venv .venv
source .venv/bin/activate
python -m pip install pytest
python -m pip install clients/python/artifacts/dist/${{needs.build-n-publish.outputs.osparc}} --find-links=clients/python/artifacts/dist
cd clients/python
make install-test
pytest -v --ignore=/artifacts/client --ignore=test/e2e

test-latest:
name: python ${{ matrix.python-version }} ubuntu-latest
runs-on: ubuntu-latest
needs: build-n-publish
strategy:
max-parallel: 4
matrix:
python-version: [3.7, 3.8, 3.9]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Pip cache
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-{{ matrix.python-version }}
restore-keys: |
${{ runner.os }}-pip
- name: Download wheels
uses: actions/download-artifact@v3
with:
name: osparc_python_wheels
path: clients/python/artifacts/dist/
- name: Install and Test
run: |
python -m venv .venv
source .venv/bin/activate
python -m pip install pytest
python -m pip install clients/python/artifacts/dist/${{needs.build-n-publish.outputs.osparc}} --find-links=clients/python/artifacts/dist
cd clients/python
make install-test
pytest -v --ignore=/artifacts/client --ignore=test/e2e

publish-osparc_client-to-pypi:
jobs:
publish-osparc_client:
name: Publish osparc_client wheel
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
needs: [build-n-publish, test-20-04, test-latest]
environment:
name: pypi
url: https://pypi.org/p/osparc_client
permissions:
id-token: write
steps:
- name: Download wheels
uses: actions/download-artifact@v3
with:
name: osparc_python_wheels
path: dist/
run: gh run download ${{ github.event.workflow_run.id }}
- name: Remove osparc wheel
run: rm -f dist/${{needs.build-n-publish.outputs.osparc}}
run: |
osparc_wheel=$(ls osparc_python_wheels/osparc-*)
rm -f ${osparc_wheel}
- name: Publish osparc_client to Test PyPI
if: github.event_name == 'push'
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
verbose: true
packages-dir: dist/
packages-dir: osparc_python_wheels/
- name: Publish osparc_client to PyPI
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
verbose: true
packages-dir: dist/
packages-dir: osparc_python_wheels/

publish-osparc-to-pypi:
publish-osparc:
name: Publish osparc wheel
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
needs: [build-n-publish, test-20-04, test-latest]
environment:
name: pypi
url: https://pypi.org/p/osparc
permissions:
id-token: write
steps:
- name: Download wheels
uses: actions/download-artifact@v3
with:
name: osparc_python_wheels
path: dist/
run: gh run download ${{ github.event.workflow_run.id }}
- name: Remove osparc_client wheel
run: rm -f dist/${{needs.build-n-publish.outputs.osparc_client}}
run: |
osparc_client_wheel=$(ls osparc_python_wheels/osparc_client*)
rm -f ${osparc_client_wheel}
- name: Publish osparc to Test PyPI
if: github.event_name == 'push'
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
verbose: true
packages-dir: dist/
packages-dir: osparc_python_wheels/
- name: Publish osparc to PyPI
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
bisgaard-itis marked this conversation as resolved.
Show resolved Hide resolved
with:
verbose: true
packages-dir: dist/
packages-dir: osparc_python_wheels/
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,4 @@ tmp*
/clients/python/client/build/*
/clients/python/client/osparc/data/openapi.json
/clients/python/test/e2e/pytest.ini
/clients/python/client/VERSION
6 changes: 1 addition & 5 deletions api/config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
{
"homepage": "https://itisfoundation.github.io/osparc-simcore-clients/",
"python":
{
"version": "0.7.0"
}
"homepage": "https://itisfoundation.github.io/osparc-simcore-clients/"
}
Loading
Loading