Skip to content

rides-v1: cells= filter + region-cells precompute (phase 1b BE+data) #40

rides-v1: cells= filter + region-cells precompute (phase 1b BE+data)

rides-v1: cells= filter + region-cells precompute (phase 1b BE+data) #40

Workflow file for this run

name: Deploy GBFS Workers
on:
push:
branches: [main]
paths:
- 'gbfs/worker/**'
- 'gbfs/loader/**'
- 'gbfs/api/**'
- 'gbfs/compactor/**'
- '.github/workflows/gbfs.yml'
workflow_dispatch:
inputs:
worker:
description: 'Worker to deploy (default: all)'
required: false
type: choice
options: [all, worker, loader, api, compactor]
default: all
jobs:
detect-changes:
runs-on: ubuntu-latest
outputs:
worker: ${{ steps.filter.outputs.worker }}
loader: ${{ steps.filter.outputs.loader }}
api: ${{ steps.filter.outputs.api }}
compactor: ${{ steps.filter.outputs.compactor }}
steps:
- uses: actions/checkout@v5
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
worker:
- 'gbfs/worker/**'
loader:
- 'gbfs/loader/**'
api:
- 'gbfs/api/**'
compactor:
- 'gbfs/compactor/**'
deploy:
needs: detect-changes
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
worker: [worker, loader, api, compactor]
steps:
- name: Check if this worker should deploy
id: should
run: |
want="${{ inputs.worker || 'all' }}"
if [ "$want" = "all" ]; then
case "${{ matrix.worker }}" in
worker) deploy="${{ needs.detect-changes.outputs.worker }}";;
loader) deploy="${{ needs.detect-changes.outputs.loader }}";;
api) deploy="${{ needs.detect-changes.outputs.api }}";;
compactor) deploy="${{ needs.detect-changes.outputs.compactor }}";;
esac
elif [ "$want" = "${{ matrix.worker }}" ]; then
deploy=true
else
deploy=false
fi
echo "deploy=$deploy" >> "$GITHUB_OUTPUT"
echo "Deploy ${{ matrix.worker }}: $deploy"
- if: steps.should.outputs.deploy == 'true'
uses: actions/checkout@v5
- if: steps.should.outputs.deploy == 'true'
uses: actions/setup-node@v5
with:
node-version: '22'
- if: steps.should.outputs.deploy == 'true'
uses: pnpm/action-setup@v4
with:
version: 10
- if: steps.should.outputs.deploy == 'true'
run: pnpm install --frozen-lockfile
working-directory: gbfs/${{ matrix.worker }}
- name: Tests (gate deploy)
if: steps.should.outputs.deploy == 'true'
working-directory: gbfs/${{ matrix.worker }}
run: |
# Run `pnpm test` if defined (currently only `gbfs/api` has
# tests — vitest planQuery suite). Skip silently otherwise.
if node -e "process.exit(require('./package.json').scripts?.test ? 0 : 1)"; then
pnpm test
else
echo "no test script in gbfs/${{ matrix.worker }}/package.json — skipping"
fi
- if: steps.should.outputs.deploy == 'true'
run: npx wrangler deploy
working-directory: gbfs/${{ matrix.worker }}
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}