From 4cb34204aa88221321ad49c081dad5473b26c171 Mon Sep 17 00:00:00 2001 From: rlaplaza Date: Tue, 23 Jul 2024 13:45:30 +0200 Subject: [PATCH] v0.0.2 with pypi publish workflow --- .github/workflows/github-deploy.yml | 47 +++++++++++++++++++++++++++++ .github/workflows/github-pytest.yml | 42 ++++++++++++++++++++++++++ 2 files changed, 89 insertions(+) create mode 100644 .github/workflows/github-deploy.yml create mode 100644 .github/workflows/github-pytest.yml diff --git a/.github/workflows/github-deploy.yml b/.github/workflows/github-deploy.yml new file mode 100644 index 0000000..4732f71 --- /dev/null +++ b/.github/workflows/github-deploy.yml @@ -0,0 +1,47 @@ +name: Build and upload to PyPI + +on: + push: + branches: [main] + tags: + - "v*" + pull_request: + branches: [main] + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + if: ${{ (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') ) || github.event_name == 'workflow_dispatch' }} + strategy: + matrix: + python-version: ["3.8"] + + steps: + + - name: Log reason (manual run only) + if: github.event_name == 'workflow_dispatch' + run: | + echo "Reason for triggering: ${{ github.event.inputs.reason }}" + + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + pip install build + + - name: Build package + run: python -m build + + - uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/github-pytest.yml b/.github/workflows/github-pytest.yml new file mode 100644 index 0000000..9304965 --- /dev/null +++ b/.github/workflows/github-pytest.yml @@ -0,0 +1,42 @@ +name: Build and test with pytest + +on: + push: + branches: [main] + pull_request: + branches: [main] + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.8"] + + steps: + + - name: Log reason (manual run only) + if: github.event_name == 'workflow_dispatch' + run: | + echo "Reason for triggering: ${{ github.event.inputs.reason }}" + + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + pip install pytest + + - name: Install + run: python setup.py install + + - name: Test with pytest + run: pytest