Publish to pypi from main workflow

Increase the distribution version number to be able to upload new package
This commit is contained in:
Magne Sjaastad 2023-06-29 10:11:17 +02:00
parent 77bf792b1a
commit 5688838899
2 changed files with 51 additions and 9 deletions

View File

@ -18,7 +18,7 @@ concurrency:
cancel-in-progress: true
jobs:
ResInsight-x64-buildcache:
build:
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
@ -34,6 +34,7 @@ jobs:
build-python-module: true,
execute-unit-tests: true,
unity-build: true,
publish-to-pypi: false,
}
- {
name: "Ubuntu Latest gcc",
@ -45,6 +46,7 @@ jobs:
build-python-module: true,
execute-unit-tests: true,
unity-build: false,
publish-to-pypi: true,
}
- {
name: "Ubuntu Latest clang",
@ -56,6 +58,7 @@ jobs:
build-python-module: true,
execute-unit-tests: true,
unity-build: false,
publish-to-pypi: false,
}
steps:
- name: Checkout
@ -79,10 +82,9 @@ jobs:
run: echo "${{ steps.python-path.outputs.PYTHON_EXECUTABLE }}"
- name: Install dependencies
# Make sure protobuf version is compatible with grpc - https://github.com/OPM/ResInsight/issues/9304
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r GrpcInterface/Python/requirements.txt
- name: Use CMake
uses: lukka/get-cmake@latest
@ -222,22 +224,62 @@ jobs:
- name: Stats for buildcache
run: ${{ github.workspace }}/buildcache/bin/buildcache -s
- name: Run Unit Tests
if: matrix.config.execute-unit-tests == 'true'
if: matrix.config.execute-unit-tests
shell: bash
run: |
cmakebuild/ApplicationExeCode/ResInsight --unittest
- name: Run pytest
if: matrix.config.build-python-module == 'true'
if: matrix.config.build-python-module
env:
RESINSIGHT_EXECUTABLE: ${{ runner.workspace }}/ResInsight/cmakebuild/ApplicationExeCode/ResInsight
run: |
cd GrpcInterface/Python/rips
cd GrpcInterface/Python
python setup.py sdist
cd rips
${{ steps.python-path.outputs.PYTHON_EXECUTABLE }} -m pytest --console
- name: Upload artifact
if: matrix.config.os == 'windows-latest'
- name: Upload python distribution folder
if: matrix.config.publish-to-pypi
uses: actions/upload-artifact@v3
with:
name: python-distribution
path: GrpcInterface/Python/dist
- name: Upload Windows install artifact
if: ${{contains( matrix.config.os, 'windows') }}
uses: actions/upload-artifact@v3
with:
name: ResInsight-${{ matrix.config.name }}
path: ${{ runner.workspace }}/ResInsight/cmakebuild/install
pypi-publish:
name: Upload release to PyPI
needs: build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/rips
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
# If this is a tagged release
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
steps:
- name: Download python distribution folder
uses: actions/download-artifact@v3
with:
name: python-distribution
path: dist
- name: Display structure of downloaded files
run: ls -R
- name: Publish package distributions to TestPyPI
# https://docs.pypi.org/trusted-publishers/adding-a-publisher/
uses: pypa/gh-action-pypi-publish@release/v1
# uncomment the two lines below to publish to test PyPi
# with:
# repository-url: https://test.pypi.org/legacy/

View File

@ -6,7 +6,7 @@ with open('README.md') as f:
with open('LICENSE') as f:
license = f.read()
RIPS_DIST_VERSION = '1'
RIPS_DIST_VERSION = '2'
setup(
name='rips',