Skip to content

Ferry Run

Ferry Run #462

Workflow file for this run

name: Ferry Run
on:
push:
branches: [master]
paths:
- "**.py"
- ".github/workflows/ferry.yml"
- "config/release*.yml"
schedule:
- cron: "43 7 * * *"
workflow_dispatch:
jobs:
ferry:
runs-on: ubuntu-latest
timeout-minutes: 40
strategy:
matrix:
python-version: ["3.12"]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: coursetable/ferry-data
path: data
ssh-key: ${{ secrets.REPO_SSH_KEY }}
fetch-depth: 1
- name: Install Packages
run: |
sudo apt-get update
sudo apt-get -y install gcc g++ musl-dev libffi-dev libpq-dev libhdf5-dev python3-tables graphviz libgraphviz-dev
- uses: actions/cache@v4
id: cache-uv
with:
path: ~/.cache/uv
key: ${{ runner.os }}-python-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}
restore-keys: |
${{ runner.os }}-python-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}
${{ runner.os }}-python-${{ matrix.python-version }}-
${{ runner.os }}-
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install uv and create virtual environment
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
uv venv .venv
echo "VIRTUAL_ENV=.venv" >> $GITHUB_ENV
echo "$PWD/.venv/bin" >> $GITHUB_PATH
- name: Install dependencies
run: uv pip install -e .
- name: Fetch latest 4 seasons
run: TQDM_DISABLE=1 python main.py -f config/release_fetch.yml --database-connect-string ${{ secrets.DATABASE_CONNECT_STRING }} --sentry-url ${{ secrets.SENTRY_URL }}
- name: Sync Postgres DB
run: TQDM_DISABLE=1 python main.py -f config/release_sync_db.yml --database-connect-string ${{ secrets.DATABASE_CONNECT_STRING }} --sentry-url ${{ secrets.SENTRY_URL }}
- name: Calculate commit message
run: |
if [ "${{ github.event_name }}" == "schedule" ]; then
echo "MSG=$(date): Scheduled update" >> $GITHUB_ENV
elif [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
echo "MSG=$(date): Manual update by ${{ github.actor }}" >> $GITHUB_ENV
elif [ "${{ github.event_name }}" == "push" ]; then
echo "MSG=$(date): Update based on $GITHUB_SHA" >> $GITHUB_ENV
else
echo "MSG=$(date): Update" >> $GITHUB_ENV
fi
- name: Commit updated ferry-data
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: ${{ env.MSG }}
commit_user_name: "Ferry Bot"
commit_user_email: "[email protected]"
commit_author: course-table <[email protected]>
repository: data
skip_dirty_check: false
- name: Regenerate static catalog on server
run: |
curl --silent --show-error -H "X-FERRY-SECRET: ${{secrets.FERRY_SECRET}}" https://api.coursetable.com/api/catalog/refresh
curl --silent --show-error -H "X-FERRY-SECRET: ${{secrets.FERRY_SECRET}}" https://api-staging.coursetable.com/api/catalog/refresh