Skip to content

Commit

Permalink
Try github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Ledez committed Oct 4, 2023
1 parent 886b7cb commit e76c20b
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 1 deletion.
51 changes: 51 additions & 0 deletions .github/workflows/python-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Python application

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

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Set up Python 3.11
id: setup-python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
- name: Install project
run: poetry install --no-interaction
- name: Lint with flake8
run: |
source .venv/bin/activate
# stop the build if there are Python syntax errors or undefined names
flake8 cgwire_checks.py test_cgwire_checks.py --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 cgwire_checks.py test_cgwire_checks.py --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
source .venv/bin/activate
pytest
coverage report
55 changes: 54 additions & 1 deletion poetry.lock

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

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ requests = "^2.31.0"
pytest-cov = "^4.1.0"
pytest = "^7.4.2"
coveralls = "^3.3.1"
flake8 = "^6.1.0"

[build-system]
requires = ["poetry-core"]
Expand Down

0 comments on commit e76c20b

Please sign in to comment.