From 0240aa4fea9df002868964ff2b1af28a160b1cfc Mon Sep 17 00:00:00 2001 From: "Schmieder, Jacob" Date: Fri, 3 May 2024 13:39:06 +0000 Subject: [PATCH 1/6] ruff ci --- .github/workflows/ruff.yml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .github/workflows/ruff.yml diff --git a/.github/workflows/ruff.yml b/.github/workflows/ruff.yml new file mode 100644 index 0000000..c8a0958 --- /dev/null +++ b/.github/workflows/ruff.yml @@ -0,0 +1,8 @@ +name: Ruff +on: [ push, pull_request ] +jobs: + ruff: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: chartboost/ruff-action@v1 \ No newline at end of file From 62f6d5305b88b6150f11a8cc36eb2f30e7610503 Mon Sep 17 00:00:00 2001 From: "Schmieder, Jacob" Date: Fri, 3 May 2024 13:53:00 +0000 Subject: [PATCH 2/6] added ruff.toml --- .ruff.toml | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .ruff.toml diff --git a/.ruff.toml b/.ruff.toml new file mode 100644 index 0000000..d11fa04 --- /dev/null +++ b/.ruff.toml @@ -0,0 +1,3 @@ +[lint.extend-per-file-ignores] +"__init__.py" = ["E402"] +'__init__.py' = ["F403"] \ No newline at end of file From 174a000dc4fdd375908f19665dc9e6b975e77a40 Mon Sep 17 00:00:00 2001 From: Jacob Schmieder Date: Fri, 3 May 2024 16:09:46 +0200 Subject: [PATCH 3/6] fixed .ruff.toml --- .ruff.toml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.ruff.toml b/.ruff.toml index d11fa04..f6be0be 100644 --- a/.ruff.toml +++ b/.ruff.toml @@ -1,3 +1,2 @@ [lint.extend-per-file-ignores] -"__init__.py" = ["E402"] -'__init__.py' = ["F403"] \ No newline at end of file +"__init__.py" = ["E402","F403"] From f6f444093c1cb636882ef3b8a3d71b6f3363102f Mon Sep 17 00:00:00 2001 From: "Schmieder, Jacob" Date: Mon, 6 May 2024 12:34:32 +0000 Subject: [PATCH 4/6] changed workflow name --- .github/workflows/pytest.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/pytest.yaml b/.github/workflows/pytest.yaml index 8959789..973571f 100644 --- a/.github/workflows/pytest.yaml +++ b/.github/workflows/pytest.yaml @@ -1,11 +1,10 @@ -name: Run tests +name: Run Tests on: #push: pull_request: branches: ['main', 'develop'] - workflow_dispatch: jobs: From 0d9d8d57d181520252e9990f2ef7f3ed2354fcd3 Mon Sep 17 00:00:00 2001 From: "Schmieder, Jacob" Date: Mon, 6 May 2024 12:35:55 +0000 Subject: [PATCH 5/6] added pypi ci --- .github/workflows/pypi.yml | 102 +++++++++++++++++++++++++++ .github/workflows/python-publish.yml | 39 ---------- 2 files changed, 102 insertions(+), 39 deletions(-) create mode 100644 .github/workflows/pypi.yml delete mode 100644 .github/workflows/python-publish.yml diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml new file mode 100644 index 0000000..0426bba --- /dev/null +++ b/.github/workflows/pypi.yml @@ -0,0 +1,102 @@ +name: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI + +on: + workflow_dispatch: + inputs: + branch_name: + description: 'Branch to build from (default is main)' + required: false + default: 'main' + workflow_run: + workflows: ["Run Tests"] # Ensure this matches the name of your testing workflow + types: + - completed + branches: [main, develop] # This ensures it only triggers for these branches + +env: + TestPyPI_URL: https://test.pypi.org/p/scraibe + PyPI_URL: https://pypi.org/p/scraibe + PyPI_DEV_URL: https://pypi.org/p/scraibe-nightly + +jobs: + + build: + name: Build distribution 📦 + runs-on: ubuntu-latest + # Check if manually triggered or automatically after successful test + if: > + github.event_name == 'workflow_dispatch' || + (github.event.workflow_run.conclusion == 'success' && + (github.event.workflow_run.head_branch == 'main' || github.event.workflow_run.head_branch == 'develop')) + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.inputs.branch_name || github.event.workflow_run.head_branch }} + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.x" + - name: Build source distribution + run: python3 setup.py sdist + - name: Store the distribution packages + uses: actions/upload-artifact@v3 + with: + name: python-package-distributions + path: dist/ + + publish-to-testpypi: + name: Publish Python 🐍 distribution 📦 to TestPyPI + needs: build + runs-on: ubuntu-latest + environment: + name: testpypi + url: $TestPyPI_URL + permissions: + id-token: write + steps: + - name: Download all the dists + uses: actions/download-artifact@v3 + with: + name: python-package-distributions + path: dist/ + - name: Publish distribution 📦 to TestPyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/ + + test-install: + name: Test Installation from TestPyPI + needs: publish-to-testpypi + runs-on: ubuntu-latest + steps: + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.x" + - name: Install package + run: | + python3 -m pip install --index-url $TestPyPI_URL + + publish-to-pypi: + name: Conditional Publish to PyPI or Dev Repository + needs: [build, test-install] + runs-on: ubuntu-latest + environment: + name: pypi + url: $PyPI_URL + permissions: + id-token: write + steps: + - name: Download all the dists + uses: actions/download-artifact@v3 + with: + name: python-package-distributions + path: dist/ + - name: Publish distribution 📦 to PyPI or Dev Repository + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: ${{ github.ref == 'refs/heads/main' && 'env.PyPI_URL' || ' env.PyPI_DEV_URL' }} + user: ${{ secrets.PYPI_USERNAME }} + password: ${{ secrets.PYPI_PASSWORD }} + + diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml deleted file mode 100644 index bdaab28..0000000 --- a/.github/workflows/python-publish.yml +++ /dev/null @@ -1,39 +0,0 @@ -# This workflow will upload a Python Package using Twine when a release is created -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries - -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. - -name: Upload Python Package - -on: - release: - types: [published] - -permissions: - contents: read - -jobs: - deploy: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - name: Set up Python - uses: actions/setup-python@v3 - with: - python-version: '3.x' - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install build - - name: Build package - run: python -m build - - name: Publish package - uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 - with: - user: __token__ - password: ${{ secrets.PYPI_API_TOKEN }} From 3930a7e185840780fc826b3ca143b72ffd2aa47d Mon Sep 17 00:00:00 2001 From: "Schmieder, Jacob" Date: Mon, 6 May 2024 12:39:08 +0000 Subject: [PATCH 6/6] use pypi api token --- .github/workflows/pypi.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index 0426bba..7f5fc3b 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -96,7 +96,6 @@ jobs: uses: pypa/gh-action-pypi-publish@release/v1 with: repository-url: ${{ github.ref == 'refs/heads/main' && 'env.PyPI_URL' || ' env.PyPI_DEV_URL' }} - user: ${{ secrets.PYPI_USERNAME }} - password: ${{ secrets.PYPI_PASSWORD }} + password: ${{ secrets.PYPI_API_TOKEN}}