Skip to content

Commit

Permalink
Updated to python 3.11 #631 (#649)
Browse files Browse the repository at this point in the history
* Updated the docker file

* update CI files to test python 3.11

* updated toml file

* updated md file

* See if this will fix the problem running the unit test result uploader functionality on Windows.

* Let's try publishing the test results from ubuntu instead of Windows.

* Oops

Co-authored-by: Rob Barry <[email protected]>
  • Loading branch information
nimshi89 and Rob Barry authored Nov 28, 2022
1 parent 0e7f71c commit c6ee18f
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 36 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:
matrix:
# Test on Windows + Ubuntu on oldest + newest supported versions of python.
python-version: ['3.9', '3.10']
python-version: ['3.9', '3.11']
os: [ubuntu-latest, windows-latest]
uses: ./.github/workflows/reusable-test.yaml
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ jobs:
strategy:
matrix:
# Test on linux with the oldest and newest versions of python.
python-version: ['3.9', '3.10']
python-version: ['3.9', '3.11']
os: [ubuntu-latest]
include:
# Test in windows with the newest supported version of python.
- os: windows-latest
python-version: '3.10'
python-version: '3.11'

uses: ./.github/workflows/reusable-test.yaml
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
matrix:
# Test in all supported versions of python in both Windows and Ubuntu.
python-version: ['3.9', '3.10']
python-version: ['3.9', '3.10', '3.11']
os: [ubuntu-latest, windows-latest]
uses: ./.github/workflows/reusable-test.yaml
with:
Expand Down
25 changes: 11 additions & 14 deletions .github/workflows/reusable-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
if: inputs.os == 'ubuntu-latest'
run: poetry run behave tests/behaviour --tags=-skip --junit --format progress

- name: Upload unit & behave test results from xml files
- name: Archive unit & behave test results from xml files
if: always()
uses: actions/upload-artifact@v3
with:
Expand All @@ -81,25 +81,22 @@ jobs:
pytest_results.xml
reports/*.xml
publish_test_results:
needs: [test_in_environments]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: ${{ inputs.os }}-python${{ inputs.python-version }} behave test results

- name: Remove broken characters from xml test files
# By removing broken characters from the xml unit/behave test files, we can then publish the tests results stored
# in those files in a user friendly way on github actions using 'EnricoMi/publish-unit-test-result-action@v1'.
if: always()
run: sed -i -e "s/[\\x0A\\x1B]//g" reports/TESTS-*.xml

# Windows needs to run the `composite` action
- name: Publish Unit & Behave Test Results (Windows)
if: always() && inputs.os == 'windows-latest'
uses: EnricoMi/publish-unit-test-result-action/composite@v2
with:
check_name: ${{ inputs.os }}-python${{ inputs.python-version }} test results
junit_files: |
reports/*.xml
pytest_results.xml
# Slightly more performant to run the non-composite action in ubuntu.
- name: Publish Unit & Behave Test Results (Ubuntu)
if: always() && inputs.os == 'ubuntu-latest'
- name: Publish Unit & Behave Test Results
if: always()
uses: EnricoMi/publish-unit-test-result-action@v2
with:
check_name: ${{ inputs.os }}-python${{ inputs.python-version }} test results
Expand Down
7 changes: 3 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
FROM gsscogs/pythonversiontesting:v1.0.3

FROM gsscogs/pythonversiontesting:v1.0.4
ARG VENV_PATH=/csvcubed-venv
ARG VENV_PIP=${VENV_PATH}/bin/pip
ARG VENV_POETRY=${VENV_PATH}/bin/poetry


RUN pyenv global 3.10.0
RUN pyenv global 3.11.0

RUN mkdir -p /workspace

Expand All @@ -31,7 +30,7 @@ RUN ${VENV_PIP} install poetry
RUN python3 -m pip install mkdocs mkdocs-material mkdocs-mermaid2-plugin

# Patch behave
RUN patch -Nf -d "${VENV_PATH}/lib/python3.10/site-packages/behave/formatter" -p1 < /cucumber-format.patch
RUN patch -Nf -d "${VENV_PATH}/lib/python3.11/site-packages/behave/formatter" -p1 < /cucumber-format.patch

RUN rm -rf /workspace/*

Expand Down
7 changes: 4 additions & 3 deletions external-docs/docs/guides/installing-python.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ csvcubed requires python to function. It has been tested with versions:

* 3.9
* 3.10
* 3.11

If you do not have a favoured way of managing your python environment or packages, we recommend using [miniconda](https://docs.conda.io/en/latest/miniconda.html). You should not use your system installation of python especially on MacOS or Linux as this may impact other system-critical functions.

Expand All @@ -14,14 +15,14 @@ To install miniconda, go to [this link](https://docs.conda.io/projects/conda/en/
Once you have installed miniconda, you will need to configure an environment specifically for csvcubed:

```bash
# create a new environment using python 3.10
conda create -n csvcubed python='3.10' -y
# create a new environment using python 3.11
conda create -n csvcubed python='3.11' -y
```

If you are using miniconda, you must be inside your `csvcubed` environment before running any commands:

```bash
# enter the csvcubed python 3.10 environment
# enter the csvcubed python 3.11 environment
conda activate csvcubed
```

Expand Down
20 changes: 10 additions & 10 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ version = "0.1.0-dev"

[tool.poetry.dependencies]
pandas = "^1.3.3"
python = "^3.9"
python = ">=3.9,<=3.11"
jsonschema = "^4.4.0"
appdirs = "^1.4.4"
requests = "^2.27.1"
Expand Down

0 comments on commit c6ee18f

Please sign in to comment.