Skip to content

Commit

Permalink
Python 3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
entorb committed Apr 29, 2024
1 parent 4bfd5c0 commit b46f089
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 45 deletions.
76 changes: 34 additions & 42 deletions .github/workflows/test-python-app.yml
Original file line number Diff line number Diff line change
@@ -1,55 +1,47 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Test Python application
name: Check and Test Python Project

on:
workflow_dispatch:
push:
branches: [ "main" ]
branches: ["main"]
pull_request:
branches: [ "main" ]
branches: ["main"]

permissions:
contents: read

jobs:
build:

check:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Set up Python cache
uses: actions/cache@v3
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-py-cache

- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Run pre-commit tests
uses: pre-commit/[email protected]

# - name: Lint with flake8
# run: |
# pip install flake8
# # stop the build if there are Python syntax errors or undefined names
# flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics

# - name: Test with pytest
# run: |
# pip install pytest
# pytest
- name: Check out repository
uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 1 # 0 if you want to push to repo

- name: Python set up
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"

- name: Python cache set up
uses: actions/cache@v4
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-py-cache

- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Run pre-commit hooks
uses: pre-commit/[email protected]

# - name: Install and run pytest
# run: |
# pip install pytest
# pytest
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: "v0.4.1"
rev: "v0.4.2"
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand Down Expand Up @@ -116,4 +116,4 @@ repos:
# # - id: perlimports

default_language_version:
python: python3.10
python: python3.12
2 changes: 1 addition & 1 deletion .ruff.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
fix = true # auto-fix findings
line-length = 88 # same as Black
target-version = "py310" # Python 3.10
target-version = "py312" # Python 3.12

[lint]
# comment this out to use only default rules (["E4", "E7", "E9", "F"])
Expand Down

0 comments on commit b46f089

Please sign in to comment.