DB Refresh (Objects API) #12175
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
name: DB Refresh (Objects API) | |
on: | |
schedule: | |
# - cron: '0 5 * * *' # every day 5am GMT (12-1am EST/EDT) | |
- cron: '*/20 * * * *' # every 20 minutes | |
# - cron: '0 * * * *' # every hour on the hour | |
workflow_dispatch: | |
repository_dispatch: | |
types: [refresh-db] | |
jobs: | |
refresh-db: | |
# runs-on: ubuntu-18.04 | |
# runs-on: ubuntu-latest # not sure which is more current when resolving merge conflicts | |
# todo: macos-latest: I think was just needed for datasets API because of high memory. should be able to switch back to ubuntu | |
runs-on: macos-latest | |
steps: | |
# Set up | |
- name: Checkout repository and submodules | |
uses: actions/checkout@v2 | |
- name: Set up Python version | |
uses: actions/setup-python@v2 | |
with: | |
# Consider '3.10' or 'v3.10.0': https://github.com/actions/setup-python/issues/160 | |
python-version: '3.9.7' # Not sure why 3.9.7 here and 3.9 elsewhere. the .7 works on mac, but not on ubuntu | |
- name: Print commit hash & branch for rollbacks & troubleshooting | |
run: | | |
echo "Commit hash: ${{ github.sha }}" | |
echo "Branch: ${{ github.ref }}" | |
- name: 'Create env file' | |
run: | | |
mkdir env | |
echo "${{ secrets.ENV_FILE }}" > env/.env | |
- name: Create and start virtual environment | |
run: | | |
python3 -m venv venv | |
source venv/bin/activate | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install --upgrade wheel | |
pip install --upgrade setuptools | |
pip install -r requirements.txt | |
# Refresh | |
- name: Refresh db | |
run: | | |
python backend/db/refresh.py | |
- name: Commit changes to documentation | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: Updating documentation in docs/backend/db/analysis.md | |
# fetch-missing-csets: Deactivated because various tweaks and default re-refresh buffer solve this problem, and | |
# also test-missing-csets is there as a redundancy. Original context: | |
# https://github.com/jhu-bids/TermHub/issues/573 https://github.com/jhu-bids/TermHub/issues/574 | |
# - name: Fetch missing csets | |
# run: make fetch-missing-csets | |
# Test | |
# todo: add more tests, ideally | |
- name: Test missing csets | |
run: make test-missing-csets |