testy nad pull requesty a nad main
binárka / linux (pull_request) Successful in 10s
testy / pytest (3.11) (pull_request) Successful in 1s
testy / pytest (3.12) (pull_request) Successful in 2s
testy / pytest (3.13) (pull_request) Successful in 2s
testy / pytest (3.14) (pull_request) Successful in 3s
binárka / linux (pull_request) Successful in 10s
testy / pytest (3.11) (pull_request) Successful in 1s
testy / pytest (3.12) (pull_request) Successful in 2s
testy / pytest (3.13) (pull_request) Successful in 2s
testy / pytest (3.14) (pull_request) Successful in 3s
Matice Python 3.11 až 3.14 — u projektu, který deklaruje >=3.11, se hodí vědět, že to na všech čtyřech opravdu jede. Pythony obstará uv, na hostiteli nemusí být žádný. K pytestu ještě skriptovaná partie v terminálové verzi. Pytest sahá na core.py, prompty v dice.py nikdo netestoval; tohle projde dvě nuly, třetí s vynulováním a výhru tak, jak to odehraje člověk. Runner sdílí pracovní adresář mezi variantami matice, proto max-parallel 1. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b4864981ad
commit
2a03474af8
2 files changed
+73
No files matched your search
@@ -0,0 +1,69 @@
|
||||
# Testy nad každým pull requestem a nad main.
|
||||
#
|
||||
# Runner běží v host módu, takže tu není kontejner ani hotové akce
|
||||
# z marketplace. Pythony obstará uv, na hostiteli nemusí být žádný.
|
||||
name: testy
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: testy-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
pytest:
|
||||
runs-on: homelab
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
# Runner sdílí pracovní adresář mezi variantami, takže po jedné.
|
||||
max-parallel: 1
|
||||
matrix:
|
||||
python: ["3.11", "3.12", "3.13", "3.14"]
|
||||
|
||||
steps:
|
||||
- name: Zdrojáky
|
||||
env:
|
||||
TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
git init -q .
|
||||
git remote remove origin 2>/dev/null || true
|
||||
git remote add origin "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git"
|
||||
git config http.extraheader "Authorization: token ${TOKEN}"
|
||||
git fetch -q --depth 1 origin "${GITHUB_REF}"
|
||||
git config --unset http.extraheader
|
||||
git checkout -qf FETCH_HEAD
|
||||
git clean -qfd
|
||||
|
||||
- name: uv
|
||||
run: |
|
||||
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
|
||||
export PATH="$HOME/.local/bin:$PATH"
|
||||
command -v uv >/dev/null || curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||
uv python install "${{ matrix.python }}"
|
||||
|
||||
- name: Testy
|
||||
run: |
|
||||
uv run --managed-python --python "${{ matrix.python }}" \
|
||||
--with-requirements requirements.txt --no-project \
|
||||
pytest -q
|
||||
|
||||
- name: Terminálová verze
|
||||
run: |
|
||||
# Pytest sahá na core.py, ne na prompty. Tohle projde celou partii
|
||||
# tak, jak ji odehraje člověk: dvě nuly, třetí vynuluje, výhra.
|
||||
out=$(printf 'A\nB\n\n1000\n\n200\n10\n0\n10\n0\n10\n0\n\n1000\n' \
|
||||
| TERM=dumb uv run --managed-python --python "${{ matrix.python }}" dice.py)
|
||||
|
||||
for expected in "200xx" "Po třech nulových hodech" "Vítězem se stává B"; do
|
||||
printf '%s' "$out" | grep -qF "$expected" || {
|
||||
echo "chybí: $expected"
|
||||
printf '%s\n' "$out"
|
||||
exit 1
|
||||
}
|
||||
done
|
||||
echo "terminálová verze v pořádku"
|
||||
@@ -156,3 +156,7 @@ uv run --with-requirements requirements.txt --no-project pytest
|
||||
```
|
||||
|
||||
Nebo z připraveného prostředí prostě `pytest`.
|
||||
|
||||
Nad každým pull requestem a nad `main` běží `.gitea/workflows/testy.yml` —
|
||||
84 testů na Pythonu 3.11, 3.12, 3.13 i 3.14, a k tomu skriptovaná partie
|
||||
v terminálové verzi, na kterou pytest nesahá.
|
||||
Reference in new issue
Block a user