From c489457f361dde406853c058be6f47c46699e075 Mon Sep 17 00:00:00 2001 From: Jon Michael Aanes Date: Sat, 4 May 2024 23:19:09 +0200 Subject: [PATCH] Python tests --- .gitea/workflows/python-package.yaml | 18 +++------------- .gitea/workflows/python-test.yaml | 32 ++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 15 deletions(-) create mode 100644 .gitea/workflows/python-test.yaml diff --git a/.gitea/workflows/python-package.yaml b/.gitea/workflows/python-package.yaml index fcb4019..a854a4a 100644 --- a/.gitea/workflows/python-package.yaml +++ b/.gitea/workflows/python-package.yaml @@ -3,9 +3,6 @@ name: Python Package on: workflow_call: inputs: - PUBLISH: - required: false - type: boolean secrets: PIPY_REPO_USER: required: true @@ -15,7 +12,7 @@ on: type: string jobs: - test-and-publish: + publish: runs-on: ubuntu-latest container: image: node:21-bookworm @@ -30,19 +27,10 @@ jobs: - name: Installing Python Dependencies if: success() run: python3 -m pip install --upgrade pip setuptools wheel build twine pytest --break-system-packages - - name: Installing Python Test Dependencies - if: success() && hashFiles('requirements_test.txt') != '' - run: python3 -m pip install --upgrade -r requirements_test.txt --break-system-packages - - name: Installing package - if: success() - run: python3 -m pip install .[test] --break-system-packages - - name: Test Python Code - if: success() - run: python3 -m pytest test - name: Build - if: success() && inputs.PUBLISH + if: success() run: python3 -m build - name: Publish - if: success() && inputs.PUBLISH + if: success() run: python3 -m twine upload --repository-url "https://gitfub.space/api/packages/${{ secrets.PIPY_REPO_USER }}/pypi" -u ${{ secrets.PIPY_REPO_USER }} -p ${{ secrets.PIPY_REPO_PASS }} dist/* diff --git a/.gitea/workflows/python-test.yaml b/.gitea/workflows/python-test.yaml new file mode 100644 index 0000000..8f6e0b8 --- /dev/null +++ b/.gitea/workflows/python-test.yaml @@ -0,0 +1,32 @@ +name: Python Test + +on: + workflow_call: + inputs: + secrets: + +jobs: + test: + runs-on: ubuntu-latest + container: + image: node:21-bookworm + steps: + - name: Setting up Python ${{ env.PYTHON_VERSION }} for ${{runner.arch}} ${{runner.os}} + run: | + apt-get update + apt-get install -y python3 python3-pip + - name: Check out repository code + if: success() + uses: actions/checkout@v3 + - name: Installing Python Dependencies + if: success() + run: python3 -m pip install --upgrade pip setuptools wheel build twine pytest --break-system-packages + - name: Installing Python Test Dependencies + if: success() && hashFiles('requirements_test.txt') != '' + run: python3 -m pip install --upgrade -r requirements_test.txt --break-system-packages + - name: Installing package + if: success() + run: python3 -m pip install .[test] --break-system-packages + - name: Test Python Code + if: success() + run: python3 -m pytest test