Skip to content

Commit e2a00d5

Browse files
Add bootstrap GH Action flow
Add bootstraph GH Action flow commit_hash:7d9afe2b10013941a268487fdd101293f6a45493
1 parent 78bbea0 commit e2a00d5

5 files changed

Lines changed: 140 additions & 12 deletions

File tree

.github/workflows/bootstrap.yml

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
name: Bootstrap ya-bin
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths: ['devtools/ya/bootstrap/graph.json']
7+
workflow_dispatch: # allow manual runs for debugging
8+
9+
jobs:
10+
bootstrap:
11+
runs-on: self-hosted
12+
if: github.ref == 'refs/heads/main'
13+
timeout-minutes: 180
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
19+
- name: Run bootstrap (stage 1 + stage 2)
20+
run: |
21+
mkdir -p "$RUNNER_TEMP/ya-bootstrap-result"
22+
python3 devtools/ya/bootstrap/run_bootstrap.py \
23+
--source-root "$GITHUB_WORKSPACE" \
24+
--result-root "$RUNNER_TEMP/ya-bootstrap-result" \
25+
--all-platforms-build \
26+
--cleanup
27+
28+
- name: Verify stage 1 artifacts
29+
run: |
30+
set -euo pipefail
31+
32+
STAGE1="$RUNNER_TEMP/ya-bootstrap-result/stage1"
33+
34+
echo "=== Checking stage1 artifacts in $STAGE1 ==="
35+
36+
for bin in ya-bin ymake; do
37+
path="$STAGE1/$bin"
38+
39+
if [ ! -f "$path" ]; then
40+
echo "ERROR: $path not found"
41+
exit 1
42+
fi
43+
44+
echo "--- Running $bin --help ---"
45+
"$path" --help
46+
echo "OK: $bin exited with code $?"
47+
done
48+
49+
- name: Verify stage 2 artifacts
50+
run: |
51+
set -euo pipefail
52+
53+
STAGE2="$RUNNER_TEMP/ya-bootstrap-result/stage2"
54+
PLATFORM_LIST="$GITHUB_WORKSPACE/devtools/ya/bootstrap/platform_list"
55+
56+
MAIN_BINS="ya-bin ymake ya-tc"
57+
EXISTENCE_ONLY_BINS="test_tool"
58+
ADDITIONAL_BINS="yexport"
59+
60+
LINUX_X86_PLATFORM="default-linux-x86_64"
61+
62+
echo "=== Checking stage2 artifacts in $STAGE2 ==="
63+
64+
while IFS= read -r platform || [ -n "$platform" ]; do
65+
[ -z "$platform" ] && continue
66+
echo "--- Platform: $platform ---"
67+
68+
# Check main binaries exist
69+
for bin in $MAIN_BINS; do
70+
path="$STAGE2/$platform/$bin"
71+
if [ ! -f "$path" ]; then
72+
echo "ERROR: $path not found"
73+
exit 1
74+
fi
75+
echo "EXISTS: $path"
76+
done
77+
78+
# Check existence-only binaries (no --help)
79+
for bin in $EXISTENCE_ONLY_BINS; do
80+
path="$STAGE2/$platform/$bin"
81+
if [ ! -f "$path" ]; then
82+
echo "ERROR: $path not found"
83+
exit 1
84+
fi
85+
echo "EXISTS: $path"
86+
done
87+
88+
# Check additional binaries exist (no --help)
89+
for bin in $ADDITIONAL_BINS; do
90+
path="$STAGE2/additional/$platform/$bin"
91+
if [ ! -f "$path" ]; then
92+
echo "ERROR: $path not found"
93+
exit 1
94+
fi
95+
echo "EXISTS: $path"
96+
done
97+
98+
# For linux-x86_64 also run --help and check exit code
99+
if [ "$platform" = "$LINUX_X86_PLATFORM" ]; then
100+
echo "--- Running --help checks for $platform ---"
101+
102+
for bin in $MAIN_BINS; do
103+
path="$STAGE2/$platform/$bin"
104+
echo "Running: $path --help"
105+
"$path" --help
106+
echo "OK: $bin exited with code $?"
107+
done
108+
fi
109+
110+
done < "$PLATFORM_LIST"
111+
112+
- name: Cleanup podman containers and images
113+
if: always()
114+
run: |
115+
podman system reset -f

.mapping.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
".github/workflows/bootstrap.yml":"devtools/ya/opensource/github/bootstrap.yml",
23
"CODE_OF_CONDUCT.md":"devtools/ya/opensource/github/CODE_OF_CONDUCT.md",
34
"CONTRIBUTING.md":"devtools/ya/opensource/github/CONTRIBUTING.md",
45
"LICENSE":"devtools/ya/opensource/github/LICENSE",

devtools/ya/bootstrap/gen_graph/gg2

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ cd $source_root
66
# NOTE: must use release build type with musl, otherwise doesn't work
77
# with tcmalloc
88
# NOTE: don't set --c-compiler, otherwise get segfault
9+
# NOTE: Delete python2 deps - they are not required by ya-bin
910
./ya make \
1011
--host-platform-flag=USE_ICONV=static -DUSE_ICONV=static \
1112
--musl --host-platform-flag=MUSL \
@@ -18,6 +19,7 @@ cd $source_root
1819
--host-platform-flag=OS_SDK=local -DOS_SDK=local \
1920
--host-platform-flag=EMBED_SBOM=no -DEMBED_SBOM=no \
2021
--host-platform-flag=USE_PREBUILT_TOOLS=no -DUSE_PREBUILT_TOOLS=no \
22+
--host-platform-flag=USE_GRAND_BYPASS=no -DUSE_GRAND_BYPASS=no \
2123
-DBUILD_PYTHON3_BIN=python3 \
2224
-DBUILD_PYTHON_BIN=python3 \
2325
-DUSE_SYSTEM_JDK=/usr \
@@ -35,4 +37,10 @@ cd $source_root
3537
-e 's|"/.*python|"python|' \
3638
-e 's|"/.*clang|"clang|' \
3739
-e 's|-B.*/usr/bin|-DXXXX|' \
38-
-e 's|/usr/bin/java|java|'
40+
-e 's|/usr/bin/java|java|' \
41+
-e 's|\$(CLANG-[0-9]\{10\})/bin/||g' \
42+
-e 's|\$(LLD_ROOT-[0-9]\{10\})/bin/||g' \
43+
-e 's|\$(YMAKE_PYTHON3-[0-9]\{10\})/bin/python3|python3|g' \
44+
| grep -v -E \
45+
'\$\(SOURCE_ROOT\)/contrib/tools/python/|\$\(SOURCE_ROOT\)/contrib/python/.*/py2/|\$\(SOURCE_ROOT\)/yt/python_py2/'
46+

devtools/ya/bootstrap/graph.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"url": "https://ya-bootstrap-assets.s3.yandex.net/ya-bin-bootstrap-graph-2026-06-23-oxqrw.json.gz",
3+
"sha256": "38529dd2b959c2b3bfda17f3e819d0d17c3eeb2f3061f2a540b55f96111587b1"
4+
}

devtools/ya/bootstrap/graph_executor.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import gzip
12
import os
23
import sys
34
import json
@@ -6,6 +7,7 @@
67
import string
78
import asyncio
89
import hashlib
10+
import pathlib
911
import tempfile
1012
import subprocess
1113

@@ -15,8 +17,9 @@
1517
SOURCE_ROOT = sys.argv[1]
1618
BUILD_ROOT = sys.argv[2]
1719

18-
URL = "https://devtools-registry.s3.yandex.net/11393818885"
19-
SHA256 = "0e1a09b8fdca5ae5598e1012f6880035fb7b77929d0c1516ffc878c1aeeeb921"
20+
_graph_meta = json.loads((pathlib.Path(__file__).parent / 'graph.json').read_text())
21+
URL = _graph_meta['url']
22+
SHA256 = _graph_meta['sha256']
2023

2124

2225
_ssl_is_tuned = False
@@ -123,8 +126,12 @@ def _get(url, shasum):
123126
file = None
124127

125128

126-
with open(file or _get(URL, SHA256), 'r') as f:
127-
graph = json.loads(f.read())
129+
def _open_graph(path):
130+
with gzip.open(path, 'rt') as f:
131+
return json.loads(f.read())
132+
133+
134+
graph = _open_graph(file or _get(URL, SHA256))
128135

129136
by_platform = {}
130137

@@ -148,13 +155,6 @@ def _get(url, shasum):
148155

149156

150157
PATH_SUBSTITUTES = {
151-
'$(DEFAULT_LINUX_X86_64)/bin/': '',
152-
'$(PYTHON)/python': 'python3',
153-
'$(ANTLR4-sbr:1861632725)': BUILD_ROOT,
154-
'$(YMAKE_PYTHON3-212672652)/bin/python3': 'python3',
155-
'$(BINUTILS_ROOT-sbr:360916612)/bin/': '',
156-
'$(CLANG-2403293607)/bin/': '',
157-
'$(LLD_ROOT-3107549726)/bin/': '',
158158
'$(RESOURCE_ROOT)': BUILD_ROOT,
159159
'$(SOURCE_ROOT)': SOURCE_ROOT,
160160
'$(BUILD_ROOT)': f'{BUILD_ROOT}/@uid@',

0 commit comments

Comments
 (0)