-
Notifications
You must be signed in to change notification settings - Fork 5
75 lines (64 loc) · 3.8 KB
/
manual_code_coverage.yml
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
name: Code Coverage
on:
workflow_dispatch:
jobs:
run-containers:
runs-on: ubuntu-latest
steps:
# Step 1: Create a local directory with full read-write permissions
- name: Create and verify local directory
run: |
# Create the directory
mkdir -p ${GITHUB_WORKSPACE}/shared_directory
echo "Local directory created"
# Grant full read-write permissions
chmod 777 ${GITHUB_WORKSPACE}/shared_directory
echo "Granted full read-write permissions to the directory"
# Verify creation
if [ -d "${GITHUB_WORKSPACE}/shared_directory" ]; then
echo "Verification: shared_directory exists and is writable"
else
echo "Error: shared_directory was not created successfully"
exit 1
fi
# Step 2: Pull Docker images (remains unchanged)
- name: Pull Docker image DockA
run: docker pull modularml/wrapyfi:0.4.32-zeromq-yarp-ros2
- name: Pull Docker Image DockB
run: docker pull modularml/wrapyfi:0.4.32-zeromq-ros
# Step 3: Run YARP and ROS servers (replace volume mounts with bind mounts)
- name: Run DockA with YARP server
run: docker run --name wrapyfi__yarpserver --net host --rm -d -v ${GITHUB_WORKSPACE}/shared_directory:/tmp/shared_volume modularml/wrapyfi:0.4.32-zeromq-yarp-ros2 yarpserver
- name: Run DockB with ROS server
run: docker run --name wrapyfi__roscore --net host --rm -d -v ${GITHUB_WORKSPACE}/shared_directory:/tmp/shared_volume modularml/wrapyfi:0.4.32-zeromq-ros roscore
# Step 4 & 5 & 6: Install packages, run tests, and append coverage data (replace volume mounts with bind mounts)
- name: Run tests and coverage on DockA
run: |
docker run --name wrapyfi_zeromq_yarp_ros2 --net host --rm -v ${GITHUB_WORKSPACE}/shared_directory:/tmp/shared_volume -w /tmp/shared_volume modularml/wrapyfi:0.4.32-zeromq-yarp-ros2 bash -c "\
yarp detect --write; \
pip install coverage && \
ROS_LOG_DIR=/tmp WRAPYFI_ZEROMQ_PUBSUB_MONITOR_LISTENER_SPAWN=thread WRAPYFI_ZEROMQ_PROXY_BROKER_SPAWN=thread coverage run --source=wrapyfi -m unittest discover -s wrapyfi && \
coverage report --data-file=/tmp/shared_volume/.coverage && \
coverage xml -o /tmp/shared_volume/coverage.xml --data-file=/tmp/shared_volume/.coverage"
# WIP(fabawi): This seems to break after coverage losing track of Wrapyfi's location
# - name: Run tests and append coverage on DockB. Generate the final report from the combined .coverage file
# run: |
# docker run --name wrapyfi_zeromq_ros --net host --rm -v ${GITHUB_WORKSPACE}/shared_directory:/tmp/shared_volume -w /tmp/shared_volume modularml/wrapyfi:0.4.32-zeromq-ros bash -c "\
# pip install coverage && \
# pip uninstall -y pyzmq && \
# coverage run -a --source=wrapyfi -m unittest discover -s wrapyfi; \
# coverage report --data-file=/tmp/shared_volume/.coverage && \
# coverage xml -o /tmp/shared_volume/coverage.xml --data-file=/tmp/shared_volume/.coverage"
# Step 7: Modify codecov paths
- name: Modify paths in coverage.xml
run: |
sed -i 's|.opt.conda.envs.zeromq_yarp_ros2.lib.python3.10.site-packages.wrapyfi|.|g' ${GITHUB_WORKSPACE}/shared_directory/coverage.xml
sed -i 's|/opt/conda/envs/zeromq_yarp_ros2/lib/python3.10/site-packages/wrapyfi||g' ${GITHUB_WORKSPACE}/shared_directory/coverage.xml
cat ${GITHUB_WORKSPACE}/shared_directory/coverage.xml # Optional: Print to verify
# Step 8: Upload the coverage report (remains unchanged)
- name: Upload coverage report to Codecov
uses: codecov/codecov-action@v3
with:
file: ${{ github.workspace }}/shared_directory/coverage.xml
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}