Skip to content

Commit

Permalink
First!
Browse files Browse the repository at this point in the history
  • Loading branch information
JoschD committed May 13, 2021
0 parents commit beb66e7
Show file tree
Hide file tree
Showing 51 changed files with 6,736 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Continous Integration Workflows

This package implements different workflows for CI.
They are organised as follows.

### Documentation

The `documentation` workflow triggers on any push to master, builds the documentation and pushes it to the `gh-pages` branch (if the build is successful).
It runs on `ubuntu-latest` and our lowest supported Python version, `Python 3.7`.

### Testing Suite

Tests are ensured in the `tests` workflow, which triggers on all pushes.
It runs on a matrix of all supported operating systems (ubuntu-18.04, ubuntu-20.04, windows-latest and macos-latest) for all supported Python versions (currently `3.7`, `3.8` and `3.9`).

### Test Coverage

Test coverage is calculated in the `coverage` wokflow, which triggers on pushes to `master` and any push to a `pull request`.
It runs on `ubuntu-latest` & the lowest supported Python version (`Python 3.7`), and reports the coverage results of the test suite to `CodeClimate`.

### Regular Testing

A `cron` workflow triggers every Monday at 3am (UTC time) and runs the full testing suite, on all available operating systems and supported Python versions.
It also runs on `Python 3.x` so that newly released Python versions that would break tests are automatically included.

### Publishing

Publishing to `PyPI` is done through the `publish` workflow, which triggers anytime a `release` is made of the Github repository.
It builds a `wheel`, checks it, and pushes to `PyPI` if checks are successful.
83 changes: 83 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Runs all tests and pushes coverage report to codeclimate
name: Coverage

defaults:
run:
shell: bash

on: # Runs on all push events to master branch and any push related to a pull request
push:
branches:
- master
pull_request: # so that codeclimate gets coverage and reports on the diff

jobs:
coverage:
name: ${{ matrix.os }} / ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
matrix: # only lowest supported Python on latest ubuntu
os: [ubuntu-latest]
python-version: [3.7]

steps:
- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Get full Python version
id: full-python-version
run: echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")

- name: Set up cache
uses: actions/cache@v2
id: cache
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}

- name: Ensure cache is healthy
if: steps.cache.outputs.cache-hit == 'true'
run: pip --version >/dev/null 2>&1 || rm -rf .venv

- name: Upgrade pip, setuptools and wheel
run: |
python -m pip install --upgrade pip
pip install setuptools wheel
- name: Install package
run: pip install '.[test]'

- name: Set up env for CodeClimate (push)
run: |
echo "GIT_BRANCH=$GITHUB_REF" >> $GITHUB_ENV
echo "GIT_COMMIT_SHA=$GITHUB_SHA" >> $GITHUB_ENV
if: github.event_name == 'push'

- name: Set up env for CodeClimate (pull_request)
env:
PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
echo "GIT_BRANCH=$GITHUB_HEAD_REF" >> $GITHUB_ENV
echo "GIT_COMMIT_SHA=$PR_HEAD_SHA" >> $GITHUB_ENV
if: github.event_name == 'pull_request'

- name: Prepare CodeClimate binary
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
run: |
curl -LSs 'https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64' >./cc-test-reporter;
chmod +x ./cc-test-reporter
./cc-test-reporter before-build
- name: Run tests
run: python -m pytest -m "not cern_network" --mpl --cov-report xml --cov=pylhc

- name: Push Coverage to CodeClimate
if: ${{ success() }} # only if tests were successful
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
run: ./cc-test-reporter after-build
53 changes: 53 additions & 0 deletions .github/workflows/cron.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Runs all tests on master every week at 3 am (UTC time)
name: Cron Testing

defaults:
run:
shell: bash

on: # Runs on master branch on Mondays at 3am UTC time
schedule:
- cron: '* 3 * * mon'

jobs:
tests:
name: ${{ matrix.os }} / ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-18.04, ubuntu-20.04, macos-latest, windows-latest]
python-version: [3.7, 3.8, 3.9, 3.x] # crons should always run latest python hence 3.x

steps:
- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Get full Python version
id: full-python-version
run: echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")

- name: Set up cache
uses: actions/cache@v2
id: cache
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}

- name: Ensure cache is healthy
if: steps.cache.outputs.cache-hit == 'true'
run: pip --version >/dev/null 2>&1 || rm -rf .venv

