Skip to content

Commit 134907e

Browse files
authored
Working on extending some basic CI (#46)
* Only push new images publicly on push to main * add new ci to test ibpc_py Signed-off-by: Tully Foote <[email protected]>
1 parent 597e18c commit 134907e

File tree

3 files changed

+99
-5
lines changed

3 files changed

+99
-5
lines changed

.github/workflows/build.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
name: build
1+
name: build_packages
22
on:
3-
pull_request:
43
push:
54
branches: [ main ]
65
defaults:
@@ -30,7 +29,8 @@ jobs:
3029
with:
3130
file: Dockerfile.estimator
3231
load: true
33-
tags: ${{ env.TEST_TAG }}
32+
push: true
33+
tags: ghcr.io/opencv/bpc/estimator-example:latest
3434
-
3535
name: Build tester
3636
uses: docker/build-push-action@v6

.github/workflows/test.yaml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Basic CI
2+
on: [push]
3+
4+
jobs:
5+
basic_ci:
6+
name: Basic CI
7+
runs-on: ubuntu-latest
8+
timeout-minutes: 30
9+
steps:
10+
-
11+
name: Remove unused content for disk space
12+
shell: bash
13+
run: |
14+
df -h
15+
sudo rm -rf /usr/share/dotnet
16+
sudo rm -rf /usr/local/lib/android
17+
sudo rm -rf /opt/ghc
18+
sudo rm -rf /opt/hostedtoolcache/CodeQL
19+
sudo docker image prune --all --force
20+
sudo docker builder prune -a
21+
df -h
22+
-
23+
name: Checkout
24+
uses: actions/checkout@v4
25+
-
26+
name: Set up Docker Buildx
27+
uses: docker/setup-buildx-action@v3
28+
-
29+
name: Login to GitHub Container Registry
30+
uses: docker/login-action@v3
31+
with:
32+
registry: ghcr.io
33+
username: ${{ github.actor }}
34+
password: ${{ secrets.GITHUB_TOKEN }}
35+
-
36+
name: Build estimator
37+
uses: docker/build-push-action@v6
38+
with:
39+
file: Dockerfile.estimator
40+
load: true
41+
tags: pose_estimator:latest
42+
-
43+
name: Build tester
44+
uses: docker/build-push-action@v6
45+
with:
46+
file: Dockerfile.tester
47+
load: true
48+
tags: estimator-tester:latest
49+
-
50+
name: Build ibpc_py
51+
run: |
52+
cd ibpc_py
53+
python -m pip install -e .
54+
- name: Check space
55+
run: |
56+
df -h
57+
docker images
58+
-
59+
name: Run bpc fetch
60+
run: |
61+
bpc fetch ipd --remove-zip-after-extract
62+
df -h
63+
-
64+
name: Run bpc test
65+
continue-on-error: true
66+
run: |
67+
bpc test pose_estimator:latest ipd --tester-image estimator-tester:latest
68+
-
69+
name: Check Disk space
70+
run: |
71+
df -h
72+
-
73+
name: Check results
74+
run: |
75+
cat ibpc_test_output.log
76+
cat ibpc_zenoh_output.log
77+
cat submission.csv
78+
79+
#TODO(tfoote) Also add tests for public images
80+
81+

ibpc_py/src/ibpc/ibpc.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import argparse
22
import hashlib
33
import os
4+
import pathlib
45
import shlex
56
import shutil
67
import signal
@@ -103,7 +104,7 @@ def sha256_file(filename):
103104
return sha256.hexdigest()
104105

105106

106-
def fetch_dataset(dataset, output_path):
107+
def fetch_dataset(dataset, output_path, remove_zip_after_extract):
107108
(url_base, files) = available_datasets[dataset]
108109
# Before we do anything make sure the directory exists
109110
dataset_dir = os.path.join(output_path, dataset)
@@ -165,6 +166,10 @@ def fetch_dataset(dataset, output_path):
165166
# with ZipFile(filename) as zfile:
166167
# zfile.extractall(output_path)
167168

169+
if remove_zip_after_extract:
170+
for filename in fetched_files:
171+
pathlib.Path(filename).unlink(missing_ok=True)
172+
168173

169174
def main():
170175

@@ -191,6 +196,12 @@ def main():
191196
fetch_parser = sub_parsers.add_parser("fetch")
192197
fetch_parser.add_argument("dataset", choices=available_datasets.keys())
193198
fetch_parser.add_argument("--dataset-path", default=".")
199+
fetch_parser.add_argument(
200+
"--remove-zip-after-extract",
201+
default=False,
202+
action="store_true",
203+
help="Remove the zip files after extracting to save disk space.",
204+
)
194205

195206
extension_manager = RockerExtensionManager()
196207

@@ -200,7 +211,9 @@ def main():
200211
dataset_name = args_dict["dataset"]
201212
dataset_directory = args_dict["dataset_path"]
202213
print(f"Fetching dataset {dataset_name} to {dataset_directory}")
203-
fetch_dataset(dataset_name, dataset_directory)
214+
fetch_dataset(
215+
dataset_name, dataset_directory, args_dict["remove_zip_after_extract"]
216+
)
204217
print("Fetch complete")
205218
return
206219

0 commit comments

Comments
 (0)