Skip to content

Commit

Permalink
Merge pull request #7 from TheJacksonLaboratory/G3-28-installable-gen…
Browse files Browse the repository at this point in the history
…eweaver-cli-client-with-api-authentication

More improvements for CICD
  • Loading branch information
bergsalex authored Nov 15, 2023
2 parents da57eb3 + 55f2705 commit b3e7370
Show file tree
Hide file tree
Showing 8 changed files with 107 additions and 31 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/_check-coverage-action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: 'Test Coverage Definition'
on:
workflow_call:
inputs:
python-version:
description: Python version to set up'
default: '3.11'
type: string
runner-os:
description: 'Runner OS'
default: 'ubuntu-latest'
type: string
upload-coverage:
description: 'Upload coverage results'
default: true
type: boolean
required-coverage:
description: 'Required coverage percentage'
default: 100
type: string
jobs:
run-tests:
runs-on: ${{ inputs.runner-os }}
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ inputs.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ inputs.python-version }}
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
if [[ "$RUNNER_OS" == "macOS" ]]; then
echo "/Users/runner/.local/bin:$PATH" >> $GITHUB_PATH
fi
- name: Configure Poetry
run: poetry config virtualenvs.create false
- name: Install dependencies with Poetry
run: poetry install
- name: Test with pytest
run: |
poetry run pytest tests \
--tb=no \
--cov=geneweaver.client \
--cov-report=term \
--cov-report=html \
--cov-fail-under=${{ inputs.required-coverage }} > coverage_report.txt
- name: Upload coverage report
uses: actions/upload-artifact@v3
with:
name: coverage-report
path: coverage_report.txt
- name: Upload coverage report
uses: actions/upload-artifact@v3
with:
name: coverage-report-html
path: htmlcov
2 changes: 1 addition & 1 deletion .github/workflows/_format-lint-action.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 'Lint Code'
name: 'Lint Code Definition'
on:
workflow_call:
inputs:
Expand Down
12 changes: 2 additions & 10 deletions .github/workflows/_run-tests-action.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 'Run Python Tests'
name: 'Python Tests Definition'
on:
workflow_call:
inputs:
Expand Down Expand Up @@ -41,12 +41,4 @@ jobs:
run: poetry install
- name: Test with pytest
run: |
poetry run pytest tests \
--cov=geneweaver.client \
--cov-report=term \
--cov-fail-under=${{ inputs.required-coverage }} > coverage_report.txt
- name: Upload coverage report
uses: actions/upload-artifact@v3
with:
name: coverage-report
path: coverage_report.txt
poetry run pytest tests
25 changes: 9 additions & 16 deletions .github/workflows/run-tests.yml → .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,18 @@
name: Lint Code and Run Tests
name: Coverage
on:
pull_request:
branches: [ main ]
branches:
- 'main'
push:
branches:
- 'main'
jobs:
format-lint:
uses: ./.github/workflows/_format-lint-action.yml
check-coverage:
uses: ./.github/workflows/_check-coverage-action.yml
with:
python-version: '3.9'
test:
needs: format-lint
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ['3.9', '3.10', '3.11']
uses: ./.github/workflows/_run-tests-action.yml
with:
runner-os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
required-coverage: ${{ vars.REQUIRED_COVERAGE }}
comment-coverage-report:
needs: [ test ]
needs: [ check-coverage ]
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
permissions:
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
name: Release to PyPI on Version Change
name: Release to PyPI

on:
push:
branches: [ main ]
paths: ['pyproject.toml']
branches:
- 'main'
paths:
- 'pyproject.toml'

permissions:
contents: write
Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/style.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Style
on:
pull_request:
branches:
- 'main'
push:
branches:
- 'main'
jobs:
format-lint:
uses: ./.github/workflows/_format-lint-action.yml
with:
python-version: '3.9'
19 changes: 19 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Tests
on:
pull_request:
branches:
- 'main'
push:
branches:
- 'main'
jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ['3.9', '3.10', '3.11']
uses: ./.github/workflows/_run-tests-action.yml
with:
runner-os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
required-coverage: ${{ vars.REQUIRED_COVERAGE }}
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "geneweaver-client"
version = "0.3.1a4"
version = "0.3.1a5"
description = "A Python Client for the Geneweaver API"
authors = ["Jax Computational Sciences <[email protected]>"]
readme = "README.md"
Expand Down

0 comments on commit b3e7370

Please sign in to comment.