Add 100% coverage #183
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
name: test | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
test: | |
name: ${{ matrix.os }} python-${{ matrix.python-version }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ] | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Setup conda environment | |
uses: mamba-org/setup-micromamba@v1 | |
with: | |
environment-file: environment-dev.yml | |
environment-name: pycrdt | |
create-args: python=${{ matrix.python-version }} | |
- name: Build and install pycrdt | |
run: pip install .[test] | |
- name: Check types | |
run: mypy python | |
- name: Run tests | |
run: pytest --color=yes -v tests | |
- name: Code coverage | |
if: ${{ (matrix.python-version == '3.12') && (matrix.os == 'ubuntu-latest') }} | |
run: | | |
coverage run -m pytest tests | |
coverage report --show-missing --skip-covered | |
coverage json | |
# - name: Upload coverage data | |
# uses: actions/upload-artifact@v4 | |
# with: | |
# name: covdata | |
# path: coverage.json | |
# | |
# coverage: | |
# name: Coverage | |
# needs: test | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: "Checkout repository" | |
# uses: actions/checkout@v3 | |
# | |
# - name: "Set up Python" | |
# uses: actions/setup-python@v5 | |
# with: | |
# python-version: "3.12" | |
# | |
# - name: "Download coverage data" | |
# uses: actions/download-artifact@v4 | |
# with: | |
# name: covdata | |
# | |
# - name: "Combine" | |
# run: | | |
# export TOTAL=$(python -c "import json;print(json.load(open('coverage.json'))['totals']['percent_covered_display'])") | |
# echo "total=$TOTAL" >> $GITHUB_ENV | |
# echo "### Total coverage: ${TOTAL}%" >> $GITHUB_STEP_SUMMARY | |
# | |
# - name: "Make badge" | |
# uses: schneegans/[email protected] | |
# with: | |
# auth: ${{ secrets.GIST_TOKEN }} | |
# gistID: b7b1bad6a6ad7c2ae651b201119f1c27 | |
# filename: covbadge.json | |
# label: Coverage | |
# message: ${{ env.total }}% | |
# minColorRange: 50 | |
# maxColorRange: 90 | |
# valColorRange: ${{ env.total }} |