From 4b0250687d6c1186e46d0265695466809701e78d Mon Sep 17 00:00:00 2001 From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com> Date: Sun, 17 Dec 2023 23:04:03 -0500 Subject: [PATCH] ci: add code coverage integration (#386) --- .github/workflows/CI.yml | 21 +++++++++++++ .github/workflows/python-tests.yml | 47 ------------------------------ README.rst | 12 ++++++-- codecov.yml | 15 ++++++++++ requirements-dev.txt | 1 + 5 files changed, 46 insertions(+), 50 deletions(-) delete mode 100644 .github/workflows/python-tests.yml create mode 100644 codecov.yml diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 82e5b39c2..93e638e16 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -108,6 +108,27 @@ jobs: path: | ${{ github.workspace }}/artifacts + - name: Test with pytest + id: test + shell: bash + run: | + python -m pytest \ + -rxXs \ + --tb=native \ + --verbose \ + --cov=pyra \ + tests + + - name: Upload coverage to Codecov + uses: Wandalen/wretry.action@v1 + with: + action: codecov/codecov-action@v3 + attempt_delay: 10000 + attempt_limit: 10 + with: | + fail_ci_if_error: true + flags: ${{ runner.os }}-${{ matrix.architecture }} + - name: Create/Update GitHub Release if: ${{ needs.setup_release.outputs.publish_release == 'true' }} uses: LizardByte/create-release-action@v2023.1210.832 diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml deleted file mode 100644 index f1ecb08d6..000000000 --- a/.github/workflows/python-tests.yml +++ /dev/null @@ -1,47 +0,0 @@ ---- -name: Python Tests - -on: - pull_request: - branches: [master, nightly] - types: [opened, synchronize, reopened] - -jobs: - pytest: - strategy: - fail-fast: false - matrix: - os: [windows-2019, ubuntu-20.04, macos-11] - architecture: [x64] - include: # additional runs - - os: windows-2019 - architecture: x86 - - runs-on: ${{ matrix.os }} - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Set up Python 3.9 - uses: actions/setup-python@v5 # https://github.com/actions/setup-python - with: - python-version: '3.9' - architecture: ${{ matrix.architecture }} - - - name: Install python dependencies - run: | - python -m pip install --upgrade pip setuptools - python -m pip install -r requirements-dev.txt - - - name: Compile Locale Translations - run: | - python ./scripts/_locale.py --compile - - - name: Compile Docs - run: | - cd docs - make html - - - name: Test with pytest - run: | - python -m pytest -v diff --git a/README.rst b/README.rst index 1234d3fef..9756da109 100644 --- a/README.rst +++ b/README.rst @@ -20,9 +20,15 @@ Integrations :alt: Read the Docs :target: http://retroarcher.readthedocs.io/ -.. image:: https://img.shields.io/badge/dynamic/json?color=blue&label=localized&style=for-the-badge&query=%24.progress..data.translationProgress&url=https%3A%2F%2Fbadges.awesome-crowdin.com%2Fstats-15178612-503340.json&logo=crowdin - :alt: CrowdIn - :target: https://crowdin.com/project/retroarcher +.. image:: https://img.shields.io/codecov/c/gh/LizardByte/RetroArcher?token=5C47NYBSBV&style=for-the-badge&logo=codecov&label=codecov + :alt: Codecov + :target: https://codecov.io/gh/LizardByte/RetroArcher + +CrowdIn Localization +^^^^^^^^^^^^^^^^^^^^ +.. image:: https://app.lizardbyte.dev/uno/crowdin/LizardByte_graph.svg + :alt: CrowdIn graph + :target: https://translate.lizardbyte.dev Support --------- diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 000000000..c9d3a1ab2 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,15 @@ +--- +codecov: + branch: master + +coverage: + status: + project: + default: + target: auto + threshold: 10% + +comment: + layout: "diff, flags, files" + behavior: default + require_changes: false # if true: only post the comment if coverage changes diff --git a/requirements-dev.txt b/requirements-dev.txt index 3a1af5bb1..a28a7002d 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -2,4 +2,5 @@ flake8==6.1.0 pyinstaller==6.3.0 pytest==7.4.3 +pytest-cov==4.1.0 rstcheck[sphinx]==6.2.0