From 332a86e13c1d05a66aa72ee6f4f42898fd25c603 Mon Sep 17 00:00:00 2001 From: Nicholas Kumia Date: Fri, 28 Apr 2023 12:26:54 -0400 Subject: [PATCH 1/2] refactor: abstract python version + add names - I needed to specify the python version for poetry to work properly... I didn't have python 3.9 installed... https://github.com/python-poetry/poetry/issues/1735#issuecomment-565501611 - Don't limit python version to ^3.9, but we should support all newer version as well - Add titles to make the Github Action page easier to read --- .github/workflows/test.yml | 30 ++++++++++++++++++------------ pyproject.toml | 2 +- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3e15cf3d..aa7b42a2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,25 +1,38 @@ -name: lint and tests +name: Tests on Commit on: [push, pull_request] +env: + PY_VERSION: '3.9' + jobs: + lint: + runs-on: ubuntu-latest + name: Python Lint + steps: + - uses: actions/checkout@v3 + - uses: chartboost/ruff-action@v1 + test: runs-on: ubuntu-latest + name: Pytests steps: - name: Check out the code - uses: actions/checkout@v1 + uses: actions/checkout@v3 with: fetch-depth: 1 - - name: Set up Python 3.9 + - name: Set up Python ${{ env.PY_VERSION }} uses: actions/setup-python@v3 with: - python-version: 3.9 + python-version: ${{ env.PY_VERSION }} - name: Install Poetry run: curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py | python - - name: Install Dependencies - run: poetry install + run: | + poetry env use ${{ env.PY_VERSION }} + poetry install - name: Run Pytest run: poetry run pytest --junitxml=pytest.xml --cov=datagovharvester | tee pytest-coverage.txt @@ -30,10 +43,3 @@ jobs: pytest-coverage-path: pytest-coverage.txt junitxml-path: pytest.xml github-token: ${{ secrets.GITHUB_TOKEN }} - - lint: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - uses: chartboost/ruff-action@v1 diff --git a/pyproject.toml b/pyproject.toml index 70ac766c..696fcfc2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ readme = "README.md" packages = [{include = "datagovharvester"}] [tool.poetry.dependencies] -python = "^3.9" +python = ">=3.9" jsonschema = "^4.17.3" [tool.poetry.group.dev.dependencies] From 200f4e76af5a2dabf47dd7c752e3829189fc6bc2 Mon Sep 17 00:00:00 2001 From: Tyler Burton Date: Mon, 8 May 2023 10:17:38 -0500 Subject: [PATCH 2/2] trigger actions