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

update python package ci #14

Merged
merged 4 commits into from
Jun 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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.