Skip to content

Commit 7469886

Browse files
authored
Python 3.11 - Maxwell, testing CI (#46)
* upgrade to python 3.11 * update CI workflow to newer versions * update common to fix imports, update CI
1 parent 0add7f5 commit 7469886

File tree

6 files changed

+67
-15
lines changed

6 files changed

+67
-15
lines changed

.github/workflows/run-tests.yml

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# This workflow will install Python dependencies and run tests with PyTest using Python 3.8
2-
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
1+
# This workflow will install Python dependencies and run tests with PyTest using Python 3.11
2+
# For more information see: https://docs.github.com/en/actions/about-github-actions
33

44
name: Run tests
55

@@ -15,27 +15,36 @@ jobs:
1515

1616
steps:
1717
# Checkout repository
18-
- uses: actions/checkout@v3
18+
- name: Checkout code
19+
uses: actions/checkout@v4
1920
with:
20-
submodules: 'true'
21+
submodules: recursive
2122

2223
# Set Python version
23-
- name: Set up Python 3.8
24-
uses: actions/setup-python@v4
24+
- name: Set up Python 3.11
25+
uses: actions/setup-python@v5
2526
with:
26-
python-version: 3.8
27+
python-version: 3.11
2728

28-
# Set up submodules and submodule dependencies
29-
- name: Set up submodule and submodule dependencies
29+
# Upgrade pip
30+
- name: Upgrade pip
3031
run: |
31-
pip install -r ./modules/common/requirements.txt
32+
python -m pip install --upgrade pip
33+
34+
# Set up submodules
35+
- name: Set up all submodules and project dependencies
36+
run: |
37+
git submodule foreach --recursive "pip install -r requirements.txt"
3238
3339
# Install project dependencies
3440
- name: Install project dependencies
3541
run: |
36-
python -m pip install --upgrade pip
3742
pip install -r requirements.txt
3843
44+
# Install zbar library to resolve pyzbar import error
45+
- name: Install zbar library
46+
run: sudo apt-get install libzbar0
47+
3948
# Run linters and formatters
4049
- name: Linters and formatters
4150
run: |

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[submodule "modules/common"]
22
path = modules/common
3-
url = git@github.com:UWARG/common.git
3+
url = https://github.com/UWARG/common.git

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs = 0
2828

2929
# Minimum Python version to use for version dependent checks. Will default to the
3030
# version used to run pylint.
31-
py-version = "3.8"
31+
py-version = "3.11"
3232

3333
# Discover python modules and packages in the file system subtree.
3434
recursive = true
@@ -105,7 +105,7 @@ addopts = "--ignore=modules/common/"
105105

106106
[tool.black]
107107
line-length = 100
108-
target-version = ["py38"]
108+
target-version = ["py311"]
109109
# Excludes files or directories in addition to the defaults
110110
# Submodules
111111
extend-exclude = "modules/common/*"

setup_project.ps1

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Initialize the project for Windows
2+
3+
# Activate venv to prevent accidentally installing into global space
4+
./venv/Scripts/Activate.ps1
5+
6+
if($?) {
7+
# If successfully activated venv
8+
"Installing project dependencies..."
9+
pip install -r requirements.txt
10+
11+
""
12+
"Installing submodules and their dependencies..."
13+
git submodule update --init --remote --recursive
14+
git submodule foreach --recursive "pip install -r requirements.txt"
15+
16+
deactivate
17+
""
18+
"Seutp complete!"
19+
} else {
20+
"Please install a virtual environment in the directory 'venv', at the project root directory"
21+
}

setup_project.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
3+
# Initialize and update submodules script for Linux
4+
5+
# Activate venv to prevent accidentally installing into global space
6+
source ./venv/bin/activate
7+
8+
if [ $? -eq 0 ]; then
9+
echo "Installing project dependencies..."
10+
pip install -r requirements.txt
11+
12+
echo ""
13+
echo "Installing submodules and their dependencies..."
14+
git submodule update --init --remote --recursive
15+
git submodule foreach --recursive "pip install -r requirements.txt"
16+
17+
deactivate
18+
echo ""
19+
echo "Setup complete!"
20+
else
21+
echo "Please install a virtual environment in the directory 'venv', at the project root directory"
22+
fi

0 commit comments

Comments
 (0)