Skip to content

Commit

Permalink
Merge branch 'commaai:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
toneyche authored Jul 7, 2024
2 parents 24c1eb1 + 4ef757c commit f572384
Show file tree
Hide file tree
Showing 90 changed files with 7,492 additions and 9,043 deletions.
3 changes: 2 additions & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
FROM ghcr.io/commaai/openpilot-base:latest

RUN apt update && apt install -y vim net-tools usbutils htop ripgrep tmux wget mesa-utils xvfb libxtst6 libxv1 libglu1-mesa gdb bash-completion
RUN pip install ipython jupyter jupyterlab
RUN python3 -m ensurepip --upgrade
RUN pip3 install ipython jupyter jupyterlab

RUN cd /tmp && \
ARCH=$(arch | sed s/aarch64/arm64/ | sed s/x86_64/amd64/) && \
Expand Down
123 changes: 123 additions & 0 deletions .github/workflows/ci_weekly_report.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
name: weekly CI test report
on:
schedule:
- cron: '37 9 * * 1' # 9:37AM UTC -> 2:37AM PST every monday
workflow_dispatch:
inputs:
ci_runs:
description: 'The amount of runs to trigger in CI test report'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
setup:
if: github.repository == 'commaai/openpilot'
runs-on: ubuntu-latest
outputs:
ci_runs: ${{ steps.ci_runs_setup.outputs.value }}
steps:
- id: ci_runs_setup
run: |
CI_RUNS=${{ inputs.ci_runs || '50' }}
mylist="value=["
for i in $(seq 1 $CI_RUNS);
do
if [ $i != $CI_RUNS ]; then
mylist+="\"$i\", "
else
mylist+="\"$i\"]"
fi
done
echo "$mylist" >> $GITHUB_OUTPUT
echo "Number of CI runs for report: $CI_RUNS"
ci_matrix_run:
needs: [ setup ]
strategy:
fail-fast: false
matrix:
value: ${{fromJSON(needs.setup.outputs.ci_runs)}}
uses: commaai/openpilot/.github/workflows/ci_weekly_run.yaml@master
with:
run_number: ${{ matrix.value }}

report:
needs: [ci_matrix_run]
runs-on: ubuntu-latest
if: always()
steps:
- name: Get job results
uses: actions/github-script@v7
id: get-job-results
with:
script: |
const jobs = await github
.paginate("GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt}/jobs", {
owner: "commaai",
repo: "${{ github.event.repository.name }}",
run_id: "${{ github.run_id }}",
attempt: "${{ github.run_attempt }}",
})
var report = {}
jobs.slice(1, jobs.length-1).forEach(job => {
const jobName = job.name.split('/')[2].trim();
report[jobName] = report[jobName] || { successes: [], failures: [], cancelled: [] };
switch (job.conclusion) {
case "success":
report[jobName].successes.push(job.html_url); break;
case "failure":
report[jobName].failures.push(job.html_url); break;
case "cancelled":
report[jobName].cancelled.push(job.html_url); break;
}
});
return JSON.stringify(report);
- name: Add job results to summary
env:
JOB_RESULTS: ${{ fromJSON(steps.get-job-results.outputs.result) }}
run: |
echo $JOB_RESULTS > job_results.json
generate_html_table() {
echo "<table>"
echo "<thead>"
echo " <tr>"
echo " <th>Job</th>"
echo " <th>Succeeded ✅</th>"
echo " <th>Failed ❌</th>"
echo " <th>Cancelled (timed out) ⏰</th>"
echo " </tr>"
echo "</thead>"
jq -r '
"<tbody>",
keys[] as $job |
"<tr>",
" <td>\($job)</td>",
" <td>",
" <details>",
" <summary>(\(.[$job].successes | length))</summary>",
" \(.[$job].successes[])<br>",
" </details>",
" </td>",
" <td>",
" <details>",
" <summary>(\(.[$job].failures | length))</summary>",
" \(.[$job].failures[])<br>",
" </details>",
" </td>",
" <td>",
" <details>",
" <summary>(\(.[$job].cancelled | length))</summary>",
" \(.[$job].cancelled[])<br>",
" </details>",
" </td>",
"</tr>"
' job_results.json
echo "</tbody>"
echo "</table>"
}
echo "# CI Job Summary" >> $GITHUB_STEP_SUMMARY
generate_html_table >> $GITHUB_STEP_SUMMARY
21 changes: 21 additions & 0 deletions .github/workflows/ci_weekly_run.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: weekly CI test run
on:
workflow_call:
inputs:
run_number:
required: true
type: string

