From 8369c59dcc43d7901eb71c5e91563523654b27b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cem=20G=C3=B6kmen?= Date: Sat, 27 Jan 2024 18:34:21 -0800 Subject: [PATCH] Cherry-pick: Updates to workflow --- .github/workflows/pull-sheets.yml | 54 +++++++++++++++++++++++++++---- 1 file changed, 48 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pull-sheets.yml b/.github/workflows/pull-sheets.yml index 14d1c40e..5ea1b1a5 100644 --- a/.github/workflows/pull-sheets.yml +++ b/.github/workflows/pull-sheets.yml @@ -14,10 +14,18 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout code + - name: Clone BDDL repo uses: actions/checkout@v3 with: + path: bddl ref: develop + + - name: Clone ig pipeline repo + uses: actions/checkout@v3 + with: + repository: StanfordVL/ig_pipeline + path: ig_pipeline + token: ${{ secrets.REPO_TOKEN }} - name: Setup python uses: actions/setup-python@v2 @@ -25,23 +33,57 @@ jobs: python-version: "3.8" architecture: x64 + - name: Authenticate on Google Cloud + uses: 'google-github-actions/auth@v1' + with: + credentials_json: '${{ secrets.GCP_CREDENTIALS }}' + + # See if we need to re-pull any ig_pipeline data from DVC. + - name: Check cache for ig_pipeline data + id: cache-pipeline + uses: actions/cache@v3 + with: + key: ig_pipeline-${{ hashFiles('ig_pipeline/dvc.lock') }} + path: | + ig_pipeline/artifacts/pipeline/combined_room_object_list.json + ig_pipeline/artifacts/pipeline/combined_room_object_list_future.json + ig_pipeline/artifacts/pipeline/object_inventory.json + ig_pipeline/artifacts/pipeline/object_inventory_future.json + + - if: ${{ steps.cache-pipeline.outputs.cache-hit != 'true' }} + name: Install dvc + run: pip install dvc[gs] + + - if: ${{ steps.cache-pipeline.outputs.cache-hit != 'true' }} + name: Pull dvc data + working-directory: ig_pipeline + run: dvc pull combined_room_object_list combined_room_object_list_future object_inventory object_inventory_future + + - if: ${{ steps.cache-pipeline.outputs.cache-hit != 'true' }} + name: Unprotect data + working-directory: ig_pipeline + run: dvc unprotect artifacts/pipeline/combined_room_object_list.json artifacts/pipeline/combined_room_object_list_future.json artifacts/pipeline/object_inventory.json artifacts/pipeline/object_inventory_future.json + + - name: Copy over ig_pipeline files + run: cp ig_pipeline/artifacts/pipeline/{combined_room_object_list,combined_room_object_list_future,object_inventory,object_inventory_future}.json bddl/bddl/generated_data + - name: Install BDDL + working-directory: bddl run: pip install -e . - name: Install dev requirements + working-directory: bddl run: pip install -r requirements-dev.txt - - name: Authenticate on Google Cloud - uses: 'google-github-actions/auth@v1' - with: - credentials_json: '${{ secrets.GCP_CREDENTIALS }}' - - name: Refresh sheets data + working-directory: bddl run: python -m bddl.data_generation.pull_sheets - name: Refresh derivative data + working-directory: bddl run: python -m bddl.data_generation.generate_datafiles - uses: stefanzweifel/git-auto-commit-action@v4 with: commit_message: "Sync Google Sheets data" + repository: bddl