Repository navigation
74 lines (61 loc) · 2.4 KB
/
Copy pathpython-ci.yml
File metadata and controls
74 lines (61 loc) · 2.4 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
name: Python CI
on:
push:
branches:
- main
pull_request:
branches:
- main
permissions: {}
# Образ латеста пушится из main: параллельные прогоны ждут друг друга, а не
# отменяются, чтобы не оборвать публикацию.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
timeout-minutes: 15
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
# setup-python не нужен: версию питона держит .python-version, и uv сам
# ставит её при первом `uv sync`. Единый источник версии, поэтому раннер
# и образ кита не могут разойтись.
- uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
- name: Install
run: make install
- name: Run linter
run: make lint
# Тестов у примера нет: каждый шаг курса это отдельная ветка-снимок
# приложения, а не покрытый тестами проект. Поэтому в CI только линтер.
deploy:
needs: build
runs-on: ubuntu-latest
timeout-minutes: 15
if: ${{ github.event_name == 'push' }}
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1
- name: Log in to GitHub Container Registry
uses: docker/login-action@81c6f93d4bc991e510b342a00b419b3bb4efc5c6 # v4.7.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7.4.0
with:
context: .
push: true
cache-from: ghcr.io/${{ github.repository }}:latest
cache-to: type=inline
tags: ghcr.io/${{ github.repository }}:latest