diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml new file mode 100644 index 0000000..3f30775 --- /dev/null +++ b/.github/workflows/publish-to-pypi.yml @@ -0,0 +1,45 @@ +name: Publish to PyPi + +on: + release: + types: [created] + +jobs: + build: + name: Build distribution 📦 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + - name: Install pypa/build + run: python3 -m pip install build + - name: Build a binary wheel and a source tarball + run: python3 -m build + - name: Store the distribution packages + uses: actions/upload-artifact@v3 + with: + name: python-package-distributions + path: dist/ + + publish-to-pypi: + name: >- + Publish Python 🐍 distribution 📦 to PyPI + needs: + - build + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/czml3 + permissions: + id-token: write # IMPORTANT: mandatory for trusted publishing + steps: + - name: Download all the dists + uses: actions/download-artifact@v3 + with: + name: python-package-distributions + path: dist/ + - name: Publish distribution 📦 to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 14830b2..f04a1b6 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -1,60 +1,13 @@ -name: czml3 gh actions workflow +name: Run checks -on: [push, pull_request] +on: [pull_request] jobs: - build: - name: Build distribution 📦 - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: "3.11" - - name: Install pypa/build - run: >- - python3 -m - pip install - build - --user - - name: Build a binary wheel and a source tarball - run: python3 -m build - - name: Store the distribution packages - uses: actions/upload-artifact@v3 - with: - name: python-package-distributions - path: dist/ - - publish-to-pypi: - name: >- - Publish Python 🐍 distribution 📦 to PyPI - if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes - needs: - - build - runs-on: ubuntu-latest - environment: - name: pypi - url: https://pypi.org/p/czml3 - permissions: - id-token: write # IMPORTANT: mandatory for trusted publishing - - steps: - - name: Download all the dists - uses: actions/download-artifact@v3 - with: - name: python-package-distributions - path: dist/ - - name: Publish distribution 📦 to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - tox-checks: runs-on: ubuntu-latest strategy: matrix: python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] - steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} @@ -75,19 +28,18 @@ jobs: - uses: actions/checkout@v4 - name: Setup Python uses: actions/setup-python@v4 + with: + python-version: "3.11" - name: Install dependencies run: | python -m pip install --upgrade pip python -m pip install .[dev] - name: Generate coverage report - run: python -m pytest --cov=./ --cov-report=xml:pytest_cov.xml + run: python -m pytest --cov=czml3 --cov-report=xml:pytest_cov.xml - name: Upload coverage to Codecov uses: codecov/codecov-action@v4 with: - directory: ./coverage/reports/ fail_ci_if_error: true - files: ./coverage.xml,./pytest_cov.xml,!./cache - flags: unittests - name: codecov-umbrella + files: pytest_cov.xml, coverage.xml token: ${{ secrets.CODECOV_TOKEN }} verbose: true