generated from gma/python-template
-
Notifications
You must be signed in to change notification settings - Fork 0
40 lines (36 loc) · 1.24 KB
/
python-app.yml
File metadata and controls
40 lines (36 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# 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: Python application
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
permissions:
contents: read
jobs:
build:
if: ${{ ! contains(github.repository, 'python-template') }}
runs-on: ubuntu-latest
env:
PYTHONPATH: ${{ github.workspace }}:${{ github.workspace }}/mylib
steps:
- name: Checkout repository code
uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v4
with:
python-version-file: .python-version
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pip-tools
[ -f requirements.txt ] && pip-sync requirements.txt requirements-dev.txt || pip-sync requirements-dev.txt
- name: Run linter
run: make lint
- name: Check formatting
run: make format
- name: Check types
run: make types
- name: Run tests
run: pytest -o console_output_style=classic -v || ([ $? = 5 ] && exit 0 || exit $?)