Skip to content

Commit

Permalink
Python 3.11 - Maxwell, testing CI (#46)
Browse files Browse the repository at this point in the history
* upgrade to python 3.11

* update CI workflow to newer versions

* update common to fix imports, update CI
  • Loading branch information
maxlou05 authored Aug 29, 2024
1 parent 0add7f5 commit 7469886
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 15 deletions.
31 changes: 20 additions & 11 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This workflow will install Python dependencies and run tests with PyTest using Python 3.8
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
# This workflow will install Python dependencies and run tests with PyTest using Python 3.11
# For more information see: https://docs.github.com/en/actions/about-github-actions

name: Run tests

Expand All @@ -15,27 +15,36 @@ jobs:

steps:
# Checkout repository
- uses: actions/checkout@v3
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: 'true'
submodules: recursive

# Set Python version
- name: Set up Python 3.8
uses: actions/setup-python@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: 3.11

# Set up submodules and submodule dependencies
- name: Set up submodule and submodule dependencies
# Upgrade pip
- name: Upgrade pip
run: |
pip install -r ./modules/common/requirements.txt
python -m pip install --upgrade pip
# Set up submodules
- name: Set up all submodules and project dependencies
run: |
git submodule foreach --recursive "pip install -r requirements.txt"
# Install project dependencies
- name: Install project dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
# Install zbar library to resolve pyzbar import error
- name: Install zbar library
run: sudo apt-get install libzbar0

# Run linters and formatters
- name: Linters and formatters
run: |
Expand Down
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "modules/common"]
path = modules/common
url = git@github.com:UWARG/common.git
url = https://github.com/UWARG/common.git
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs = 0

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

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

[tool.black]
line-length = 100
target-version = ["py38"]
target-version = ["py311"]
# Excludes files or directories in addition to the defaults
# Submodules
extend-exclude = "modules/common/*"
21 changes: 21 additions & 0 deletions setup_project.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Initialize the project for Windows

# Activate venv to prevent accidentally installing into global space
./venv/Scripts/Activate.ps1

if($?) {
# If successfully activated venv
"Installing project dependencies..."
pip install -r requirements.txt

""
"Installing submodules and their dependencies..."
git submodule update --init --remote --recursive
git submodule foreach --recursive "pip install -r requirements.txt"

deactivate
""
"Seutp complete!"
} else {
"Please install a virtual environment in the directory 'venv', at the project root directory"
}
22 changes: 22 additions & 0 deletions setup_project.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

# Initialize and update submodules script for Linux

# Activate venv to prevent accidentally installing into global space
source ./venv/bin/activate

if [ $? -eq 0 ]; then
echo "Installing project dependencies..."
pip install -r requirements.txt

echo ""
echo "Installing submodules and their dependencies..."
git submodule update --init --remote --recursive
git submodule foreach --recursive "pip install -r requirements.txt"

deactivate
echo ""
echo "Setup complete!"
else
echo "Please install a virtual environment in the directory 'venv', at the project root directory"
fi

0 comments on commit 7469886

Please sign in to comment.