From 5d0a96fb1618419ba6684ba21ba9997174ddf607 Mon Sep 17 00:00:00 2001 From: shoucandanghehe Date: Fri, 1 Nov 2024 01:02:57 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=20=E6=B7=BB=E5=8A=A0=20Test=20CI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/Test.yml | 57 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 .github/workflows/Test.yml diff --git a/.github/workflows/Test.yml b/.github/workflows/Test.yml new file mode 100644 index 00000000..c1433401 --- /dev/null +++ b/.github/workflows/Test.yml @@ -0,0 +1,57 @@ +name: Code Coverage + +on: + push: + branches: + - 'main' + pull_request: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + test: + name: Test + runs-on: ${{ matrix.os }} + strategy: + matrix: + python-version: ['3.10', '3.11', '3.12', '3.13'] + os: [ubuntu-latest, windows-latest, macos-latest] + fail-fast: false + env: + OS: ${{ matrix.os }} + PYTHON_VERSION: ${{ matrix.python-version }} + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup uv + uses: astral-sh/setup-uv@v3 + with: + enable-cache: true + cache-suffix: ${{ env.PYTHON_VERSION }}_${{ env.OS }} + + - name: Install Dependencies + run: | + uv python pin ${{ env.PYTHON_VERSION }} + uv sync --group test + + - name: Run tests + run: uv run pytest --cov=nonebot_plugin_tetris_stats --cov-report xml + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} + env_vars: OS,PYTHON_VERSION + + check: + if: always() + needs: test + runs-on: ubuntu-latest + steps: + - name: Decide whether the needed jobs succeeded or failed + uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe + with: + jobs: ${{ toJSON(needs) }}