generated from seapagan/poetry-dev-setup
-
-
Notifications
You must be signed in to change notification settings - Fork 3
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 #266 from seapagan/add_ci_test_action
Add a testing stage to CI with coverage reports from codacy
- Loading branch information
Showing
13 changed files
with
474 additions
and
221 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: Tests | ||
|
||
on: | ||
push: | ||
branches: ["main", "develop"] | ||
pull_request: | ||
branches: ["main", "develop"] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: ["3.9", "3.10", "3.11", "3.12"] | ||
|
||
steps: | ||
# ---------------------------------------------------------------------- # | ||
# checkout repo and setup Python # | ||
# ---------------------------------------------------------------------- # | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
# ---------------------------------------------------------------------- # | ||
# install and configure poetry # | ||
# ---------------------------------------------------------------------- # | ||
- name: Install Poetry | ||
uses: snok/install-poetry@v1 | ||
with: | ||
virtualenvs-create: true | ||
virtualenvs-in-project: true | ||
installer-parallel: true | ||
# ---------------------------------------------------------------------- # | ||
# load cached venv if cache exists # | ||
# ---------------------------------------------------------------------- # | ||
- name: Load cached venv | ||
id: cached-poetry-dependencies | ||
uses: actions/cache@v4 | ||
with: | ||
path: .venv | ||
key: | ||
venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version | ||
}}-${{ hashFiles('**/poetry.lock') }} | ||
# ---------------------------------------------------------------------- # | ||
# install dependencies if cache does not exist # | ||
# ---------------------------------------------------------------------- # | ||
- name: Install dependencies | ||
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | ||
run: poetry install --no-interaction --no-root | ||
|
||
# ---------------------------------------------------------------------- # | ||
# run Pytest # | ||
# ---------------------------------------------------------------------- # | ||
- name: Test with pytest | ||
run: | | ||
poetry run pytest --cov-report=xml | ||
- name: Run codacy-coverage-reporter | ||
uses: codacy/codacy-coverage-reporter-action@v1 | ||
with: | ||
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} | ||
coverage-reports: ./coverage.xml |
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
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.