Daily Collection #46
This file contains hidden or 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: 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: | |
| environment: prod | |
| 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 dependencies | |
| run: | | |
| uv pip install . | |
| - name: Collect PyPI Downloads | |
| run: | | |
| uv run pymetrics collect-pypi \ | |
| --max-days ${{ inputs.max_days_pypi || 30 }} \ | |
| --add-metrics \ | |
| --output-folder ${{ secrets.PYPI_OUTPUT_FOLDER }} | |
| env: | |
| PYDRIVE_CREDENTIALS: ${{ secrets.PYDRIVE_CREDENTIALS }} | |
| BIGQUERY_CREDENTIALS: ${{ secrets.BIGQUERY_CREDENTIALS }} | |
| PYPI_OUTPUT_FOLDER: ${{ secrets.PYPI_OUTPUT_FOLDER }} | |
| - name: Collect Anaconda Downloads | |
| run: | | |
| uv run pymetrics collect-anaconda \ | |
| --output-folder ${{ secrets.ANACONDA_OUTPUT_FOLDER }} \ | |
| --max-days ${{ inputs.max_days_anaconda || 90 }} | |
| env: | |
| PYDRIVE_CREDENTIALS: ${{ secrets.PYDRIVE_CREDENTIALS }} | |
| ANACONDA_OUTPUT_FOLDER: ${{ secrets.ANACONDA_OUTPUT_FOLDER }} | |
| 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 -e .[dev] | |
| - name: Slack alert if failure | |
| run: | | |
| uv run python -m pymetrics.slack_utils \ | |
| -r ${{ github.run_id }} \ | |
| -c ${{ github.event.inputs.slack_channel || 'sdv-alerts' }} \ | |
| -m 'Daily Collection PyMetrics failed :fire: :dumpster-fire: :fire:' | |
| env: | |
| SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }} |