-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from bergsalex/task/update-cicd-for-consistency
Adding same cicd defs as in rest of gw suite
- Loading branch information
Showing
7 changed files
with
138 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: 'Test Coverage Definition' | ||
on: | ||
workflow_call: | ||
inputs: | ||
coverage-module: | ||
description: "Module to test coverage for" | ||
type: string | ||
required: true | ||
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 | ||
show-test-traceback: | ||
description: "Show traceback for failed tests" | ||
type: string | ||
default: "no" | ||
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=${{ inputs.show-test-traceback }} \ | ||
--cov=${{ inputs.coverage-module }} \ | ||
--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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 11 additions & 16 deletions
27
.github/workflows/run-tests.yml → .github/workflows/coverage.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |