Skip to content

Commit

Permalink
Merge pull request #14 from andreygubarev/feature-ci
Browse files Browse the repository at this point in the history
update python package ci
  • Loading branch information
andreygubarev authored Jun 16, 2023
2 parents ea7bf55 + 7d313c1 commit a937208
Show file tree
Hide file tree
Showing 4 changed files with 113 additions and 99 deletions.
38 changes: 0 additions & 38 deletions .github/workflows/lint.yml

This file was deleted.

33 changes: 0 additions & 33 deletions .github/workflows/publish.yml

This file was deleted.

113 changes: 113 additions & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
name: Python Package

on: [push]

permissions:
contents: read

jobs:
lint-ansible:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Install dependencies
run: pip install ansible-lint

- name: Lint with ansible-lint
run: ansible-lint -v

lint-python:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Install dependencies
run: pip install pycodestyle

- name: Lint with pycodestyle
run: python -m pycodestyle molecule_qemu

build:
runs-on: ubuntu-latest
needs: [lint-ansible, lint-python]

steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Install dependencies
run: python -m pip install build --user

- name: Build a binary wheel and a source tarball
run: python -m build --sdist --wheel --outdir dist/ .

- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: python-package
path: 'dist/*'

publish:
runs-on: ubuntu-latest
needs: build
if: startsWith(github.ref, 'refs/tags/v')

steps:
- uses: actions/download-artifact@v3
with:
name: python-package

- name: Publish package
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
packages-dir: .

release:
runs-on: ubuntu-latest
needs: build
if: startsWith(github.ref, 'refs/tags/v')

permissions:
contents: write

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Check if pre-release
id: prerelease
run: |
echo "prerelease=$(if [[ "${{ github.ref }}" == *"rc"* ]]; then echo "true"; else echo "false"; fi)" >> "$GITHUB_OUTPUT"
- uses: actions/download-artifact@v3
with:
name: python-package

- name: Release
uses: softprops/action-gh-release@v1
with:
prerelease: ${{ steps.prerelease.outputs.prerelease }}
generate_release_notes: true
files: |
*.whl
*.tar.gz
28 changes: 0 additions & 28 deletions .github/workflows/release.yml

This file was deleted.

0 comments on commit a937208

Please sign in to comment.