-
Notifications
You must be signed in to change notification settings - Fork 0
156 lines (126 loc) · 4.07 KB
/
ci.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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
name: CI
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
env:
PYTHON_VERSION: '3.10'
POETRY_VERSION: '1.8.2'
jobs:
code-quality:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- uses: Gr1N/setup-poetry@v9
with:
poetry-version: ${{ env.POETRY_VERSION }}
- uses: actions/cache@v4
with:
path: ~/.cache/pypoetry/virtualenvs
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}
- run: poetry --version
- name: Install dev dependencies
id: install
run: poetry install # Install all dependencies including dev
- name: Ruff Lint
if: steps.install.outcome == 'success'
id: ruff-lint
run: |
poetry run ruff check > ruff-lint.log
ruff_check_exit_code=$?
cat ruff-lint.log
exit $ruff_check_exit_code
- name: Ruff Format
if: always() && steps.install.outcome == 'success'
id: ruff-format
run: |
set -o pipefail
poetry run ruff format --check 2>&1 | tee ruff-format.log
- name: Post Summary
if: always()
run: |
echo "### Ruff Lint Results" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
LINT_LOG=$(cat ruff-lint.log || echo "No lint log found.")
echo "$LINT_LOG" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo "### Ruff Format Results" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
FORMAT_LOG=$(cat ruff-format.log || echo "No format log found.")
echo "$FORMAT_LOG" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
unit-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- uses: Gr1N/setup-poetry@v9
with:
poetry-version: ${{ env.POETRY_VERSION }}
- uses: actions/cache@v4
with:
path: ~/.cache/pypoetry/virtualenvs
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}
- run: poetry --version
- name: Install dependencies
id: install
run: poetry install # Install all dependencies including dev
- name: Run Pytest
if: steps.install.outcome == 'success'
run: |
set -o pipefail
poetry run pytest --maxfail=5 --disable-warnings 2>&1 | tee pytest.log
- name: Post Summary
if: always()
run: |
echo "### Pytest Results" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
TEST_LOG=$(cat pytest.log || echo "No test log found.")
echo "$TEST_LOG" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
integrations-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- uses: Gr1N/setup-poetry@v9
with:
poetry-version: ${{ env.POETRY_VERSION }}
- uses: actions/cache@v4
with:
path: ~/.cache/pypoetry/virtualenvs
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}
- run: poetry --version
- name: Run Poetry Lock
run: poetry lock
- name: Install dependencies
id: install
run: poetry install # Install all dependencies including dev
- name: Run Comeit
if: steps.install.outcome == 'success'
run: |
set -o pipefail
poetry run comeit 2>&1 | tee comeit.log
- name: Post Summary
if: always()
run: |
echo "### Comeit Results" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
COMEIT_LOG=$(cat comeit.log || echo "No comeit log found.")
echo "$COMEIT_LOG" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY