Skip to content

Commit

Permalink
Merge pull request #5 from codecov/joseph/run-tests-in-ci
Browse files Browse the repository at this point in the history
Add testing job to CI on push to main and PR
  • Loading branch information
joseph-sentry authored Mar 8, 2024
2 parents e22e0d9 + cc60e8a commit a0a799c
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 2 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
on:
push:
branches:
- main
pull_request:

jobs:
run_tests:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-python@v4
id: setup-python
with:
python-version: "3.11"
- name: Install Rust Toolchain
run: rustup toolchain install stable --profile minimal --no-self-update
- name: Install requirements
run: |
python -m venv venv
. venv/bin/activate
pip install maturin
pip install -r tests/requirements.txt
maturin develop
- name: Install codecov cli
run: |
pip install --no-cache-dir git+https://github.com/codecov/codecov-cli.git@joseph/test-results-staging
- name: Run tests
run: |
. venv/bin/activate
python -m pytest --cov-report=xml:coverage.xml --cov=. --junitxml=unit.junit.xml
- name: Upload results to codecov
if: ${{ !cancelled() }}
uses: codecov/test-results-action@v1
with:
token: ${{ secrets.CODECOV_ORG_TOKEN }}
url: ${{ secrets.CODECOV_URL }}

- name: Upload results to codecov
if: ${{ !cancelled() }}
uses: codecov/test-results-action@v1
with:
token: ${{ secrets.CODECOV_ORG_TOKEN_STAGING }}
url: ${{ secrets.CODECOV_STAGING_API_URL }}
4 changes: 3 additions & 1 deletion tests/requirements.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
pytest
pytest-reportlog
pytest-reportlog
pytest-cov
coverage
11 changes: 10 additions & 1 deletion tests/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
#
# pip-compile tests/requirements.in
#
coverage[toml]==7.4.0
# via
# -r tests/requirements.in
# pytest-cov
exceptiongroup==1.1.3
# via pytest
iniconfig==2.0.0
Expand All @@ -15,8 +19,13 @@ pluggy==1.3.0
pytest==7.4.3
# via
# -r tests/requirements.in
# pytest-cov
# pytest-reportlog
pytest-cov==4.1.0
# via -r tests/requirements.in
pytest-reportlog==0.4.0
# via -r tests/requirements.in
tomli==2.0.1
# via pytest
# via
# coverage
# pytest

0 comments on commit a0a799c

Please sign in to comment.