Add testing job to CI on push to main and PR #7
Workflow file for this run
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: | |
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 | |
- name: Run tests | |
run: | | |
. venv/bin/activate | |
python -m pytest --cov-report=xml:coverage.xml --junitxml=unit.junit.xml | |
- name: Upload results to codecov | |
if: success() || failure() | |
run: | | |
codecovcli -u ${{ secrets.CODECOV_URL }} create-commit -t ${{ secrets.CODECOV_ORG_TOKEN }} | |
codecovcli -u ${{ secrets.CODECOV_URL }} create-report -t ${{ secrets.CODECOV_ORG_TOKEN }} | |
codecovcli -u ${{ secrets.CODECOV_URL }} --verbose do-upload -t ${{ secrets.CODECOV_ORG_TOKEN }} --report-type test_results --flag unit --file unit.junit.xml --disable-search --plugin None | |
codecovcli -u ${{ secrets.CODECOV_URL }} --verbose do-upload -t ${{ secrets.CODECOV_ORG_TOKEN }} --file coverage.xml |