Use compas docker image to avoid linux installs on ci #1923
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: COMPAS compile test | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| branches: | |
| - dev | |
| paths: | |
| - src/** | |
| - compas_python_utils/** | |
| - py_tests/** | |
| - .github/workflows/** | |
| push: | |
| branches: | |
| - dev | |
| # Ensures only the latest workflow run for the same branch is active, canceling any in-progress runs. | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| compas: | |
| env: | |
| ARTIFACT_NAME: detailedEvolutionPlot.png | |
| ARTIFACT_PATH: py_tests/test_artifacts | |
| name: Build COMPAS | |
| runs-on: ubuntu-22.04 | |
| container: teamcompas/compas:latest | |
| # TODO: Switch to GHCR when package is made public | |
| # container: ghcr.io/teamcompas/compas:latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Build COMPAS from source | |
| run: | | |
| echo "Building COMPAS from source..." | |
| cd src | |
| make clean 2>/dev/null || echo 'No existing build to clean' | |
| make -j $(nproc) -f Makefile | |
| ./COMPAS -v | |
| echo "COMPAS build completed successfully!" | |
| - name: Install Python dependencies | |
| run: | | |
| echo "Installing Python dependencies..." | |
| python3 -m pip install --upgrade pip | |
| pip install -e .[dev] | |
| echo "Python dependencies installed!" | |
| - name: Run example COMPAS job | |
| run: | | |
| echo "Running example COMPAS job..." | |
| export COMPAS_EXECUTABLE_PATH=${GITHUB_WORKSPACE}/src/COMPAS | |
| cd ${GITHUB_WORKSPACE}/py_tests/test_data/ | |
| chmod 755 run.sh | |
| echo "Contents of run.sh:" | |
| cat run.sh | |
| ./run.sh | |
| echo "Example job completed!" | |
| - name: Run pytest suite | |
| run: | | |
| echo "Running pytest suite..." | |
| cd ${GITHUB_WORKSPACE} | |
| export COMPAS_ROOT_DIR=${GITHUB_WORKSPACE} | |
| if command -v jupyter-kernelspec &> /dev/null; then | |
| echo "Available Jupyter kernels:" | |
| jupyter-kernelspec list | |
| fi | |
| pytest --cov=compas_python_utils/ py_tests/ -m 'not webtest' | |
| pytest --cov=compas_python_utils/ --cov-append py_tests/ -m webtest | |
| echo "Test artifacts:" | |
| ls py_tests/test_artifacts/ 2>/dev/null || echo "No test artifacts found" | |
| coverage html | |
| coverage-badge -o coverage_badge.svg -f | |
| echo "All tests completed successfully!" | |
| - name: Archive code coverage results | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: code-coverage | |
| path: | | |
| htmlcov/ | |
| coverage_badge.svg | |
| - name: Archive COMPAS detailed-evolution plot | |
| id: upload | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: evolution-plot-${{ github.run_number }} | |
| path: ${{ env.ARTIFACT_PATH }}/${{ env.ARTIFACT_NAME }} | |
| if-no-files-found: error | |
| - name: Test Summary | |
| run: | | |
| echo "### COMPAS CI Results" >> $GITHUB_STEP_SUMMARY | |
| echo "- COMPAS Build: Success" >> $GITHUB_STEP_SUMMARY | |
| echo "- Python Dependencies: Success" >> $GITHUB_STEP_SUMMARY | |
| echo "- Example COMPAS Job: Success" >> $GITHUB_STEP_SUMMARY | |
| echo "- Pytest Suite: Success" >> $GITHUB_STEP_SUMMARY | |
| comment-with-plot: | |
| name: Comment PR with Evolution Plot | |
| runs-on: ubuntu-22.04 | |
| container: docker://ghcr.io/iterative/cml:0-dvc2-base1 | |
| needs: compas | |
| if: github.event_name == 'pull_request' | |
| env: | |
| ARTIFACT_NAME: detailedEvolutionPlot.png | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Download evolution plot | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: evolution-plot-${{ github.run_number }} | |
| - name: Create report with evolution plot | |
| env: | |
| REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| echo "## ✅ COMPAS Build Successful!" >> report.md | |
| echo "" >> report.md | |
| echo "| Item | Value |" >> report.md | |
| echo "|------|-------|" >> report.md | |
| echo "| **Commit** | [\`$(echo $GITHUB_SHA | cut -c1-7)\`](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/commit/${GITHUB_SHA}) |" >> report.md | |
| echo "| **Logs** | [View workflow](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}) |" >> report.md | |
| echo "" >> report.md | |
| if [ -f "${{ env.ARTIFACT_NAME }}" ]; then | |
| echo "### Detailed Evolution Plot" >> report.md | |
| echo "<details><summary>Click to view evolution plot</summary>" >> report.md | |
| echo "" >> report.md | |
| echo "" >> report.md | |
| echo "</details>" >> report.md | |
| else | |
| echo "### ⚠️ Evolution plot not found" >> report.md | |
| fi | |
| echo "" >> report.md | |
| echo "---" >> report.md | |
| echo "<sub>Generated by COMPAS CI </sub>" >> report.md | |
| # Post the report using CML | |
| cml comment create report.md |