forked from openai/retro
-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (79 loc) · 2.38 KB
/
python.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
91
92
93
94
95
96
97
################################################################################
#
# Copyright (C) 2024 retro.ai
# This file is part of retro3 - https://github.com/retroai/retro3
#
# SPDX-License-Identifier: AGPL-3.0-or-later
# See the file LICENSE.txt for more information.
#
################################################################################
name: Python CI
on: [push, pull_request]
jobs:
build-and-deploy:
# The type of runner that the job will run on
runs-on: ${{ matrix.os }}
defaults:
run:
# Set the working directory to frontend folder
working-directory: src/learning
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-20.04
python-version: '3.10'
- os: ubuntu-22.04
python-version: '3.12'
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
- name: Cache OpenAI modules
id: cache-openai
uses: actions/cache@v4
with:
path: openai
key: cache-openai-${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('openai/**') }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install OpenAI dependencies
if: steps.cache-openai.outputs.cache-hit != 'true'
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
cmake \
libgtest-dev
python3 -m pip install --upgrade pip setuptools setuptools_scm
- name: Build OpenAI modules
if: steps.cache-openai.outputs.cache-hit != 'true'
run: |
cd ../../openai
cmake .
make -j
- name: Install poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
- name: Configure Poetry
run: |
poetry config virtualenvs.create false
- name: Install Python dependencies
run: |
poetry install
- name: Check formatting with Black
run: |
poetry run black --check .
- name: Lint with Flake8
run: |
poetry run flake8 .
- name: Sort imports with isort
run: |
poetry run isort . --check-only
- name: Type check with mypy
run: |
poetry run mypy . --check-untyped-defs
- name: Run test cases
run: |
poetry run pytest