Unit/Integration Tests #178
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
on: | |
# For all pushes run the tests | |
push: | |
# Also trigger on pull_request | |
pull_request: | |
# Run nightly tests at 02:00 UTC | |
schedule: | |
- cron: "0 2 * * *" | |
# Manually triggered | |
workflow_dispatch: | |
name: Unit/Integration Tests | |
concurrency: | |
# Within the same concurrency group, run only one job at a time | |
# New jobs cancel existing pending jobs | |
group: CashCtrl-test-account | |
cancel-in-progress: false | |
jobs: | |
docker: | |
runs-on: ubuntu-latest | |
container: | |
image: python:latest | |
env: | |
GITHUB_PAT: ${{ secrets.INSTALL_GITHUB }} | |
# If the PR is coming from a fork (pull_request_target), ensure it is opened | |
# by "dependabot[bot]". Otherwise, clone it normally. | |
CC_API_ORGANISATION: ${{ secrets.CC_API_ORGANISATION }} | |
CC_API_KEY: ${{ secrets.CC_API_KEY }} | |
if: | | |
(github.event_name == 'pull_request_target' && github.actor == 'dependabot[bot]') || | |
(github.event_name != 'pull_request_target' && github.actor != 'dependabot[bot]') | |
steps: | |
- name: Checkout | |
if: ${{ github.event_name != 'pull_request_target' }} | |
uses: actions/checkout@v4 | |
- name: Checkout PR | |
if: ${{ github.event_name == 'pull_request_target' }} | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Setup virtualenv | |
run: | | |
python -V # Print out python version for debugging | |
pip install virtualenv pytest | |
virtualenv venv | |
. venv/bin/activate | |
- name: Install dependencies | |
run: pip install coverage pytest pandas setuptools . | |
- name: Install package | |
run: python setup.py develop | |
- name: Run tests | |
run: coverage run -m pytest -W error | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ./coverage.xml | |
flags: unittests | |
name: codecov-upload |