-
Notifications
You must be signed in to change notification settings - Fork 45
90 lines (87 loc) · 3.72 KB
/
python-app.yml
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Python application
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build-baseline:
runs-on: ubuntu-latest
container:
image: python:3.6.0
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: |
# Run as a non-root user to avoid cheribuild errors
adduser --disabled-password --gecos "Not Root" notroot
su -c "python -m pip install --user --upgrade pip" notroot
su -c " pip install --user --upgrade flake8 pytest" notroot
su -c "if [ -f requirements.txt ]; then pip install --user -r requirements.txt; fi" notroot
- name: Lint with flake8
run: |
# stop the build if there are any flake8 warnings
su -c "python -m flake8" notroot
- name: Run basic regression tests
run: su -c "tests/run_basic_tests.sh" notroot
build-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: |
# Use the system-provided python3 instead of actions/setup-python@v4
python3 --version
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade flake8 pytest ruff pre-commit
if [ -f requirements.txt ]; then python3 -m pip install -r requirements.txt; fi
- name: Lint with flake8
run: flake8
- name: Lint with ruff
run: ruff check .
- name: Run pre-commit checks
run: pre-commit run --all-files
- name: Run basic regression tests
run: tests/run_basic_tests.sh
build-latest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade flake8 ruff pre-commit
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: flake8
- name: Lint with ruff
run: ruff check .
- name: Run pre-commit checks
run: pre-commit run --all-files
- name: Run basic regression tests
run: tests/run_basic_tests.sh
typecheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# Need at least python 3.8 to allow pytype to parse all the features we make use of
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: '3.8'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade pytype
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Run pytype
run: |
pytype --config pytype.cfg --python-version 3.8 -j `nproc`