- name: Upgrade pip, setuptools and wheel
run: |
python -m pip install --upgrade pip
pip install setuptools wheel
- name: Install package
run: pip install '.[test]'

- name: Run tests
run: python -m pytest -m "not cern_network" --mpl --cov-report xml --cov=pylhc
62 changes: 62 additions & 0 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Build and publish documentation
name: Build and upload documentation

defaults:
run:
shell: bash

on: # Runs on any push event to master
push:
branches:
- 'master'

jobs:
documentation:
name: ${{ matrix.os }} / ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
matrix: # only lowest supported Python on latest ubuntu
os: [ubuntu-latest]
python-version: [3.7]

steps:
- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Get full Python version
id: full-python-version
run: echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")

- name: Set up cache
uses: actions/cache@v2
id: cache
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}

- name: Ensure cache is healthy
if: steps.cache.outputs.cache-hit == 'true'
run: pip --version >/dev/null 2>&1 || rm -rf .venv

- name: Upgrade pip, setuptools and wheel
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Install package
run: pip install '.[doc]'

- name: Build documentation
run: python -m sphinx -b html doc ./doc_build -d ./doc_build

- name: Upload documentation to gh-pages
if: ${{ success() }}
uses: JamesIves/github-pages-deploy-action@3.6.2
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: doc_build
63 changes: 63 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Publishes to PyPI upon creation of a release
name: Upload Package to PyPI

defaults:
run:
shell: bash

on: # Runs everytime a release is added to the repository
release:
types: [created]

jobs:
deploy:
name: ${{ matrix.os }} / ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
matrix: # only lowest supported Python on ubuntu-latest
os: [ubuntu-latest]
python-version: [3.7]


steps:
- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Get full Python version
id: full-python-version
run: echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")

- name: Set up cache
uses: actions/cache@v2
id: cache
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}

- name: Ensure cache is healthy
if: steps.cache.outputs.cache-hit == 'true'
run: pip --version >/dev/null 2>&1 || rm -rf .venv

- name: Upgrade pip, setuptools and wheel
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and check build
run: |
python setup.py sdist bdist_wheel
twine check dist/*
- name: Build and publish
if: ${{ success() }}
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine check dist/*
twine upload dist/*
54 changes: 54 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Runs all tests not flagged as "cern_network" with a pytest marker
name: Tests

defaults:
run:
shell: bash

on: # Runs on all push events to any branch that isn't master
push:
branches-ignore:
- 'master'

jobs:
tests:
name: ${{ matrix.os }} / ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-18.04, ubuntu-20.04, macos-latest, windows-latest]
python-version: [3.7, 3.8, 3.9]

steps:
- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Get full Python version
id: full-python-version
run: echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")

- name: Set up cache
uses: actions/cache@v2
id: cache
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}

- name: Ensure cache is healthy
if: steps.cache.outputs.cache-hit == 'true'
run: pip --version >/dev/null 2>&1 || rm -rf .venv

- name: Upgrade pip, setuptools and wheel
run: |
python -m pip install --upgrade pip
pip install setuptools wheel
- name: Install package
run: pip install '.[test]'

- name: Run basic tests
run: python -m pytest -m "not cern_network" --mpl --cov-report xml --cov=pylhc
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.idea/
.hypothesis*
.project
.pydevproject
.vscode
/doc/_*
*__pycache__*
34 changes: 34 additions & 0 deletions .zenodo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"creators": [
{
"name": "OMC-Team",
"affiliation": "CERN"
},
{
"name": "Michael Hofer",
"affiliation": "CERN",
"orcid": "0000-0001-6173-0232"
},
{
"name": "Joschua Dilly",
"affiliation": "CERN",
"orcid": "0000-0001-7864-5448"
},
{
"name": "Felix Soubelet",
"affiliation": "University of Liverpool & CERN",
"orcid": "0000-0001-8012-1440"
},
{
"name": "Rogelio Tomas Garcia",
"affiliation": "CERN",
"orcid": "0000-0002-9857-1703"
},
{
"name": "Tobias Persson",
"affiliation": "CERN"
}
],
"title": "pylhc-submitter",
"description": "pylhc-submitter contains script to simplify the creation and submission of jobs to HTCondor at CERN."
}
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# pylhc-submitter Changelog

## Version 0.0.1

Initial version extracted from the pylhc/PyLHC reopsitory.
Loading

0 comments on commit beb66e7

Please sign in to comment.