-
Notifications
You must be signed in to change notification settings - Fork 128
180 lines (134 loc) · 4.72 KB
/
ci.yaml
File metadata and controls
180 lines (134 loc) · 4.72 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
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
name: CI dos códigos de aulas
on:
push:
paths:
- 'codigo_das_aulas/**'
- '.github/workflows/**'
- 'tasks.py'
pull_request:
paths:
- 'codigo_das_aulas/**'
- '.github/workflows/**'
- 'tasks.py'
jobs:
containers:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11", "3.12", "3.13", "3.14"]
steps:
- name: Checkout do código
uses: actions/checkout@v4
- name: Instalar o Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Instalar Poetry
run: pip install poetry
- name: Instalar dependências do projeto
run: poetry install --only dev
- name: Rodar os dockers dos códigos de aulas
run: poetry run invoke test-docker-build --python-version=${{ matrix.python-version }}
test-compose:
runs-on: ubuntu-latest
steps:
- name: Checkout do código
uses: actions/checkout@v5
- name: Instalar Python 3.14
uses: actions/setup-python@v6
with:
python-version: 3.14
- name: Instalar Poetry
run: pip install poetry
- name: Instalar dependências do projeto
run: poetry install --only dev
- name: Rodar task de teste do compose
run: poetry run invoke test-compose
windows-hell:
runs-on: windows-latest
env:
PGHOST: localhost
PGDATABASE: app_db
PGUSERNAME: app_user
PGPASSWORD: app_password
DATABASE_URL: postgresql+psycopg://app_user:app_password@localhost:5432/app_db
steps:
- name: Add PostgreSQL binaries to PATH
shell: bash
run: echo "$PGBIN" >> $GITHUB_PATH
- name: Start preinstalled PostgreSQL
shell: bash
run: |
echo "Initializing database cluster..."
# Convert backslashes to forward slashes in RUNNER_TEMP for Windows Git Bash
export PGHOST="${RUNNER_TEMP//\\//}/postgres"
export PGDATA="$PGHOST/pgdata"
mkdir -p "$PGDATA"
# initdb requires file for password in non-interactive mode
export PWFILE="$RUNNER_TEMP/pwfile"
echo "postgres" > "$PWFILE"
initdb --pgdata="$PGDATA" --username="postgres" --pwfile="$PWFILE"
echo "Starting PostgreSQL..."
echo "unix_socket_directories = '$PGHOST'" >> "$PGDATA/postgresql.conf"
pg_ctl start
echo "Creating user..."
psql --host "$PGHOST" --username="postgres" --dbname="postgres" --command="CREATE USER $PGUSERNAME PASSWORD '$PGPASSWORD'" --command="\du"
echo "Creating database..."
createdb --owner="$PGUSERNAME" --username="postgres" "$PGDATABASE"
- name: Copia os arquivos do repo
uses: actions/checkout@v5
- name: Instalar o python
uses: actions/setup-python@v6
with:
python-version: 3.14
- name: Instalar Poetry
run: pip install poetry
- name: Instalar dependências globais
run: poetry install --only dev
- name: Roda os testes da ultima aula (win)
run: poetry run invoke win-test-last-class
- name: Roda as migrações (win)
run: poetry run invoke win-test-migration
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11", "3.12", "3.13", "3.14"]
steps:
- name: Copia os arquivos do repo
uses: actions/checkout@v5
- name: Atualização do sistema
run: sudo apt update
- name: instala o sqlite3
run: sudo apt install sqlite3 -y
- name: Instalar o python
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Instalar Poetry
run: pip install poetry
- name: Instalar dependências do projeto
run: poetry install --only dev
- name: Roda os testes dos códigos de aulas
run: poetry run invoke test-sub
checks:
runs-on: ubuntu-latest
steps:
- name: Copia os arquivos do repo
uses: actions/checkout@v5
- name: Instalar o python
uses: actions/setup-python@v6
with:
python-version: 3.14
- name: Instalar Poetry
run: pip install poetry
- name: Instalar dependências do projeto
run: poetry install --only dev
- name: Roda os linters dos códigos de aulas
run: poetry run invoke lint-sub
- name: Roda os typos dos códigos de aulas
run: poetry run invoke typos-sub
- name: Roda o type-checker co código de aulas
run: poetry run invoke type-check-sub --ci
- name: Testa as migrações
run: poetry run invoke test-migrations