modify: set version 0.1.15 #23
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
name: tests | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
jobs: | |
run-test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.10", "3.11"] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Python # Set Python version | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
# Install pip and pytest | |
- name: Install dependencies | |
run: | | |
python -m pip install -Ur requirements-dev.txt | |
- name: Test with pytest | |
run: | | |
python -m coverage run --context=python${{ matrix.python-version }} -a -m unittest tests/test_* | |
mv .coverage .coverage.${{ matrix.python-version }}.${{github.ref_name}}.dat | |
- name: Upload test coverage results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ".coverage.${{ matrix.python-version }}.${{github.ref_name}}.dat" | |
path: ".coverage.${{ matrix.python-version }}.${{github.ref_name}}.dat" | |
# Use always() to always run this step to publish test results when there are test failures | |
if: ${{ always() }} | |
merge-coverage: | |
needs: [ run-test ] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install coverage | |
run: | | |
python -m pip install -U coverage | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Download artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
path: ${{ github.workspace }}/downloaded/ | |
- name: Unwrap generated nesting | |
run: | | |
find ./downloaded/ -type f -name "*.dat" -exec mv {} ${{ github.workspace }}/ \; | |
- name: Display structure of workspace | |
run: ls -lAp ${{ github.workspace }} | |
- name: Combine tests | |
run: | | |
python -m coverage combine | |
python -m coverage xml -o coverage-${{github.ref_name}}.xml | |
- name: Upload combined coverage artefact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage-${{github.ref_name}}.xml | |
path: coverage-${{github.ref_name}}.xml | |
# Use always() to always run this step to publish test results when there are test failures | |
if: ${{ always() }} | |
upload-to-codecov: | |
needs: [ merge-coverage ] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Download artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: coverage-${{github.ref_name}}.xml | |
- name: Display structure of workspace | |
run: ls -lAp ${{ github.workspace }} | |
- name: Upload to Codecov | |
uses: codecov/codecov-action@v3 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |