Skip to content

Commit 428dc2d

Browse files
authored
Use compas docker image to avoid linux installs on ci (#1428)
* use COMPAS docker as base container * use COMPAS docker to just build * use COMPAS docker for building, running and pytest * use updated docker imagae * Add detailed evol plot * fix: float_ deprecated in numpy>2.0 * upload image * fix image paths * fix bad SHA * need to checkout at start of the CI * edit comment
1 parent 0192277 commit 428dc2d

File tree

3 files changed

+105
-292
lines changed

3 files changed

+105
-292
lines changed

.github/workflows/compas-compile-ci.yml

Lines changed: 91 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -27,64 +27,130 @@ jobs:
2727

2828
name: Build COMPAS
2929
runs-on: ubuntu-22.04
30+
container: teamcompas/compas:latest
31+
# TODO: Switch to GHCR when package is made public
32+
# container: ghcr.io/teamcompas/compas:latest
3033

3134
steps:
32-
- uses: actions/checkout@v4
33-
- uses: actions/setup-python@v5
34-
with:
35-
python-version: '3.9'
36-
cache: pip
37-
cache-dependency-path: setup.py
38-
# - name: Install TeXLive
39-
# uses: teatimeguest/setup-texlive-action@v3.3.4
40-
- name: Install dependencies on ubuntu
41-
run: |
42-
cd misc/cicd-scripts
43-
chmod 755 linux-dependencies
44-
./linux-dependencies
45-
- name: Build Compas
35+
- name: Checkout repository
36+
uses: actions/checkout@v4
37+
38+
- name: Build COMPAS from source
4639
run: |
47-
cd src && make -j $(nproc) -f Makefile
40+
echo "Building COMPAS from source..."
41+
cd src
42+
make clean 2>/dev/null || echo 'No existing build to clean'
43+
make -j $(nproc) -f Makefile
4844
./COMPAS -v
49-
- name: Install python utils
45+
echo "COMPAS build completed successfully!"
46+
47+
- name: Install Python dependencies
5048
run: |
51-
pip install --upgrade pip
49+
echo "Installing Python dependencies..."
50+
python3 -m pip install --upgrade pip
5251
pip install -e .[dev]
52+
echo "Python dependencies installed!"
53+
5354
- name: Run example COMPAS job
5455
run: |
56+
echo "Running example COMPAS job..."
5557
export COMPAS_EXECUTABLE_PATH=${GITHUB_WORKSPACE}/src/COMPAS
5658
cd ${GITHUB_WORKSPACE}/py_tests/test_data/
5759
chmod 755 run.sh
60+
echo "Contents of run.sh:"
5861
cat run.sh
5962
./run.sh
60-
- name: Run pytests
63+
echo "Example job completed!"
64+
65+
- name: Run pytest suite
6166
run: |
67+
echo "Running pytest suite..."
6268
cd ${GITHUB_WORKSPACE}
6369
export COMPAS_ROOT_DIR=${GITHUB_WORKSPACE}
64-
jupyter-kernelspec list
70+
71+
if command -v jupyter-kernelspec &> /dev/null; then
72+
echo "Available Jupyter kernels:"
73+
jupyter-kernelspec list
74+
fi
75+
6576
pytest --cov=compas_python_utils/ py_tests/ -m 'not webtest'
6677
pytest --cov=compas_python_utils/ --cov-append py_tests/ -m webtest
67-
ls py_tests/test_artifacts
78+
79+
echo "Test artifacts:"
80+
ls py_tests/test_artifacts/ 2>/dev/null || echo "No test artifacts found"
81+
6882
coverage html
6983
coverage-badge -o coverage_badge.svg -f
84+
echo "All tests completed successfully!"
85+
7086
- name: Archive code coverage results
7187
uses: actions/upload-artifact@v4
7288
with:
7389
name: code-coverage
7490
path: |
7591
htmlcov/
7692
coverage_badge.svg
93+
7794
- name: Archive COMPAS detailed-evolution plot
7895
id: upload
7996
uses: actions/upload-artifact@v4
8097
with:
81-
name: ${{ env.ARTIFACT_NAME }}
98+
name: evolution-plot-${{ github.run_number }}
8299
path: ${{ env.ARTIFACT_PATH }}/${{ env.ARTIFACT_NAME }}
83100
if-no-files-found: error
101+
84102
- name: Test Summary
85103
run: |
86-
echo "### Test Results" >> $GITHUB_STEP_SUMMARY
87-
echo "- Compas Build: Success" >> $GITHUB_STEP_SUMMARY
88-
echo "- Python Utils Installation: Success" >> $GITHUB_STEP_SUMMARY
104+
echo "### COMPAS CI Results" >> $GITHUB_STEP_SUMMARY
105+
echo "- COMPAS Build: Success" >> $GITHUB_STEP_SUMMARY
106+
echo "- Python Dependencies: Success" >> $GITHUB_STEP_SUMMARY
89107
echo "- Example COMPAS Job: Success" >> $GITHUB_STEP_SUMMARY
90-
echo "- Pytest Execution: Success" >> $GITHUB_STEP_SUMMARY
108+
echo "- Pytest Suite: Success" >> $GITHUB_STEP_SUMMARY
109+
110+
comment-with-plot:
111+
name: Comment PR with Evolution Plot
112+
runs-on: ubuntu-22.04
113+
container: docker://ghcr.io/iterative/cml:0-dvc2-base1
114+
needs: compas
115+
if: github.event_name == 'pull_request'
116+
117+
env:
118+
ARTIFACT_NAME: detailedEvolutionPlot.png
119+
120+
steps:
121+
- name: Checkout repository
122+
uses: actions/checkout@v4
123+
124+
- name: Download evolution plot
125+
uses: actions/download-artifact@v4
126+
with:
127+
name: evolution-plot-${{ github.run_number }}
128+
129+
- name: Create report with evolution plot
130+
env:
131+
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
132+
run: |
133+
echo "## ✅ COMPAS Build Successful!" >> report.md
134+
echo "" >> report.md
135+
echo "| Item | Value |" >> report.md
136+
echo "|------|-------|" >> report.md
137+
echo "| **Commit** | [\`$(echo $GITHUB_SHA | cut -c1-7)\`](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/commit/${GITHUB_SHA}) |" >> report.md
138+
echo "| **Logs** | [View workflow](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}) |" >> report.md
139+
echo "" >> report.md
140+
141+
if [ -f "${{ env.ARTIFACT_NAME }}" ]; then
142+
echo "### Detailed Evolution Plot" >> report.md
143+
echo "<details><summary>Click to view evolution plot</summary>" >> report.md
144+
echo "" >> report.md
145+
echo "![](./${{ env.ARTIFACT_NAME }})" >> report.md
146+
echo "</details>" >> report.md
147+
else
148+
echo "### ⚠️ Evolution plot not found" >> report.md
149+
fi
150+
151+
echo "" >> report.md
152+
echo "---" >> report.md
153+
echo "<sub>Generated by COMPAS CI </sub>" >> report.md
154+
155+
# Post the report using CML
156+
cml comment create report.md

0 commit comments

Comments
 (0)