From 778be6a5615e9ca28117a3711098f84900cc9c9b Mon Sep 17 00:00:00 2001 From: Mix <32300164+mnixry@users.noreply.github.com> Date: Mon, 18 Mar 2024 21:49:21 +0800 Subject: [PATCH] Add CI workflow for linting and testing --- .github/workflows/ci.yml | 69 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..b041196 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,69 @@ +name: Test & Lint + +on: + push: + pull_request: + +jobs: + lint: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: pdm-project/setup-pdm@v4 + with: + python-version: "3.10" + cache: true + + - name: Install dependencies + run: | + pdm install -G :all + echo `dirname $(pdm info --python)` >> $GITHUB_PATH + + - name: Lint with Ruff + continue-on-error: true + run: pdm lint --output-format github + + - name: Lint with Pyright + uses: jakebailey/pyright-action@v2 + continue-on-error: true + with: + pylance-version: latest-release + + test: + strategy: + matrix: + python-version: ["3.10", "3.11", "3.12"] + os: [ubuntu-latest, windows-latest, macos-latest] + fail-fast: false + + runs-on: ${{ matrix.os }} + + env: + OS: ${{ matrix.os }} + PYTHON_VERSION: ${{ matrix.python-version }} + + steps: + - uses: actions/checkout@v4 + + - uses: pdm-project/setup-pdm@v4 + with: + python-version: ${{ matrix.python-version }} + cache: true + + - name: Install dependencies + shell: bash + run: | + pdm install -G :all + echo `dirname $(pdm info --python)` >> $GITHUB_PATH + + - name: Run tests + run: pdm test + + - uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: .coverage + env_vars: PYTHON_VERSION,OS + fail_ci_if_error: true