forked from commaai/openpilot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3f5bad0
commit 995af85
Showing
1 changed file
with
88 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
name: ui | ||
|
||
on: | ||
push: | ||
branches: | ||
- test-ui | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
|
||
concurrency: | ||
group: ${{ 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: | ||
BASE_IMAGE: openpilot-base | ||
CL_BASE_IMAGE: openpilot-base-cl | ||
DOCKER_LOGIN: docker login ghcr.io -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} | ||
|
||
BUILD: selfdrive/test/docker_build.sh base | ||
|
||
RUN: docker run --shm-size 1G -v $GITHUB_WORKSPACE:/tmp/openpilot -w /tmp/openpilot -e FILEREADER_CACHE=1 -e PYTHONPATH=/tmp/openpilot -e NUM_JOBS -e JOB_ID -e GITHUB_ACTION -e GITHUB_REF -e GITHUB_HEAD_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_RUN_ID -v $GITHUB_WORKSPACE/.ci_cache/scons_cache:/tmp/scons_cache -v $GITHUB_WORKSPACE/.ci_cache/comma_download_cache:/tmp/comma_download_cache -v $GITHUB_WORKSPACE/.ci_cache/openpilot_cache:/tmp/openpilot_cache $BASE_IMAGE /bin/bash -c | ||
|
||
BUILD_CL: selfdrive/test/docker_build.sh cl | ||
|
||
RUN_CL: docker run --shm-size 1G -v $GITHUB_WORKSPACE:/tmp/openpilot -w /tmp/openpilot -e PYTHONPATH=/tmp/openpilot -e NUM_JOBS -e JOB_ID -e GITHUB_ACTION -e GITHUB_REF -e GITHUB_HEAD_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_RUN_ID -v $GITHUB_WORKSPACE/.ci_cache/scons_cache:/tmp/scons_cache -v $GITHUB_WORKSPACE/.ci_cache/comma_download_cache:/tmp/comma_download_cache -v $GITHUB_WORKSPACE/.ci_cache/openpilot_cache:/tmp/openpilot_cache $CL_BASE_IMAGE /bin/bash -c | ||
|
||
|
||
jobs: | ||
screenshots: | ||
name: screenshots | ||
runs-on: ubuntu-20.04 | ||
timeout-minutes: 20 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
- run: git lfs pull | ||
- uses: ./.github/workflows/setup-with-retry | ||
- name: Build base docker image | ||
run: eval "$BUILD" | ||
- name: Build base cl image | ||
run: eval "$BUILD_CL" | ||
- name: Build openpilot | ||
run: | | ||
${{ env.RUN }} "scons -j$(nproc)" | ||
- name: Run UI Screenshots | ||
run: | | ||
${{ env.RUN_CL }} "source selfdrive/test/setup_xvfb.sh && python selfdrive/ui/tests/test_ui/run.py" | ||
- name: Upload Report | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: html-report | ||
path: | | ||
selfdrive/ui/tests/test_ui/report/index.html | ||
selfdrive/ui/tests/test_ui/report/screenshots | ||
- name: Deploy to GitHub Pages | ||
uses: JamesIves/github-pages-deploy-action@4.1.4 | ||
with: | ||
branch: gh-pages | ||
repository-name: ${{ github.repository }} | ||
target-folder: pr--${{ github.sha }} | ||
folder: selfdrive/ui/tests/test_ui/report | ||
|
||
- name: Append PR Link to Index | ||
if: success() | ||
run: | | ||
git fetch origin gh-pages --depth=1 | ||
git checkout gh-pages | ||
echo "<li><a href='pr--${{ github.sha }}/index.html'>PR #-${{ github.sha }}</a></li>" >> index.html | ||
git config user.name "github-actions" | ||
git config user.email "github-actions@github.com" | ||
git add index.html | ||
git commit -m "Update index.html with PR #-${{ github.sha }}" | ||
- name: Push Changes with Retry | ||
if: success() | ||
run: | | ||
max_attempts=3 | ||
attempt=0 | ||
until git push origin gh-pages; do | ||
git pull --rebase origin gh-pages | ||
attempt=$((attempt+1)) | ||
if [ "$attempt" -ge "$max_attempts" ]; then | ||
echo "Push failed after $attempt attempts." | ||
exit 1 | ||
fi | ||
sleep 3 | ||
done |