Skip to content

Daily Collection

Daily Collection #37

name: Daily Collection
on:
workflow_dispatch:
inputs:
slack_channel:
description: Slack channel to post the error message to if the builds fail.
required: false
default: "sdv-alerts-debug"
max_days_pypi:
description: 'Maximum number of days to collect, starting from today for PyPI.'
required: false
type: number
default: 30
max_days_anaconda:
description: 'Maximum number of days to collect, starting from today for Anaconda'
required: false
type: number
default: 90
schedule:
- cron: '0 0 * * *'
jobs:
collect:
runs-on: ubuntu-latest-large
timeout-minutes: 25
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
enable-cache: true
activate-environment: true
cache-dependency-glob: |
**/pyproject.toml
**/__main__.py
- name: Install pip and dependencies
run: |
uv pip install -U pip
uv pip install .
- name: Collect PyPI Downloads
run: |
uv run download-analytics collect-pypi \
--verbose \
--max-days ${{ inputs.max_days_pypi || 30 }} \
--add-metrics \
--output-folder gdrive://10QHbqyvptmZX4yhu2Y38YJbVHqINRr0n
env:
PYDRIVE_CREDENTIALS: ${{ secrets.PYDRIVE_CREDENTIALS }}
BIGQUERY_CREDENTIALS: ${{ secrets.BIGQUERY_CREDENTIALS }}
- name: Collect Anaconda Downloads
run: |
uv run download-analytics collect-anaconda \
--output-folder gdrive://1UnDYovLkL4gletOF5328BG1X59mSHF-Z \
--max-days ${{ inputs.max_days_anaconda || 90 }} \
--verbose
env:
PYDRIVE_CREDENTIALS: ${{ secrets.PYDRIVE_CREDENTIALS }}
alert:
needs: [collect]
runs-on: ubuntu-latest
if: failure()
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
enable-cache: true
activate-environment: true
- name: Install pip and dependencies
run: |
uv pip install -U pip
uv pip install -e .[dev]
- name: Slack alert if failure
run: uv run python -m download_analytics.slack_utils -r ${{ github.run_id }} -c ${{ github.event.inputs.slack_channel || 'sdv-alerts' }}
env:
SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }}