Skip to content

Commit

Permalink
Adding in CI testing (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
apeltzer authored Sep 22, 2024
1 parent a623b82 commit 614a0ba
Show file tree
Hide file tree
Showing 8 changed files with 163 additions and 1 deletion.
35 changes: 35 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Bug report
description: File a bug report if DSO is breaking / not behaving in the way you expect
body:
- type: textarea
id: description
attributes:
label: Description of bug
description: |
A clear and concise description of what the bug is.
validations:
required: true

- type: textarea
id: log
attributes:
label: DSO Error log
description: |
Please paste your **full command** and DSO log.
render: console
placeholder: |
$ dso
- type: checkboxes
id: checklist
attributes:
label: Before submitting
description: >-
Please ensure your bug report fulfills all of the following requirements.
options:
- label: >-
I am using the latest release of DSO.
required: true
- label: >-
I have included a full DSO log, not truncated.
required: true
10 changes: 10 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Feature request
description: Suggest an idea for DSO
body:
- type: textarea
id: description
attributes:
label: Description of feature
description: Please describe your suggestion for a new feature. It might help to describe a problem or use case, plus any alternatives that you have considered.
validations:
required: true
24 changes: 24 additions & 0 deletions .github/workflows/pre_commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: "DSO lint"
on:
push:
branches: [main]
pull_request:

jobs:
pre_commit:
name: "pre-commit"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}

- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"

- uses: pre-commit/[email protected]

- uses: stefanzweifel/git-auto-commit-action@v5
if: '!cancelled()'
29 changes: 29 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Release to PyPI

on:
release:
types: [published]

# Use "trusted publishing", see https://docs.pypi.org/trusted-publishers/
jobs:
release:
name: Upload release to PyPI
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/dso # TODO update once settled on a name
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- uses: actions/checkout@v4
with:
filter: blob:none
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: "3.x"
cache: "pip"
- run: pip install build
- run: python -m build
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
51 changes: 51 additions & 0 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: "Unit tests for DSO"
on:
push:
branches:
- main
paths-ignore:
- "docs/**"
pull_request:
paths-ignore:
- "docs/**"

jobs:
unit_tests_linux:
name: "Python ${{ matrix.python-version }}"
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: ["3.12"]

env:
# GitHub currently has 4 cores available for Linux runners
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories
worker_cores: 4

steps:
- uses: actions/checkout@v4

- name: "Set up Python ${{ matrix.python-version }}"
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true

- name: Set up Quarto
uses: quarto-dev/quarto-actions/setup@v2

- name: Install libgit2 header files for libgit2 & pandoc for testing purposes
run: sudo apt-get install -y libgit2-dev pandoc

- name: "Install DSO"
run: pip install -e '.[test]'

- name: "Run unit tests"
run: pytest -vv tests -n ${{ env.worker_cores }} --cov=dso --cov-report=xml

# - name: "Upload coverage to Codecov"
# uses: codecov/codecov-action@v4
# with:
# files: ./coverage.xml
# env:
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
10 changes: 10 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
coverage:
status:
project:
default:
informational: true
patch:
default:
informational: true
github_checks: false
comment: false
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ optional-dependencies.test = [
"coverage",
"freezegun",
"pytest",
"pytest-asyncio", # for async tests
"pytest-cov",
"pytest-xdist", # for parallel testing with `pytest -n`
"quarto",
]
urls.Documentation = "https://github.com/Boehringer-Ingelheim/dso"
Expand Down
2 changes: 1 addition & 1 deletion src/dso/exec.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def _render_quarto(quarto_dir: Path, report_dir: Path, before_script: str, cwd:
set -euo pipefail
# this flags enables building larger reports with embedded resources
export QUARTO_DENO_V8_OPTIONS=--v8-flags=--max-old-space-size=8192
export QUARTO_DENO_V8_OPTIONS=--max-old-space-size=8192
{before_script}
Expand Down

0 comments on commit 614a0ba

Please sign in to comment.