From b7b92bd07aecdd325f0544e6da26050e4cc73f2d Mon Sep 17 00:00:00 2001 From: Andrey Gubarev Date: Fri, 16 Jun 2023 12:32:54 +0400 Subject: [PATCH 1/4] update python package ci --- .github/workflows/lint.yml | 38 ------------ .github/workflows/publish.yml | 33 ----------- .github/workflows/python-package.yml | 88 ++++++++++++++++++++++++++++ .github/workflows/release.yml | 28 --------- 4 files changed, 88 insertions(+), 99 deletions(-) delete mode 100644 .github/workflows/lint.yml delete mode 100644 .github/workflows/publish.yml create mode 100644 .github/workflows/python-package.yml delete mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index c99e0b4..0000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Lint Ansible and Python - -on: [push] - -jobs: - ansible-lint: - 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: python -m pip install ansible-lint - - - name: Lint with ansible-lint - run: ansible-lint -v - - pycodestyle: - 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 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index 640d66c..0000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: Pypi Publish - -on: - release: - types: [published] - -permissions: - contents: read - -jobs: - publish: - 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: python -m pip install build --user - - - name: Build a binary wheel and a source tarball - run: python -m build --sdist --wheel --outdir dist/ . - - - 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 }} diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml new file mode 100644 index 0000000..fef3011 --- /dev/null +++ b/.github/workflows/python-package.yml @@ -0,0 +1,88 @@ +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: ansible-collection + path: 'dist/*' + + release: + runs-on: ubuntu-latest + needs: [lint-ansible, lint-python] + 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" + + - name: Release + uses: softprops/action-gh-release@v1 + with: + prerelease: ${{ steps.prerelease.outputs.prerelease }} + generate_release_notes: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 3883191..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: Github Release - -on: - push: - tags: - - "v*.*.*" - -jobs: - release: - permissions: - contents: write - runs-on: ubuntu-latest - - 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" - - - name: Release - uses: softprops/action-gh-release@v1 - with: - draft: true - prerelease: ${{ steps.prerelease.outputs.prerelease }} - generate_release_notes: true From 15420f8b631d46a1b6b835af6157d0231799704d Mon Sep 17 00:00:00 2001 From: Andrey Gubarev Date: Fri, 16 Jun 2023 12:34:21 +0400 Subject: [PATCH 2/4] update release --- .github/workflows/python-package.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index fef3011..2626428 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -61,7 +61,7 @@ jobs: - name: Upload artifact uses: actions/upload-artifact@v3 with: - name: ansible-collection + name: python-package path: 'dist/*' release: @@ -81,8 +81,15 @@ jobs: 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 From 720997a3a6ac87f32b4c7cfb47e6caa0410a9263 Mon Sep 17 00:00:00 2001 From: Andrey Gubarev Date: Fri, 16 Jun 2023 12:38:22 +0400 Subject: [PATCH 3/4] add build --- .github/workflows/python-package.yml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 2626428..d752124 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -64,9 +64,27 @@ jobs: 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: [lint-ansible, lint-python] + needs: build if: startsWith(github.ref, 'refs/tags/v') permissions: From 7d313c1045863a3b934c8398b4da359cbc058d44 Mon Sep 17 00:00:00 2001 From: Andrey Gubarev Date: Fri, 16 Jun 2023 12:39:46 +0400 Subject: [PATCH 4/4] fix syntax --- .github/workflows/python-package.yml | 78 ++++++++++++++-------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index d752124..7843dfe 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -10,59 +10,59 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3 - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: '3.x' + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' - - name: Install dependencies - run: pip install ansible-lint + - name: Install dependencies + run: pip install ansible-lint - - name: Lint with ansible-lint - run: ansible-lint -v + - name: Lint with ansible-lint + run: ansible-lint -v lint-python: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3 - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: '3.x' + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' - - name: Install dependencies - run: pip install pycodestyle + - name: Install dependencies + run: pip install pycodestyle - - name: Lint with pycodestyle - run: python -m pycodestyle molecule_qemu + - 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 + - uses: actions/checkout@v3 - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: '3.x' + - 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: 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: 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/*' + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: python-package + path: 'dist/*' publish: runs-on: ubuntu-latest @@ -74,13 +74,13 @@ jobs: 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: . + - 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