2023-05-21 16:50:58 +08:00
|
|
|
name: Sync Google Sheets data
|
2023-05-21 16:48:43 +08:00
|
|
|
|
|
|
|
on:
|
|
|
|
schedule:
|
|
|
|
- cron: "50 * * * *" # 50 past every hour
|
|
|
|
workflow_dispatch:
|
2023-05-21 16:57:30 +08:00
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- develop
|
2023-05-21 16:48:43 +08:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
pull-sheets:
|
2023-05-21 16:50:58 +08:00
|
|
|
name: Sync Google Sheets data
|
2023-05-21 16:48:43 +08:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
2023-09-02 09:11:57 +08:00
|
|
|
- name: Clone BDDL repo
|
2023-05-21 16:48:43 +08:00
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
2023-09-02 09:11:57 +08:00
|
|
|
path: bddl
|
2023-05-21 16:48:43 +08:00
|
|
|
ref: develop
|
2023-09-02 09:11:57 +08:00
|
|
|
|
|
|
|
- name: Clone ig pipeline repo
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
repository: StanfordVL/ig_pipeline
|
|
|
|
path: ig_pipeline
|
|
|
|
token: ${{ secrets.REPO_TOKEN }}
|
2023-05-21 16:48:43 +08:00
|
|
|
|
|
|
|
- name: Setup python
|
|
|
|
uses: actions/setup-python@v2
|
|
|
|
with:
|
|
|
|
python-version: "3.8"
|
|
|
|
architecture: x64
|
|
|
|
|
2023-09-02 17:26:14 +08:00
|
|
|
- name: Authenticate on Google Cloud
|
|
|
|
uses: 'google-github-actions/auth@v1'
|
|
|
|
with:
|
|
|
|
credentials_json: '${{ secrets.GCP_CREDENTIALS }}'
|
|
|
|
|
2023-09-02 09:11:57 +08:00
|
|
|
# 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
|
2023-05-21 16:59:37 +08:00
|
|
|
|
2023-09-02 09:11:57 +08:00
|
|
|
- if: ${{ steps.cache-pipeline.outputs.cache-hit != 'true' }}
|
|
|
|
name: Install dvc
|
|
|
|
run: pip install dvc[gs]
|
2023-05-21 16:48:43 +08:00
|
|
|
|
2023-09-02 09:11:57 +08:00
|
|
|
- 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
|
2023-09-02 13:28:49 +08:00
|
|
|
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
|
2023-09-02 09:11:57 +08:00
|
|
|
|
|
|
|
- name: Install BDDL
|
|
|
|
working-directory: bddl
|
|
|
|
run: pip install -e .
|
|
|
|
|
|
|
|
- name: Install dev requirements
|
|
|
|
working-directory: bddl
|
|
|
|
run: pip install -r requirements-dev.txt
|
|
|
|
|
2023-05-21 16:48:43 +08:00
|
|
|
- name: Refresh sheets data
|
2023-09-02 09:11:57 +08:00
|
|
|
working-directory: bddl
|
2023-05-21 16:48:43 +08:00
|
|
|
run: python -m bddl.data_generation.pull_sheets
|
|
|
|
|
2023-05-23 08:01:14 +08:00
|
|
|
- name: Refresh derivative data
|
2023-09-02 09:11:57 +08:00
|
|
|
working-directory: bddl
|
2023-07-31 07:15:37 +08:00
|
|
|
run: python -m bddl.data_generation.generate_datafiles
|
2023-05-23 08:01:14 +08:00
|
|
|
|
2023-05-21 16:48:43 +08:00
|
|
|
- uses: stefanzweifel/git-auto-commit-action@v4
|
|
|
|
with:
|
|
|
|
commit_message: "Sync Google Sheets data"
|
2023-09-02 09:11:57 +08:00
|
|
|
repository: bddl
|