Skip to content

Commit

Permalink
Update package installation files and development environment (#248)
Browse files Browse the repository at this point in the history
- Imported configuration settings from setup.cfg to pyproject.toml. Murfey can now be installed solely off pyproject.toml.
- Updated types and versions of pre-commit hooks used for this repository.

---------

Co-authored-by: Eu Pin Tien <wjr38212@ws466.diamond.ac.uk>
Co-authored-by: Daniel Hatton <daniel.hatton@diamond.ac.uk>
  • Loading branch information
3 people authored Apr 18, 2024
1 parent 0378f3b commit bd7b289
Show file tree
Hide file tree
Showing 33 changed files with 1,412 additions and 1,161 deletions.
264 changes: 132 additions & 132 deletions .azure-pipelines/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,142 +4,142 @@ variables:
trigger:
branches:
include:
- '*'
- "*"
tags:
include:
- '*'
- "*"

resources:
containers:
- container: mariadb
image: mariadb:10.8
env:
MYSQL_DATABASE: ispybtest
MYSQL_ROOT_PASSWORD: mysql_root_pwd
ports:
- 3306:3306
- container: mariadb
image: mariadb:10.8
env:
MYSQL_DATABASE: ispybtest
MYSQL_ROOT_PASSWORD: mysql_root_pwd
ports:
- 3306:3306

stages:
- stage: static
displayName: Static Analysis
jobs:
- job: checks
displayName: static code analysis
pool:
vmImage: ubuntu-20.04
steps:
- task: UsePythonVersion@0.206.0
displayName: Set up python
inputs:
versionSpec: 3.10

- bash: |
python .azure-pipelines/syntax-validation.py
displayName: Syntax validation
- bash: |
pip install --disable-pip-version-check flake8
python .azure-pipelines/flake8-validation.py
displayName: Flake8 validation
- stage: build
displayName: Build
dependsOn:
jobs:
- job: build
displayName: build package
pool:
vmImage: ubuntu-20.04
steps:
- task: UsePythonVersion@0.206.0
displayName: Set up python
inputs:
versionSpec: 3.10

- bash: |
pip install --disable-pip-version-check collective.checkdocs wheel
displayName: Install dependencies
- bash: |
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
displayName: Build python package
- bash: |
wget -t 3 --waitretry=20 https://github.com/DiamondLightSource/ispyb-database/releases/download/v$(DATABASE_SCHEMA)/ispyb-database-$(DATABASE_SCHEMA).tar.gz -O dist/ispyb-database.tar.gz
displayName: Download ISPyB DB schema v$(DATABASE_SCHEMA) for tests
- task: PublishBuildArtifacts@1.200.0
displayName: Store artifact
inputs:
pathToPublish: dist/
artifactName: package

- bash: python setup.py checkdocs
displayName: Check package description

- stage: tests
displayName: Run unit tests
dependsOn:
- static
- build
jobs:
- job: linux
pool:
vmImage: ubuntu-20.04
strategy:
matrix:
python39:
PYTHON_VERSION: 3.9
python310:
PYTHON_VERSION: 3.10
python311:
PYTHON_VERSION: 3.11
services:
db: mariadb
steps:
- template: ci.yml

- stage: deploy
displayName: Publish release
dependsOn:
- tests
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
jobs:
- job: pypi
displayName: Publish pypi release
pool:
vmImage: ubuntu-20.04
steps:
- checkout: none

- task: UsePythonVersion@0.206.0
displayName: Set up python
inputs:
versionSpec: 3.10

- task: DownloadBuildArtifacts@0.206.0
displayName: Get pre-built package
inputs:
buildType: 'current'
downloadType: 'single'
artifactName: 'package'
downloadPath: '$(System.ArtifactsDirectory)'

- script: |
pip install --disable-pip-version-check twine
displayName: Install twine
- task: TwineAuthenticate@1.208.0
displayName: Set up credentials
inputs:
pythonUploadServiceConnection: pypi-murfey

- bash: |
python -m twine upload -r pypi-murfey --config-file $(PYPIRC_PATH) $(System.ArtifactsDirectory)/package/pypi/*.tar.gz $(System.ArtifactsDirectory)/package/pypi/*.whl
displayName: Publish package
- stage: static
displayName: Static Analysis
jobs:
- job: checks
displayName: static code analysis
pool:
vmImage: ubuntu-20.04
steps:
- task: UsePythonVersion@0.206.0
displayName: Set up python
inputs:
versionSpec: 3.10

- bash: |
python .azure-pipelines/syntax-validation.py
displayName: Syntax validation
- bash: |
pip install --disable-pip-version-check flake8 flake8-pyproject
python .azure-pipelines/flake8-validation.py
displayName: Flake8 validation
- stage: build
displayName: Build
dependsOn:
jobs:
- job: build
displayName: build package
pool:
vmImage: ubuntu-20.04
steps:
- task: UsePythonVersion@0.206.0
displayName: Set up python
inputs:
versionSpec: 3.10

- bash: |
pip install --disable-pip-version-check collective.checkdocs wheel
displayName: Install dependencies
- bash: |
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
displayName: Build python package
- bash: |
wget -t 3 --waitretry=20 https://github.com/DiamondLightSource/ispyb-database/releases/download/v$(DATABASE_SCHEMA)/ispyb-database-$(DATABASE_SCHEMA).tar.gz -O dist/ispyb-database.tar.gz
displayName: Download ISPyB DB schema v$(DATABASE_SCHEMA) for tests
- task: PublishBuildArtifacts@1.200.0
displayName: Store artifact
inputs:
pathToPublish: dist/
artifactName: package

- bash: python setup.py checkdocs
displayName: Check package description

- stage: tests
displayName: Run unit tests
dependsOn:
- static
- build
jobs:
- job: linux
pool:
vmImage: ubuntu-20.04
strategy:
matrix:
python39:
PYTHON_VERSION: 3.9
python310:
PYTHON_VERSION: 3.10
python311:
PYTHON_VERSION: 3.11
services:
db: mariadb
steps:
- template: ci.yml

- stage: deploy
displayName: Publish release
dependsOn:
- tests
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
jobs:
- job: pypi
displayName: Publish pypi release
pool:
vmImage: ubuntu-20.04
steps:
- checkout: none

- task: UsePythonVersion@0.206.0
displayName: Set up python
inputs:
versionSpec: 3.10

- task: DownloadBuildArtifacts@0.206.0
displayName: Get pre-built package
inputs:
buildType: "current"
downloadType: "single"
artifactName: "package"
downloadPath: "$(System.ArtifactsDirectory)"

- script: |
pip install --disable-pip-version-check twine
displayName: Install twine
- task: TwineAuthenticate@1.208.0
displayName: Set up credentials
inputs:
pythonUploadServiceConnection: pypi-murfey

- bash: |
python -m twine upload -r pypi-murfey --config-file $(PYPIRC_PATH) $(System.ArtifactsDirectory)/package/pypi/*.tar.gz $(System.ArtifactsDirectory)/package/pypi/*.whl
displayName: Publish package
Loading

0 comments on commit bd7b289

Please sign in to comment.