From 6843e1c5765868acd9260c9919c9d528712c1ae1 Mon Sep 17 00:00:00 2001 From: "Dustin J. Mitchell" Date: Sat, 4 Jan 2025 10:42:42 -0500 Subject: [PATCH] Run pytest from source and on built wheel (#34) --- .github/workflows/ci.yml | 17 ++++++++++++++- .github/workflows/tests.yml | 43 +++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ae23c5b..4c70e59 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -181,6 +181,21 @@ jobs: command: upload args: --non-interactive --skip-existing wheels-*/* + pytest-linux: + runs-on: ubuntu-latest + name: "Python Tests (on built wheel)" + needs: linux + steps: + - uses: actions/checkout@v4 + - uses: actions/download-artifact@v4 + - uses: actions/setup-python@v5 + with: + python-version: 3.9 + - run: pip install poetry + - run: poetry install + - run: poetry run pip install wheels-linux-x86_64/* + - run: poetry run pytest + stubtest: runs-on: ubuntu-latest name: "Stub Test" @@ -192,4 +207,4 @@ jobs: python-version: 3.9 - run: pip install wheels-linux-x86_64/* - run: pip install mypy - - run: python -m mypy.stubtest taskchampion --ignore-missing-stub + - run: python -m mypy.stubtest taskchampion --ignore-missing-stub \ No newline at end of file diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..c0d44f2 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,43 @@ +name: tests + +on: + push: + branches: + - master + pull_request: + types: [opened, reopened, synchronize] + +jobs: + test: + runs-on: ubuntu-latest + name: "Python Tests" + + steps: + - uses: actions/checkout@v4 + + - name: Cache cargo registry + uses: actions/cache@v4 + with: + path: ~/.cargo/registry + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} + + - name: Cache cargo build + uses: actions/cache@v4 + with: + path: target + key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} + + - uses: actions-rs/toolchain@v1 + with: + toolchain: "1.78.0" # MSRV + override: true + components: clippy + + - uses: actions/setup-python@v5 + with: + python-version: 3.9 + + - run: pip install poetry + - run: poetry install + - run: poetry run maturin develop + - run: poetry run pytest