From 4cec6ce888564a5952e794815a1f654158d4a5cc Mon Sep 17 00:00:00 2001 From: Adam Seering Date: Wed, 16 Aug 2023 03:33:07 +0000 Subject: [PATCH] Run pytest tests as pull-request tests --- .github/workflows/publish-to-test-pypi.yml | 27 ++++++++++++++++++++++ pyproject.toml | 5 +++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish-to-test-pypi.yml b/.github/workflows/publish-to-test-pypi.yml index dbfa78e..f5f43b6 100644 --- a/.github/workflows/publish-to-test-pypi.yml +++ b/.github/workflows/publish-to-test-pypi.yml @@ -2,6 +2,33 @@ name: Publish Python 🐍 distributions 📦 to PyPI and TestPyPI on: push jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install gcloud + run: | + sudo apt-get update + sudo apt-get install apt-transport-https ca-certificates gnupg curl sudo + echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list + curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - + sudo apt-get update + sudo apt-get install google-cloud-cli google-cloud-cli-spanner-emulator + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -e '.[test,magic]' + - name: Test with pytest + run: | + python -m pytest + build-n-publish: name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI runs-on: ubuntu-latest diff --git a/pyproject.toml b/pyproject.toml index dd35fa2..2637ca2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,9 +16,12 @@ readme = "README.md" [project.optional-dependencies] test = [ "pytest", - "nbformat" + "nbformat", + "nbconvert", + "jupyter" ] magic = [ + "jupyter-client", "ipython" ]