concurrency:
group: ci-run-${{ inputs.run_number }}-${{ github.ref }}
cancel-in-progress: true

jobs:
selfdrive_tests:
uses: commaai/openpilot/.github/workflows/selfdrive_tests.yaml@master
with:
run_number: ${{ inputs.run_number }}
tools_tests:
uses: commaai/openpilot/.github/workflows/tools_tests.yaml@master
with:
run_number: ${{ inputs.run_number }}
10 changes: 8 additions & 2 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,14 @@ on:
branches:
- master
pull_request:

workflow_call:
inputs:
run_number:
default: '1'
required: true
type: string
concurrency:
group: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && github.run_id || github.head_ref || github.ref }}-${{ github.workflow }}-${{ github.event_name }}
group: docs-tests-ci-run-${{ inputs.run_number }}-${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && github.run_id || github.head_ref || github.ref }}-${{ github.workflow }}-${{ github.event_name }}
cancel-in-progress: true

env:
Expand All @@ -22,6 +27,7 @@ jobs:
name: build docs
runs-on: ubuntu-latest
timeout-minutes: 45
if: false # TODO: replace this with the new docs
steps:
- uses: actions/checkout@v4
with:
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/repo-maintenance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,11 @@ jobs:
if: github.repository == 'commaai/openpilot'
steps:
- uses: actions/checkout@v4
- name: poetry lock
- name: uv lock
run: |
pip install poetry
poetry lock
python3 -m ensurepip --upgrade
pip3 install uv
uv lock --upgrade
- name: pre-commit autoupdate
run: |
git config --global --add safe.directory '*'
Expand Down
80 changes: 76 additions & 4 deletions .github/workflows/selfdrive_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,15 @@ on:
- master
pull_request:
workflow_dispatch:
workflow_call:
inputs:
run_number:
default: '1'
required: true
type: string

concurrency:
group: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && github.run_id || github.head_ref || github.ref }}-${{ github.workflow }}-${{ github.event_name }}
group: selfdrive-tests-ci-run-${{ inputs.run_number }}-${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && github.run_id || github.head_ref || github.ref }}-${{ github.workflow }}-${{ github.event_name }}
cancel-in-progress: true

env:
Expand Down Expand Up @@ -62,7 +68,6 @@ jobs:
cd $GITHUB_WORKSPACE
cp .pre-commit-config.yaml $STRIPPED_DIR
cp pyproject.toml $STRIPPED_DIR
cp poetry.lock $STRIPPED_DIR
cd $STRIPPED_DIR
${{ env.RUN }} "unset PYTHONWARNINGS && SKIP=check-added-large-files,check-hooks-apply,check-useless-excludes pre-commit run --all && chmod -R 777 /tmp/pre-commit"
Expand All @@ -87,6 +92,23 @@ jobs:
- uses: ./.github/workflows/compile-openpilot
timeout-minutes: ${{ ((steps.restore-scons-cache.outputs.cache-hit == 'true') && 15 || 30) }} # allow more time when we missed the scons cache

build_mac:
name: build macos
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- run: git lfs pull
- name: Install dependencies
run: ./tools/mac_setup.sh
env:
SKIP_PROMPT: 1
# package install has DeprecationWarnings
PYTHONWARNINGS: default
- name: Test openpilot environment
run: . .venv/bin/activate && scons -h

