Skip to content

Commit

Permalink
Merge pull request Ericsson#3301 from csordasmarton/publish_pypi_image
Browse files Browse the repository at this point in the history
[pypi] Github action to publish pypi images automatically
  • Loading branch information
bruntib authored May 17, 2021
2 parents 9c3a36c + 5d9c60d commit 0321dc4
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 7 deletions.
50 changes: 43 additions & 7 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
name: pypi-package-tests
name: codechecker-pypi-package

# Triggers the workflow on push or pull request events.
on: [push, pull_request]
# Triggers the workflow on 'push', 'pull' and 'release' request events.
# The pypi package will be published only on the release event.
on:
push:
pull_request:
release:
types: [published]

jobs:
build:
Expand All @@ -22,14 +27,26 @@ jobs:
sudo apt-get update -q
sudo apt-get install g++ gcc-multilib
- name: Get tag version
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags')
id: get_version
run: |
echo ::set-output name=VERSION::$(echo ${GITHUB_REF#refs/tags/v} | sed 's/-//')
# Set package version information in the 'setup.py' file based on the
# released git tag information.
- name: Set version in the setup.py file
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags')
run: |
sed -i "s/version=\".*\"/version=\"${{ steps.get_version.outputs.VERSION }}\"/" setup.py
- name: Create the pypi package
run: |
BUILD_UI_DIST=NO make dist
mv dist/codechecker-*.tar.gz dist/codechecker.tar.gz
- uses: actions/upload-artifact@master
with:
name: pypi-package-and-tests
name: pypi-package
path: |
dist
tests/functional/binary_package/
Expand All @@ -50,7 +67,7 @@ jobs:

- uses: actions/download-artifact@master
with:
name: pypi-package-and-tests
name: pypi-package
path: ./

- name: "Install run-time dependencies (Linux)"
Expand All @@ -71,10 +88,29 @@ jobs:
echo "C:\Program Files\LLVM\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: "Install pypi package"
shell: bash
run: |
pip install wheel nose
pip install dist/codechecker.tar.gz
pip install dist/codechecker-*.tar.gz
- name: "Test CodeChecker commands"
run: |
nosetests tests/functional/binary_package/
# Publish pypi package when a new CodeChecker version is released.
publish:
name: Publish pypi package
if: github.event_name == 'release'
runs-on: ubuntu-18.04
needs: test
steps:
- uses: actions/download-artifact@master
with:
name: pypi-package
path: ./dist/

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ def run(self):
description="CodeChecker is an analyzer tooling, defect database and "
"viewer extension",
long_description=long_description,
long_description_content_type = "text/markdown",
url="https://github.com/Ericsson/CodeChecker",
keywords=['codechecker', 'plist'],
license='LICENSE.TXT',
Expand Down

0 comments on commit 0321dc4

Please sign in to comment.