diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 95ff9c2..22d7875 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,6 +2,9 @@ name: Run tests on: workflow_call: + secrets: + CODECOV_TOKEN: + required: true jobs: test: @@ -32,11 +35,11 @@ jobs: python -m pip install -r ./requirements_dev.txt python -m pip install . - - name: Get pre-built package + - name: Get database uses: actions/download-artifact@v4 with: - name: package-distributions - path: dist/ + name: database + path: database/ - uses: shogo82148/actions-setup-mysql@v1 with: @@ -58,7 +61,7 @@ jobs: cp "./conf/config.example.cfg" "./conf/config.cfg" cp "./conf/ws_config.example.cfg" "./conf/ws_config.cfg" - tar xfz "dist/ispyb-database.tar.gz" + tar xfz "database/ispyb-database.tar.gz" printf 'Waiting for MySQL database to accept connections' until mariadb --defaults-file=.my.cnf -e "SHOW DATABASES" >/dev/null; do printf '.'; sleep 10; done @@ -84,7 +87,12 @@ jobs: export ISPYB_CREDENTIALS="./conf/config.cfg" PYTHONDEVMODE=1 pytest tests -ra --cov=ispyb --cov-report=xml --cov-branch - - name: Publish coverage stats - run: bash <(curl -s https://codecov.io/bash) -n "Python ${{ matrix.python-version }}" + - name: Upload to Codecov + uses: codecov/codecov-action@v4 + with: + name: ${{ matrix.python-version }} + files: coverage.xml + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} continue-on-error: true timeout-minutes: 2 diff --git a/.github/workflows/test-and-publish.yml b/.github/workflows/test-and-publish.yml index 0c1dcf9..25c59e4 100644 --- a/.github/workflows/test-and-publish.yml +++ b/.github/workflows/test-and-publish.yml @@ -1,4 +1,4 @@ -name: Run tests and publish Python distribution to PyPI +name: Test & Publish on: [push, pull_request] @@ -36,35 +36,37 @@ jobs: uses: actions/setup-python@v5 with: python-version: "3.9" - - name: Install dependencies - run: | - pip install -U pip - pip install collective.checkdocs wheel + - name: Install pypa/build + run: >- + python3 -m + pip install + build + --user - name: Build python package - run: | - set -ex - python setup.py sdist bdist_wheel - mkdir -p dist/pypi - shopt -s extglob - mv -v dist/!(pypi) dist/pypi - git archive HEAD | gzip > dist/repo-source.tar.gz - ls -laR dist + run: python3 -m build - name: Download ISPyB DB schema v${{ env.DATABASE_SCHEMA }} for tests - run: wget -t 3 --waitretry=20 https://github.com/DiamondLightSource/ispyb-database/releases/download/v${{ env.DATABASE_SCHEMA }}/ispyb-database-${{ env.DATABASE_SCHEMA }}.tar.gz -O dist/ispyb-database.tar.gz - - name: Store artifact + run: | + mkdir database + wget -t 3 --waitretry=20 https://github.com/DiamondLightSource/ispyb-database/releases/download/v${{ env.DATABASE_SCHEMA }}/ispyb-database-${{ env.DATABASE_SCHEMA }}.tar.gz -O database/ispyb-database.tar.gz + - name: Store built package artifact uses: actions/upload-artifact@v4 with: name: package-distributions path: dist/ - - name: Check package description - run: python setup.py checkdocs + - name: Store database artifact + uses: actions/upload-artifact@v4 + with: + name: database + path: database/ tests: - name: Call ci unit tests workflow + name: Testing uses: ./.github/workflows/ci.yml needs: - build - static + secrets: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} get-env-vars: name: Get environment variables @@ -75,7 +77,7 @@ jobs: - run: echo "null" update_ORM: - name: Call orm update workflow + name: Update ORM permissions: contents: write pull-requests: write @@ -88,8 +90,7 @@ jobs: publish-to-pypi: - name: >- - Publish Python distribution to PyPI + name: Publish PyPI if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes needs: - tests @@ -110,9 +111,7 @@ jobs: uses: pypa/gh-action-pypi-publish@release/v1 github-release: - name: >- - Sign the Python distribution with Sigstore - and upload them to GitHub Release + name: Publish Github Release needs: - publish-to-pypi runs-on: ubuntu-latest diff --git a/setup.cfg b/setup.cfg index c62e849..a4c5efa 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,7 +2,7 @@ name = ispyb version = 10.2.1 description = Python package to access ISPyB database -description-file = README.md +description_file = README.md long_description = This package provides a Python interface to ISPyB. It can access the ISPyB database directly or (in future versions) run on top of the official ISPyB webservices API. author = Diamond Light Source author_email = scientificsoftware@diamond.ac.uk @@ -21,7 +21,7 @@ classifiers = keywords = ISPyB database -project-urls = +project_urls = Documentation = https://ispyb.readthedocs.io GitHub = https://github.com/DiamondLightSource/ispyb-api Bug-Tracker = https://github.com/DiamondLightSource/ispyb-api/issues