Repository navigation
90 lines (80 loc) · 3.33 KB
/
Copy pathbackend-checks.yml
File metadata and controls
90 lines (80 loc) · 3.33 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
name: Backend Checks
on:
# Nightly calls run these same jobs against one immutable main snapshot.
workflow_call:
inputs:
nightly_main_sha:
description: Main SHA pinned by the unfiltered nightly caller
type: string
required: false
default: ''
push:
branches: main
pull_request:
branches: main
concurrency:
group: backend-checks-${{ github.event.pull_request.number || github.ref }}-${{ inputs.nightly_main_sha != '' && format('nightly-{0}', github.run_id) || 'normal' }}
# A newer PR push supersedes that PR's older run. A newer main push must not
# cancel the running one: with cancel-in-progress false GitHub replaces only
# the pending run in the group, so the running SHA finishes and the newest
# pending SHA runs next — main always gets a complete run.
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
# Abort a stalled git HTTP transfer instead of hanging. Hosted-runner fetches
# from github.com intermittently stop receiving data for 7-10 minutes before
# the connection resets (Backend Hermetic E2E run 39435458398 spent 498 s in
# "Checkout code" and hit its 10-minute cap). With these set, git aborts any
# transfer that stays under 1 KB/s for 60 s, and actions/checkout retries the
# fetch (its built-in 3 attempts); a healthy depth-1 fetch takes ~20 s.
# Applies to every git network call in the workflow, including script steps.
GIT_HTTP_LOW_SPEED_LIMIT: "1000"
GIT_HTTP_LOW_SPEED_TIME: "60"
jobs:
changes:
name: Detect Changes
runs-on: ubuntu-latest
outputs:
diff_base: ${{ steps.changes.outputs.diff_base }}
has_backend_runtime_env: ${{ inputs.nightly_main_sha != '' && 'true' || (steps.changes.outputs.has_backend_runtime_env) }}
steps:
- name: Checkout code
uses: actions/checkout@v7
with:
ref: ${{ inputs.nightly_main_sha || github.sha }}
fetch-depth: 0
- name: Detect changed paths
id: changes
uses: ./.github/actions/detect-changes
static-contracts:
name: Static Contracts
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.has_backend_runtime_env == 'true'
steps:
- name: Checkout code
uses: actions/checkout@v7
with:
ref: ${{ inputs.nightly_main_sha || github.sha }}
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version-file: backend/.python-version
- name: Set up uv
uses: astral-sh/setup-uv@ecd24dd710f2fb0dca1693a67af11fc4a5c5ec84
with:
# Exact version resolves locally; an unset version means "latest",
# which fetches the astral-sh/versions manifest and has hard-failed
# CI on that network call. Matches backend/Dockerfile UV_VERSION.
version: "0.11.13"
enable-cache: true
cache-dependency-glob: backend/pylock*.toml
- name: Install pinned backend dependencies
working-directory: backend
run: uv pip sync pylock.toml --system
- name: Check backend runtime env manifest
if: needs.changes.outputs.has_backend_runtime_env == 'true'
run: |
CLOUD_RUN_VPC_NETWORK=offline-check-network \
CLOUD_RUN_VPC_SUBNET=offline-check-subnet \
backend/scripts/pre-deploy-check.sh