GBFS Daily Compaction #26
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: GBFS Daily Compaction | |
| on: | |
| schedule: | |
| - cron: '15 0 * * *' # 00:15 UTC, after all per-minute WALs for yesterday are written | |
| workflow_dispatch: | |
| inputs: | |
| date: | |
| description: 'Date to compact (YYYY-MM-DD, default: yesterday)' | |
| required: false | |
| jobs: | |
| compact: | |
| runs-on: ubuntu-latest | |
| env: | |
| AWS_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }} | |
| AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }} | |
| AWS_ENDPOINT_URL: https://${{ secrets.CLOUDFLARE_ACCOUNT_ID }}.r2.cloudflarestorage.com | |
| AWS_DEFAULT_REGION: auto | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Install dependencies | |
| run: pip install pandas pyarrow | |
| - name: Determine date | |
| id: date | |
| run: | | |
| if [ -n "${{ inputs.date }}" ]; then | |
| echo "date=${{ inputs.date }}" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "date=$(date -u -d yesterday +%Y-%m-%d)" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Compact WAL → parquet | |
| run: python3 gbfs/compact-r2.py all ${{ steps.date.outputs.date }} |