ci: increase timeout on cache misses + switch some caches to github (#34056)

* cache

* test ns

* try this

* try

* try now?

* bp

* bp agian

* fix

* remove

* test

* try

* fix

* fix

* regen cache

* fix
This commit is contained in:
Maxime Desroches 2024-11-18 21:16:15 -08:00 committed by GitHub
parent f8497d4af0
commit 3ac9208364
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 15 additions and 38 deletions

View File

@ -14,17 +14,25 @@ inputs:
description: 'whether to save the cache' description: 'whether to save the cache'
default: 'false' default: 'false'
required: false required: false
outputs:
cache-hit:
description: 'cache hit occurred'
value: ${{ (contains(runner.name, 'nsc') && steps.ns-cache.outputs.cache-hit) ||
(!contains(runner.name, 'nsc') && inputs.save != 'false' && steps.gha-cache.outputs.cache-hit) ||
(!contains(runner.name, 'nsc') && inputs.save == 'false' && steps.gha-cache-ro.outputs.cache-hit) }}
runs: runs:
using: "composite" using: "composite"
steps: steps:
- name: setup namespace cache - name: setup namespace cache
id: ns-cache
if: ${{ contains(runner.name, 'nsc') }} if: ${{ contains(runner.name, 'nsc') }}
uses: namespacelabs/nscloud-cache-action@v1 uses: namespacelabs/nscloud-cache-action@v1
with: with:
path: ${{ inputs.path }} path: ${{ inputs.path }}
- name: setup github cache - name: setup github cache
id: gha-cache
if: ${{ !contains(runner.name, 'nsc') && inputs.save != 'false' }} if: ${{ !contains(runner.name, 'nsc') && inputs.save != 'false' }}
uses: 'actions/cache@v4' uses: 'actions/cache@v4'
with: with:
@ -33,6 +41,7 @@ runs:
restore-keys: ${{ inputs.restore-keys }} restore-keys: ${{ inputs.restore-keys }}
- name: setup github cache - name: setup github cache
id: gha-cache-ro
if: ${{ !contains(runner.name, 'nsc') && inputs.save == 'false' }} if: ${{ !contains(runner.name, 'nsc') && inputs.save == 'false' }}
uses: 'actions/cache/restore@v4' uses: 'actions/cache/restore@v4'
with: with:

View File

@ -95,10 +95,8 @@ jobs:
echo "TARGET_ARCHITECTURE=${{ matrix.arch }}" >> "$GITHUB_ENV" echo "TARGET_ARCHITECTURE=${{ matrix.arch }}" >> "$GITHUB_ENV"
$DOCKER_LOGIN $DOCKER_LOGIN
- uses: ./.github/workflows/setup-with-retry - uses: ./.github/workflows/setup-with-retry
with:
docker_hub_pat: ${{ secrets.DOCKER_HUB_PAT }}
- uses: ./.github/workflows/compile-openpilot - 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 timeout-minutes: 30
build_mac: build_mac:
name: build macOS name: build macOS
@ -168,16 +166,8 @@ jobs:
with: with:
submodules: true submodules: true
- uses: ./.github/workflows/setup-with-retry - uses: ./.github/workflows/setup-with-retry
with:
docker_hub_pat: ${{ secrets.DOCKER_HUB_PAT }}
- name: Build openpilot - name: Build openpilot
timeout-minutes: ${{ ((steps.restore-scons-cache.outputs.cache-hit == 'true') && 10 || 30) }} # allow more time when we missed the scons cache
run: ${{ env.RUN }} "scons -j$(nproc)" run: ${{ env.RUN }} "scons -j$(nproc)"
- name: Setup cache
uses: ./.github/workflows/auto-cache
with:
path: .ci_cache/comma_download_cache
key: unit_tests_${{ hashFiles('.github/workflows/selfdrive_tests.yaml') }}
- name: Run unit tests - name: Run unit tests
timeout-minutes: ${{ contains(runner.name, 'nsc') && 1 || 20 }} timeout-minutes: ${{ contains(runner.name, 'nsc') && 1 || 20 }}
run: | run: |
@ -203,19 +193,17 @@ jobs:
with: with:
submodules: true submodules: true
- uses: ./.github/workflows/setup-with-retry - uses: ./.github/workflows/setup-with-retry
with:
docker_hub_pat: ${{ secrets.DOCKER_HUB_PAT }}
- name: Cache test routes - name: Cache test routes
id: dependency-cache id: dependency-cache
uses: actions/cache@v4 uses: actions/cache@v4
with: with:
path: .ci_cache/comma_download_cache path: .ci_cache/comma_download_cache
key: proc-replay-${{ hashFiles('.github/workflows/selfdrive_tests.yaml', 'selfdrive/test/process_replay/ref_commit', 'selfdrive/test/process_replay/test_regen.py') }} key: proc-replay-${{ hashFiles('selfdrive/test/process_replay/ref_commit', 'selfdrive/test/process_replay/test_processes.py') }}
- name: Build openpilot - name: Build openpilot
run: | run: |
${{ env.RUN }} "scons -j$(nproc)" ${{ env.RUN }} "scons -j$(nproc)"
- name: Run replay - name: Run replay
timeout-minutes: ${{ contains(runner.name, 'nsc') && 1 || 20 }} timeout-minutes: ${{ contains(runner.name, 'nsc') && (steps.dependency-cache.outputs.cache-hit == 'true') && 1 || 20 }}
run: | run: |
${{ env.RUN }} "coverage run selfdrive/test/process_replay/test_processes.py -j$(nproc) && \ ${{ env.RUN }} "coverage run selfdrive/test/process_replay/test_processes.py -j$(nproc) && \
chmod -R 777 /tmp/comma_download_cache && \ chmod -R 777 /tmp/comma_download_cache && \
@ -263,15 +251,15 @@ jobs:
submodules: true submodules: true
- uses: ./.github/workflows/setup-with-retry - uses: ./.github/workflows/setup-with-retry
- name: Cache test routes - name: Cache test routes
id: dependency-cache id: routes-cache
uses: ./.github/workflows/auto-cache uses: actions/cache@v4
with: with:
path: .ci_cache/comma_download_cache path: .ci_cache/comma_download_cache
key: car_models-${{ hashFiles('selfdrive/car/tests/test_models.py', 'selfdrive/car/tests/routes.py') }}-${{ matrix.job }} key: car_models-${{ hashFiles('selfdrive/car/tests/test_models.py', 'selfdrive/car/tests/routes.py') }}-${{ matrix.job }}
- name: Build openpilot - name: Build openpilot
run: ${{ env.RUN }} "scons -j$(nproc)" run: ${{ env.RUN }} "scons -j$(nproc)"
- name: Test car models - name: Test car models
timeout-minutes: ${{ contains(runner.name, 'nsc') && 1 || 20 }} timeout-minutes: ${{ contains(runner.name, 'nsc') && (steps.routes-cache.outputs.cache-hit == 'true') && 1 || 20 }}
run: | run: |
${{ env.RUN }} "MAX_EXAMPLES=1 $PYTEST selfdrive/car/tests/test_models.py && \ ${{ env.RUN }} "MAX_EXAMPLES=1 $PYTEST selfdrive/car/tests/test_models.py && \
chmod -R 777 /tmp/comma_download_cache" chmod -R 777 /tmp/comma_download_cache"

View File

@ -17,7 +17,6 @@ runs:
uses: ./.github/workflows/setup uses: ./.github/workflows/setup
continue-on-error: true continue-on-error: true
with: with:
docker_hub_pat: ${{ inputs.docker_hub_pat }}
is_retried: true is_retried: true
- if: steps.setup1.outcome == 'failure' - if: steps.setup1.outcome == 'failure'
shell: bash shell: bash
@ -27,7 +26,6 @@ runs:
uses: ./.github/workflows/setup uses: ./.github/workflows/setup
continue-on-error: true continue-on-error: true
with: with:
docker_hub_pat: ${{ inputs.docker_hub_pat }}
is_retried: true is_retried: true
- if: steps.setup2.outcome == 'failure' - if: steps.setup2.outcome == 'failure'
shell: bash shell: bash
@ -36,5 +34,4 @@ runs:
if: steps.setup2.outcome == 'failure' if: steps.setup2.outcome == 'failure'
uses: ./.github/workflows/setup uses: ./.github/workflows/setup
with: with:
docker_hub_pat: ${{ inputs.docker_hub_pat }}
is_retried: true is_retried: true

View File

@ -1,10 +1,6 @@
name: 'openpilot env setup' name: 'openpilot env setup'
inputs: inputs:
docker_hub_pat:
description: 'Auth token for Docker Hub, required for BuildJet jobs'
required: true
default: ''
is_retried: is_retried:
description: 'A mock param that asserts that we use the setup-with-retry instead of this action directly' description: 'A mock param that asserts that we use the setup-with-retry instead of this action directly'
required: false required: false
@ -36,19 +32,6 @@ runs:
- shell: bash - shell: bash
run: git lfs pull run: git lfs pull
# on BuildJet runners, must be logged into DockerHub to avoid rate limiting
# https://buildjet.com/for-github-actions/docs/guides/docker
- shell: bash
if: ${{ contains(runner.name, 'buildjet') && inputs.docker_hub_pat == '' }}
run: |
echo "Need to set the Docker Hub PAT secret as an input to this action"
exit 1
- name: Login to Docker Hub
if: contains(runner.name, 'buildjet')
shell: bash
run: |
docker login -u adeebshihadeh -p ${{ inputs.docker_hub_pat }}
# build cache # build cache
- id: date - id: date
shell: bash shell: bash