From 4dafbe6ac151f3f4ea1e20e5b7308b7769f8a9a2 Mon Sep 17 00:00:00 2001 From: Xevion Date: Thu, 18 Feb 2021 20:06:42 -0600 Subject: [PATCH 1/3] Add GitHub Action for Pytest May add linting or more in later versions. --- .github/workflows/python-app.yml | 34 ++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/python-app.yml diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml new file mode 100644 index 0000000..203579c --- /dev/null +++ b/.github/workflows/python-app.yml @@ -0,0 +1,34 @@ +# This workflow will install Python dependencies, run tests and lint with a single version of Python +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +name: Python application + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Setup Python 3.7.7 + uses: actions/setup-python@v2 + with: + python-version: 3.7.7 + + - name: Setup Pipenv + uses: dschep/install-pipenv-action@v1 + + - name: Install dependencies + run: | + # python -m pip install --upgrade pip + pipenv install -r requirements.txt + + - name: Run tests + run: pipenv run pytest From 08a34b718249250fb57cca6a3d3c425a4c056f29 Mon Sep 17 00:00:00 2001 From: Xevion Date: Thu, 18 Feb 2021 20:10:36 -0600 Subject: [PATCH 2/3] Install dependencies in GH Action with pipenv correctly Accidentally forgot that we're not using requirements.txt anymore. This should be the correct way of using pipenv. (?) --- .github/workflows/python-app.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 203579c..4237762 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -27,8 +27,7 @@ jobs: - name: Install dependencies run: | - # python -m pip install --upgrade pip - pipenv install -r requirements.txt + pipenv install --dev - name: Run tests run: pipenv run pytest From 8a1a2df2c1c3ac60c82f3981c8fa605d745425e6 Mon Sep 17 00:00:00 2001 From: Xevion Date: Thu, 18 Feb 2021 23:46:05 -0600 Subject: [PATCH 3/3] Fix pipenv failing to import sqlalchemy-json 'sqlalchemy_json' does not import when running pytest through pipenv. Prepending 'python -m' to the pytest command fixes this (although I'm not sure why it even fails to import a global module). Hope this works in the GitHub Actions workflow. --- .github/workflows/python-app.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 4237762..7c16d53 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -30,4 +30,4 @@ jobs: pipenv install --dev - name: Run tests - run: pipenv run pytest + run: pipenv run python -m pytest