Skip to content

Commit

Permalink
Merge branch 'DIRACGrid:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
EwoudK authored Nov 23, 2023
2 parents e7c20b2 + f35072c commit 5a864df
Show file tree
Hide file tree
Showing 10 changed files with 90 additions and 81 deletions.
11 changes: 0 additions & 11 deletions .github/workflows/prepare_environment.sh

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Upload Package to Pypi

on: [push, pull_request]
on: [push]

jobs:
deploy:
Expand Down
60 changes: 38 additions & 22 deletions .github/workflows/python2-3-app.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: DB12 testing

on: [push, pull_request]
on: [pull_request]

jobs:
pre-commit:
runs-on: ubuntu-latest
if: github.event_name != 'push'
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v2
with:
python-version: '3.9'
Expand All @@ -16,31 +16,47 @@ jobs:
- name: Run pre-commit
run: pre-commit run --all-files --show-diff-on-failure

build:
runs-on: ubuntu-latest
pytest:
runs-on: ubuntu-20.04
if: github.event_name != 'push' || github.repository == 'DIRACGrid/db12'

strategy:
fail-fast: False
matrix:
python_version:
- 2.7
- 3.6
- 3.9
python:
- 2.7.18
- 3.6.15
- 3.9.17
- 3.11.4

container: python:${{ matrix.python }}-slim
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
- uses: actions/checkout@v4
- name: Installing dependencies
run: |
apt update && apt install -y git
python -m pip install pytest mock pytest-mock
pip install -e .
- name: Run pytest
run: pytest

- uses: actions/checkout@v2
- name: Prepare environment
run: .github/workflows/prepare_environment.sh ${{ matrix.python_version }}
pylint:
runs-on: ubuntu-20.04
if: github.event_name != 'push' || github.repository == 'DIRACGrid/db12'
timeout-minutes: 10

- name: Run pylint
run: |
. "${CONDA}/bin/activate" test-env
pylint -E src/db12/ tests/
strategy:
matrix:
python:
- 2.7.18
- 3.6.15
- 3.9.17
- 3.11.4

- name: Run pytest
container: python:${{ matrix.python }}-slim
steps:
- uses: actions/checkout@v4
- name: Installing dependencies
run: |
. "${CONDA}/bin/activate" test-env
pytest tests
python -m pip install pylint pytest mock
- name: Run pylint
run: pylint -E src/db12 tests
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ default_language_version:

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -15,6 +15,6 @@ repos:
- id: check-added-large-files

- repo: https://github.com/psf/black
rev: 21.9b0
rev: 23.1.0
hooks:
- id: black
11 changes: 5 additions & 6 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
name: python

channels:
- defaults
name: db12

dependencies:
- python =3.9
- future
- mock
- pre-commit
- pylint
- pytest
- mock
- pytest-mock
- pip:
- -e .
8 changes: 2 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
[build-system]
requires = [
"setuptools>=42",
"wheel"
]
build-backend = "setuptools.build_meta"
[tool.isort]
profile = "black"
37 changes: 37 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
###############################################################################
# Setuptools
###############################################################################

[metadata]
name = DB12
description = DIRAC Benchmark 2012
long_description = file: README.md
url = https://github.com/DIRACGrid/DB12/
license = GPL-3.0-only
license_files = LICENSE
classifiers =
Development Status :: 5 - Production/Stable
Intended Audience :: Science/Research
License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Programming Language :: Python :: 3
Topic :: Scientific/Engineering
Topic :: System :: Distributed Computing

[options]
package_dir =
= src
packages = find:
zip_safe = False
include_package_data = True

[options.package_data]
* = factors.json

[options.packages.find]
where=src

[options.entry_points]
db12 =
metadata = db12:extension_metadata
console_scripts =
db12 = db12.__main__:main
33 changes: 2 additions & 31 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,3 @@
import setuptools
from setuptools import setup

with open("README.md", "r") as fh:
long_description = fh.read()

setuptools.setup(
name="DB12",
description="DIRAC Benchmark 2012",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/pypa/DIRACGrid/DB12",
use_scm_version=True,
setup_requires=["setuptools_scm"],
project_urls={
"Bug Tracker": "https://github.com/DIRACGrid/DB12/issues",
},
classifiers=[
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 2.7",
"Operating System :: OS Independent",
],
package_dir={"": "src"},
package_data={"": ["factors.json"]},
packages=setuptools.find_packages(where="src"),
python_requires=">=2.7",
test_suite="tests",
entry_points={
"console_scripts": [
"db12 = db12.__main__:main",
],
},
)
setup()
2 changes: 1 addition & 1 deletion src/db12/benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def single_dirac_benchmark(iterations_num=1, measured_copies=None, correction=Tr

it_1 += 1

cput = sum(end[:4]) - sum(start[:4])
cput = sum(end[:4]) - sum(start[:4]) # pylint: disable=used-before-assignment
wall = end[4] - start[4]

if not cput:
Expand Down
3 changes: 2 additions & 1 deletion tests/test_DB12.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
"""Unit test for DB12"""
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division

import pytest
import mock

from db12 import single_dirac_benchmark
from db12 import multiple_dirac_benchmark
Expand Down

0 comments on commit 5a864df

Please sign in to comment.