static_analysis:
name: static analysis
runs-on: ${{ ((github.repository == 'commaai/openpilot') &&
Expand Down Expand Up @@ -304,5 +326,55 @@ jobs:
- name: Upload Test Report
uses: actions/upload-artifact@v4
with:
name: report
path: selfdrive/ui/tests/test_ui/report
name: report-${{ inputs.run_number }}
path: selfdrive/ui/tests/test_ui/report_${{ inputs.run_number }}
- name: Get changes to selfdrive/ui
if: ${{ github.event_name == 'pull_request' }}
id: changed-files
uses: tj-actions/changed-files@v44
with:
files: |
selfdrive/ui/**
- name: Checkout ci-artifacts
if: ${{ github.event_name == 'pull_request' && steps.changed-files.outputs.any_changed == 'true' }}
uses: actions/checkout@v4
with:
repository: commaai/ci-artifacts
ssh-key: ${{ secrets.CI_ARTIFACTS_DEPLOY_KEY }}
path: ${{ github.workspace }}/ci-artifacts
ref: master
- name: Push Screenshots
if: ${{ github.event_name == 'pull_request' && steps.changed-files.outputs.any_changed == 'true' }}
working-directory: ${{ github.workspace }}/ci-artifacts
run: |
git checkout -b openpilot/pr-${{ github.event.pull_request.number }}
git config user.name "GitHub Actions Bot"
git config user.email "<>"
sudo mv ${{ github.workspace }}/selfdrive/ui/tests/test_ui/report/screenshots/* .
git add .
git commit -m "screenshots for PR #${{ github.event.pull_request.number }}"
git push origin openpilot/pr-${{ github.event.pull_request.number }} --force
- name: Comment Screenshots on PR
if: ${{ github.event_name == 'pull_request' && steps.changed-files.outputs.any_changed == 'true' }}
uses: thollander/actions-comment-pull-request@v2
with:
message: |
<!-- _(run_id_screenshots **${{ github.run_id }}**)_ -->
## UI Screenshots
<table>
<tr>
<td><img src="https://raw.githubusercontent.com/commaai/ci-artifacts/openpilot/pr-${{ github.event.pull_request.number }}/homescreen.png"></td>
<td><img src="https://raw.githubusercontent.com/commaai/ci-artifacts/openpilot/pr-${{ github.event.pull_request.number }}/onroad.png"></td>
</tr>
<tr>
<td><img src="https://raw.githubusercontent.com/commaai/ci-artifacts/openpilot/pr-${{ github.event.pull_request.number }}/onroad_map.png"></td>
<td><img src="https://raw.githubusercontent.com/commaai/ci-artifacts/openpilot/pr-${{ github.event.pull_request.number }}/onroad_sidebar.png"></td>
</tr>
<tr>
<td><img src="https://raw.githubusercontent.com/commaai/ci-artifacts/openpilot/pr-${{ github.event.pull_request.number }}/settings_network.png"></td>
<td><img src="https://raw.githubusercontent.com/commaai/ci-artifacts/openpilot/pr-${{ github.event.pull_request.number }}/settings_device.png"></td>
</tr>
</table>
comment_tag: run_id_screenshots
pr_number: ${{ github.event.pull_request.number }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/stale.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
steps:
- uses: actions/stale@v9
with:
exempt-milestones: true
exempt-all-milestones: true

# pull request config
stale-pr-message: 'This PR has had no activity for ${{ env.DAYS_BEFORE_PR_STALE }} days. It will be automatically closed in ${{ env.DAYS_BEFORE_PR_CLOSE }} days if there is no activity.'
Expand Down
19 changes: 11 additions & 8 deletions .github/workflows/tools_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,14 @@ on:
branches:
- master
pull_request:

workflow_call:
inputs:
run_number:
default: '1'
required: true
type: string
concurrency:
group: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && github.run_id || github.head_ref || github.ref }}-${{ github.workflow }}-${{ github.event_name }}
group: tools-tests-ci-run-${{ inputs.run_number }}-${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && github.run_id || github.head_ref || github.ref }}-${{ github.workflow }}-${{ github.event_name }}
cancel-in-progress: true

env:
Expand Down Expand Up @@ -53,10 +58,8 @@ jobs:
python-version: '3.11.4'
- name: Installing pip
run: pip install pip==24.0
- name: Installing poetry
run: pip install poetry==1.7.0
- name: Installing python dependencies
run: poetry install --no-cache --no-root
- name: Installing uv
run: pip install uv
- name: git LFS
run: git lfs pull
- run: echo "CACHE_COMMIT_DATE=$(git log -1 --pretty='format:%cd' --date=format:'%Y-%m-%d-%H:%M')" >> $GITHUB_ENV
Expand All @@ -69,7 +72,7 @@ jobs:
scons-${{ runner.arch }}-ubuntu2004-${{ env.CACHE_COMMIT_DATE }}
scons-${{ runner.arch }}-ubuntu2004
- name: Building openpilot
run: poetry run scons -u -j$(nproc)
run: uv run scons -u -j$(nproc)
- name: Saving scons cache
uses: actions/cache/save@v4
if: github.ref == 'refs/heads/master'
Expand Down Expand Up @@ -100,6 +103,6 @@ jobs:
- name: Test environment
run: |
devcontainer exec --workspace-folder . scons -j$(nproc) cereal/ common/
devcontainer exec --workspace-folder . pip install pip-install-test
devcontainer exec --workspace-folder . pip3 install pip-install-test
devcontainer exec --workspace-folder . touch /home/batman/.comma/auth.json
devcontainer exec --workspace-folder . sudo touch /root/test.txt
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ persist
selfdrive/pandad/pandad
cereal/services.h
cereal/gen
cereal/messaging/bridge
selfdrive/logcatd/logcatd
selfdrive/mapd/default_speeds_by_region.json
system/proclogd/proclogd
Expand Down
Loading

0 comments on commit f572384

Please sign in to comment.