Skip to content

Add automotive reference implementation workflow #218

Add automotive reference implementation workflow

Add automotive reference implementation workflow #218

name: Test script on modified meta
on:
pull_request:
branches: [ "main", "dev" ]
paths:
- 'script/**meta.yaml'
jobs:
fetch-secret:
runs-on: ubuntu-latest
outputs:
gdrive_secret: ${{ steps.op-load-secret.outputs.GDRIVE_SERVICE_ACCOUNT_KEY }}
steps:
- name: Load secret from 1Password
id: op-load-secret
uses: 1password/load-secrets-action@v2
with:
export-env: false
env:
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
GDRIVE_SERVICE_ACCOUNT_KEY: op://7basd2jirojjckncf6qnq3azai/bzbaco3uxoqs2rcyu42rvuccga/credential
get_modified_files:
runs-on: ubuntu-latest
outputs:
processed_files: ${{ steps.filter-modified-files.outputs.processed_files }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
run: pip install pyyaml
- name: Fetch base branch
run: |
git fetch origin +refs/heads/${{ github.event.pull_request.base.ref }}:refs/remotes/origin/${{ github.event.pull_request.base.ref }}
- name: Get list of changed files
id: modified-files
run: |
git diff --name-only origin/${{ github.event.pull_request.base.ref }}...HEAD > changed_files.txt
files=$(paste -sd, changed_files.txt)
echo "files=$files" >> $GITHUB_OUTPUT
- name: Filter changed files
id: filter-modified-files
env:
FILES: ${{ steps.modified-files.outputs.files }}
run: |
processed=$(echo "$FILES" | python3 .github/scripts/list_modified_files.py)
echo "processed_files<<EOF" >> $GITHUB_OUTPUT
echo "$processed" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Debug processed_files output
run: |
echo "Processed files output:"
echo "${{ steps.filter-modified-files.outputs.processed_files }}"
process_modified_files:
runs-on: ubuntu-latest
needs:
- get_modified_files
- fetch-secret
if: needs.determine_modified_files.outputs.processed_files != '[]'
strategy:
fail-fast: false
matrix:
file_info: ${{ fromJSON(needs.get_modified_files.outputs.processed_files) }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Set RCLONE Service account env var from secret
shell: bash
run: |
echo "::add-mask::${{ needs.fetch-secret.outputs.gdrive_secret }}"
echo "RCLONE_CONFIG_MLC_COGNATA_SERVICE_ACCOUNT_CREDENTIALS=${{ needs.fetch-secret.outputs.gdrive_secret }}" >> $GITHUB_ENV
echo "RCLONE_CONFIG_MLC_NUSCENES_SERVICE_ACCOUNT_CREDENTIALS=${{ needs.fetch-secret.outputs.gdrive_secret }}" >> $GITHUB_ENV
echo "RCLONE_CONFIG_MLC_WAYMO_SERVICE_ACCOUNT_CREDENTIALS=${{ needs.fetch-secret.outputs.gdrive_secret }}" >> $GITHUB_ENV
- name: Process meta.yaml file
run: |
echo "Processing ${{ matrix.file_info.file }} (run #${{ matrix.file_info.num_run }})"
pip install mlcflow
mlc pull repo ${{ github.event.pull_request.head.repo.html_url }} --branch=${{ github.event.pull_request.head.ref }}
mlc test script ${{ matrix.file_info.uid }} --test_input_index=${{ matrix.file_info.num_run }} --docker_mlc_repo=${{ github.event.pull_request.head.repo.html_url }} --docker_mlc_repo_branch=${{ github.event.pull_request.head.ref }} --quiet