Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Download the ispyb-database package into a new folder #219

Merged
merged 8 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: Run tests

on:
workflow_call:
secrets:
CODECOV_TOKEN:
required: true

jobs:
test:
Expand Down Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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
47 changes: 23 additions & 24 deletions .github/workflows/test-and-publish.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Run tests and publish Python distribution to PyPI
name: Test & Publish

on:
[push, pull_request]
Expand Down Expand Up @@ -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
Expand All @@ -75,7 +77,7 @@ jobs:
- run: echo "null"

update_ORM:
name: Call orm update workflow
name: Update ORM
permissions:
contents: write
pull-requests: write
Expand All @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [email protected]
Expand All @@ -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
Expand Down