Skip to content

Commit 78d30ad

Browse files
eden/edenapi and mononoke integration tests: add edenapi/tools to getdeps and use them in tests (#51)
Summary: Pull Request resolved: #51 This diff extends capabilities of CargoBuilder in getdeps so that individual manifests can be build even without workspaces. Thanks to that a build for edenapi/tools can be made and its artifacts can be used in mononoke integration tests. Reviewed By: StanislavGlebik Differential Revision: D23574887 fbshipit-source-id: 8a974a6b5235d36a44fe082aad55cd380d84dd09
1 parent d94f354 commit 78d30ad

File tree

10 files changed

+191
-22
lines changed

10 files changed

+191
-22
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# This file was @generated by getdeps.py
2+
3+
name: EdenSCM Lib EdenAPI Tools Linux
4+
5+
on:
6+
push:
7+
branches:
8+
- master
9+
pull_request:
10+
branches:
11+
- master
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-18.04
16+
steps:
17+
- uses: actions/checkout@v1
18+
- name: Install Rust Stable
19+
uses: actions-rs/toolchain@v1
20+
with:
21+
toolchain: stable
22+
default: true
23+
profile: minimal
24+
- name: Install system deps
25+
run: sudo python3 build/fbcode_builder/getdeps.py --allow-system-packages install-system-deps --recursive eden_scm_lib_edenapi_tools
26+
- name: Build eden_scm_lib_edenapi_tools
27+
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --src-dir=. eden_scm_lib_edenapi_tools --project-install-prefix eden_scm_lib_edenapi_tools:/usr/local
28+
- name: Copy artifacts
29+
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages fixup-dyn-deps --strip --src-dir=. eden_scm_lib_edenapi_tools _artifacts/linux --project-install-prefix eden_scm_lib_edenapi_tools:/usr/local --final-install-prefix /usr/local
30+
- uses: actions/upload-artifact@master
31+
with:
32+
name: eden_scm_lib_edenapi_tools
33+
path: _artifacts
34+
- name: Test eden_scm_lib_edenapi_tools
35+
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages test --src-dir=. eden_scm_lib_edenapi_tools --project-install-prefix eden_scm_lib_edenapi_tools:/usr/local
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# This file was @generated by getdeps.py
2+
3+
name: EdenSCM Lib EdenAPI Tools Mac
4+
5+
on:
6+
push:
7+
branches:
8+
- master
9+
pull_request:
10+
branches:
11+
- master
12+
13+
jobs:
14+
build:
15+
runs-on: macOS-latest
16+
env:
17+
DEVELOPER_DIR: /Applications/Xcode_10.3.app/Contents/Developer
18+
steps:
19+
- uses: actions/checkout@v1
20+
- name: Install Rust Stable
21+
uses: actions-rs/toolchain@v1
22+
with:
23+
toolchain: stable
24+
default: true
25+
profile: minimal
26+
- name: Install system deps
27+
run: sudo python3 build/fbcode_builder/getdeps.py --allow-system-packages install-system-deps --recursive eden_scm_lib_edenapi_tools
28+
- name: Build eden_scm_lib_edenapi_tools
29+
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --src-dir=. eden_scm_lib_edenapi_tools --project-install-prefix eden_scm_lib_edenapi_tools:/usr/local
30+
- name: Copy artifacts
31+
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages fixup-dyn-deps --src-dir=. eden_scm_lib_edenapi_tools _artifacts/mac --project-install-prefix eden_scm_lib_edenapi_tools:/usr/local --final-install-prefix /usr/local
32+
- uses: actions/upload-artifact@master
33+
with:
34+
name: eden_scm_lib_edenapi_tools
35+
path: _artifacts
36+
- name: Test eden_scm_lib_edenapi_tools
37+
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages test --src-dir=. eden_scm_lib_edenapi_tools --project-install-prefix eden_scm_lib_edenapi_tools:/usr/local

.github/workflows/mononoke-integration_linux.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
python-version: '2.7'
3636
- name: Install Apt-get dependencies
3737
run: |
38-
sudo apt-get install nmap
38+
sudo apt-get install nmap tree
3939
- name: Install system deps
4040
run: sudo python3 build/fbcode_builder/getdeps.py --allow-system-packages install-system-deps --recursive eden_scm
4141
- name: Build eden_scm dependencies
@@ -60,6 +60,20 @@ jobs:
6060
run: |
6161
rm -rf /tmp/build/build/eden_scm/*
6262
df -h
63+
- name: Build eden_scm_lib_edenapi_tools
64+
run: >-
65+
python3 build/fbcode_builder/getdeps.py build
66+
--allow-system-packages
67+
--scratch-path /tmp/build
68+
--no-deps
69+
--src-dir=.
70+
eden_scm_lib_edenapi_tools
71+
- name: Check space before cleanup
72+
run: df -h
73+
- name: Clean up eden_scm_lib_edenapi_tools build
74+
run: |
75+
rm -rf /tmp/build/build/eden_scm_lib_edenapi_tools/*
76+
df -h
6377
- name: Build mononoke dependencies
6478
run: >-
6579
python3 build/fbcode_builder/getdeps.py build

.github/workflows/mononoke-integration_mac.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
python-version: '2.7'
3030
- name: Install Brew dependencies
3131
run: |
32-
brew install bash coreutils curl-openssl gnu-sed grep jq nmap
32+
brew install bash coreutils curl-openssl gnu-sed grep jq nmap tree
3333
- name: Install system deps
3434
run: sudo python3 build/fbcode_builder/getdeps.py --allow-system-packages install-system-deps --recursive eden_scm
3535
- name: Build eden_scm dependencies
@@ -48,6 +48,14 @@ jobs:
4848
--no-deps
4949
--src-dir=.
5050
eden_scm
51+
- name: Build eden_scm_lib_edenapi_tools
52+
run: >-
53+
python3 build/fbcode_builder/getdeps.py build
54+
--allow-system-packages
55+
--scratch-path /tmp/build
56+
--no-deps
57+
--src-dir=.
58+
eden_scm_lib_edenapi_tools
5159
- name: Build mononoke dependencies
5260
run: >-
5361
python3 build/fbcode_builder/getdeps.py build

build/fbcode_builder/getdeps/builder.py

Lines changed: 39 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -999,13 +999,15 @@ def __init__(
999999
inst_dir,
10001000
build_doc,
10011001
workspace_dir,
1002+
manifests_to_build,
10021003
loader,
10031004
):
10041005
super(CargoBuilder, self).__init__(
10051006
build_opts, ctx, manifest, src_dir, build_dir, inst_dir
10061007
)
10071008
self.build_doc = build_doc
10081009
self.ws_dir = workspace_dir
1010+
self.manifests_to_build = manifests_to_build and manifests_to_build.split(",")
10091011
self.loader = loader
10101012

10111013
def run_cargo(self, install_dirs, operation, args=None):
@@ -1026,7 +1028,10 @@ def build_source_dir(self):
10261028
return os.path.join(self.build_dir, "source")
10271029

10281030
def workspace_dir(self):
1029-
return os.path.join(self.build_source_dir(), self.ws_dir)
1031+
return os.path.join(self.build_source_dir(), self.ws_dir or "")
1032+
1033+
def manifest_dir(self, manifest):
1034+
return os.path.join(self.build_source_dir(), manifest)
10301035

10311036
def recreate_dir(self, src, dst):
10321037
if os.path.isdir(dst):
@@ -1058,7 +1063,8 @@ def _build(self, install_dirs, reconfigure):
10581063
)
10591064
)
10601065

1061-
self._patchup_workspace()
1066+
if self.ws_dir is not None:
1067+
self._patchup_workspace()
10621068

10631069
try:
10641070
from getdeps.facebook.rust import vendored_crates
@@ -1069,11 +1075,26 @@ def _build(self, install_dirs, reconfigure):
10691075
# so just rely on cargo downloading crates on it's own
10701076
pass
10711077

1072-
self.run_cargo(
1073-
install_dirs,
1074-
"build",
1075-
["--out-dir", os.path.join(self.inst_dir, "bin"), "-Zunstable-options"],
1076-
)
1078+
if self.manifests_to_build is None:
1079+
self.run_cargo(
1080+
install_dirs,
1081+
"build",
1082+
["--out-dir", os.path.join(self.inst_dir, "bin"), "-Zunstable-options"],
1083+
)
1084+
else:
1085+
for manifest in self.manifests_to_build:
1086+
self.run_cargo(
1087+
install_dirs,
1088+
"build",
1089+
[
1090+
"--out-dir",
1091+
os.path.join(self.inst_dir, "bin"),
1092+
"-Zunstable-options",
1093+
"--manifest-path",
1094+
self.manifest_dir(manifest),
1095+
],
1096+
)
1097+
10771098
self.recreate_dir(build_source_dir, os.path.join(self.inst_dir, "source"))
10781099

10791100
def run_tests(
@@ -1082,11 +1103,18 @@ def run_tests(
10821103
if test_filter:
10831104
args = ["--", test_filter]
10841105
else:
1085-
args = None
1106+
args = []
10861107

1087-
self.run_cargo(install_dirs, "test", args)
1088-
if self.build_doc:
1089-
self.run_cargo(install_dirs, "doc", ["--no-deps"])
1108+
if self.manifests_to_build is None:
1109+
self.run_cargo(install_dirs, "test", args)
1110+
if self.build_doc:
1111+
self.run_cargo(install_dirs, "doc", ["--no-deps"])
1112+
else:
1113+
for manifest in self.manifests_to_build:
1114+
margs = ["--manifest-path", self.manifest_dir(manifest)]
1115+
self.run_cargo(install_dirs, "test", args + margs)
1116+
if self.build_doc:
1117+
self.run_cargo(install_dirs, "doc", ["--no-deps"] + margs)
10901118

10911119
def _patchup_workspace(self):
10921120
"""

build/fbcode_builder/getdeps/manifest.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,11 @@
7474
"msbuild": {"optional_section": True, "fields": {"project": REQUIRED}},
7575
"cargo": {
7676
"optional_section": True,
77-
"fields": {"build_doc": OPTIONAL, "workspace_dir": OPTIONAL},
77+
"fields": {
78+
"build_doc": OPTIONAL,
79+
"workspace_dir": OPTIONAL,
80+
"manifests_to_build": OPTIONAL,
81+
},
7882
},
7983
"cmake.defines": {"optional_section": True},
8084
"autoconf.args": {"optional_section": True},
@@ -489,7 +493,8 @@ def create_builder( # noqa:C901
489493

490494
if builder == "cargo":
491495
build_doc = self.get("cargo", "build_doc", False, ctx)
492-
workspace_dir = self.get("cargo", "workspace_dir", "", ctx)
496+
workspace_dir = self.get("cargo", "workspace_dir", None, ctx)
497+
manifests_to_build = self.get("cargo", "manifests_to_build", None, ctx)
493498
return CargoBuilder(
494499
build_options,
495500
ctx,
@@ -499,6 +504,7 @@ def create_builder( # noqa:C901
499504
inst_dir,
500505
build_doc,
501506
workspace_dir,
507+
manifests_to_build,
502508
loader,
503509
)
504510

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
[manifest]
2+
name = eden_scm_lib_edenapi_tools
3+
fbsource_path = fbcode/eden
4+
shipit_project = eden
5+
shipit_fbcode_builder = true
6+
7+
[git]
8+
repo_url = https://github.com/facebookexperimental/eden.git
9+
10+
[build]
11+
builder = cargo
12+
13+
[cargo]
14+
build_doc = true
15+
manifests_to_build = eden/scm/lib/edenapi/tools/make_req/Cargo.toml,eden/scm/lib/edenapi/tools/read_res/Cargo.toml
16+
17+
[shipit.pathmap]
18+
fbcode/eden/oss = .
19+
fbcode/eden = eden
20+
fbcode/tools/lfs = tools/lfs
21+
fbcode/fboss/common = common
22+
23+
[shipit.strip]
24+
^fbcode/eden/fs/eden-config\.h$
25+
^fbcode/eden/fs/py/eden/config\.py$
26+
^fbcode/eden/hg/.*$
27+
^fbcode/eden/mononoke/(?!lfs_protocol)
28+
^fbcode/eden/scm/build/.*$
29+
^fbcode/eden/scm/lib/third-party/rust/.*/Cargo.toml$
30+
^fbcode/eden/.*/\.cargo/.*$
31+
^.*/fb/.*$
32+
/Cargo\.lock$
33+
\.pyc$
34+
35+
[dependencies.fb=on]
36+
rust

build/fbcode_builder/manifests/rust-shed

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ builder = cargo
1212

1313
[cargo]
1414
build_doc = true
15+
workspace_dir =
1516

1617
[shipit.pathmap]
1718
fbcode/common/rust/shed = shed

eden/mononoke/tests/integration/manifest_deps

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ EDENSCM_BINS = {
4343
"BINARY_HG": "hg",
4444
}
4545

46+
# The values here should correspond to both the name of binary as builded by
47+
# getdeps.py's eden_scm_lib_edenapi_tools project and the buck target. Those
48+
# names must be unique.
49+
EDENSCMLIBEDENAPITOOLS_BINS = {
50+
"EDENAPI_MAKE_REQ": "make_req",
51+
"EDENAPI_READ_RES": "read_res",
52+
}
53+
4654
# The "//" in the values here corresponds to the root of repo (both GitHub and
4755
# fbcode repos have the same folder layout)
4856
OSS_DEPS = {

eden/mononoke/tests/integration/run_tests_getdeps.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def parse_args():
6363

6464
def prepare_manifest_deps(install_dir, build_dir, repo_root):
6565
exec(
66-
"global OSS_DEPS; global MONONOKE_BINS; global EDENSCM_BINS; "
66+
"global OSS_DEPS; global MONONOKE_BINS; global EDENSCM_BINS; global EDENSCMLIBEDENAPITOOLS_BINS; "
6767
+ open(
6868
join(repo_root, "eden/mononoke/tests/integration/manifest_deps"), "r"
6969
).read()
@@ -79,6 +79,8 @@ def prepare_manifest_deps(install_dir, build_dir, repo_root):
7979
MANIFEST_DEPS[k] = join(install_dir, "mononoke/bin", v)
8080
for k, v in EDENSCM_BINS.items(): # noqa: F821
8181
MANIFEST_DEPS[k] = join(install_dir, "eden_scm/bin", v)
82+
for k, v in EDENSCMLIBEDENAPITOOLS_BINS.items(): # noqa: F821
83+
MANIFEST_DEPS[k] = join(install_dir, "eden_scm_lib_edenapi_tools/bin", v)
8284

8385
os.makedirs(build_dir, exist_ok=True)
8486
with open(join(build_dir, "manifest.json"), "w") as f:
@@ -120,12 +122,6 @@ def get_test_groups(repo_root):
120122
"test-walker-error-as-data.t",
121123
},
122124
TestGroup.BROKEN: {
123-
"test-edenapi-server-commit-location-to-hash.t", # Missing eden/scm's commands
124-
"test-edenapi-server-commit-revlog-data.t", # Missing eden/scm's commands
125-
"test-edenapi-server-complete-trees.t", # Missing eden/scm's commands
126-
"test-edenapi-server-files.t", # Missing eden/scm's commands
127-
"test-edenapi-server-history.t", # Missing eden/scm's commands
128-
"test-edenapi-server-trees.t", # Missing eden/scm's commands
129125
"test-fastreplay-inline-args.t", # Returns different data in OSS
130126
"test-gitimport.t", # Issue with hggit extension
131127
"test-hook-tailer.t", # Issue with hggit extension

0 commit comments

Comments
 (0)