Skip to content

Commit

Permalink
update CI
Browse files Browse the repository at this point in the history
update CI, setup code-cov, pylint and build packages
  • Loading branch information
anish-mudaraddi committed Nov 29, 2024
1 parent fe8a511 commit 1a2bef8
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 12 deletions.
91 changes: 91 additions & 0 deletions .github/workflows/build_package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: build and release openstackquery package

on:
workflow_dispatch:
inputs:
version:
description: 'Version to release'
required: true
changelog:
description: 'Release changelog description'
required: false

jobs:
release:
runs-on: ubuntu-latest

if: github.ref == 'refs/heads/main'

strategy:
matrix:
python-version: ['3.8', '3.x']

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Update version in setup.py
run: |
sed -i "s/version=.*,/version='${{ github.event.inputs.version }}',/" setup.py
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel build
- name: Build package
run: python -m build

- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: dist-${{ matrix.python-version }}
path: dist/

publish:
needs: release
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Download all artifacts
uses: actions/download-artifact@v3
with:
path: dist

- name: Generate Changelog
id: changelog
run: |
if [ -z "${{ github.event.inputs.changelog }}" ]; then
echo "changelog=Release version ${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
else
echo "changelog=${{ github.event.inputs.changelog }}" >> $GITHUB_OUTPUT
fi
- name: Create Git Tag
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git add version.txt
git commit -m "Bump version to ${{ github.event.inputs.version }}"
git tag v${{ github.event.inputs.version }}
git push origin main
git push origin v${{ github.event.inputs.version }}
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ github.event.inputs.version }}
body: ${{ steps.changelog.outputs.changelog }}
files: |
dist/**/*.whl
dist/**/*.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
python-version: ["3.8", "3.x"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
Expand Down
10 changes: 2 additions & 8 deletions .github/workflows/unittest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,7 @@ jobs:
- name: Run Tests
run: cd $GITHUB_WORKSPACE && ./run_tests.sh

- name: Run pytest with codecov
- name: Run pytest
run: |
pip install -r requirements.txt
pytest .
- name: Submit Coverage
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
token: ${{secrets.CODECOV_TOKEN}}
cd $GITHUB_WORKSPACE && pytest .
4 changes: 1 addition & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
from setuptools import setup, find_packages

VERSION = "0.2.1"
DESCRIPTION = "python package for openstack query library"

LONG_DESCRIPTION = (
"""Python package for running complex queries on OpenStack Resources"""
)

setup(
name="openstackquery",
version=VERSION,
version="0.1.0",
author="Anish Mudaraddi",
author_email="<anish.mudaraddi@stfc.ac.uk>",
description=DESCRIPTION,
Expand Down

0 comments on commit 1a2bef8

Please sign in to comment.