chore(deps): update dependency @types/node to ^22.9.3 #341
This file contains 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: Tiles Worker | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
branches: [main] | |
concurrency: | |
group: ${{ github.workflow }} | |
cancel-in-progress: true | |
env: | |
tofu_version: '1.7.1' | |
tg_version: '0.58.12' | |
jobs: | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./tiles | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: './tiles/.nvmrc' | |
- name: Run npm install | |
run: npm ci | |
- name: Run linter | |
run: npm run lint | |
if: ${{ !cancelled() }} | |
- name: Run formatter | |
run: npm run format | |
if: ${{ !cancelled() }} | |
- name: Run tsc | |
run: npm run check | |
if: ${{ !cancelled() }} | |
- name: Run unit tests & coverage | |
run: npm run test:cov | |
if: ${{ !cancelled() }} | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./tiles | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: './tiles/.nvmrc' | |
- name: Run npm install | |
run: npm ci | |
- name: Run tsc | |
run: npm run check | |
if: ${{ !cancelled() }} | |
- name: Wrangler build | |
run: npm run build | |
if: ${{ !cancelled() }} | |
- name: Upload build output | |
uses: actions/upload-artifact@v4 | |
with: | |
name: tiles-build-output | |
path: tiles/dist | |
retention-days: 14 | |
if: ${{ !cancelled() }} | |
check-terragrunt: | |
name: Check Terragrunt | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: deployment | |
steps: | |
- name: 'Checkout' | |
uses: actions/checkout@main | |
- name: Install 1Password CLI | |
uses: 1password/install-cli-action@v1 | |
- name: Install Terragrunt | |
uses: eLco/setup-terragrunt@v1 | |
with: | |
terragrunt_version: ${{ env.tg_version }} | |
- name: 'Install OpenTofu' | |
uses: opentofu/setup-opentofu@v1 | |
with: | |
tofu_version: ${{ env.tofu_version }} | |
tofu_wrapper: false | |
- name: Check Formatting | |
run: terragrunt hclfmt --terragrunt-check --terragrunt-diff | |
- name: Check TF fmt | |
env: | |
ENVIRONMENT: dev | |
OP_SERVICE_ACCOUNT_TOKEN: ${{ matrix.environment == 'prod' && secrets.OP_TF_PROD_ENV || secrets.OP_TF_DEV_ENV }} | |
TF_VAR_tiles_build_dir: "${{ github.workspace }}/dist" | |
run: op run --env-file=".env" -- terragrunt run-all fmt -diff -check | |
plan-terragrunt: | |
needs: build | |
name: Plan Terragrunt | |
runs-on: ubuntu-latest | |
strategy: | |
max-parallel: 1 | |
matrix: | |
environment: [dev, prod] | |
if: github.ref != 'refs/heads/main' && github.event_name != 'workflow_dispatch' | |
steps: | |
- name: 'Checkout' | |
uses: actions/checkout@main | |
- name: Install Terragrunt | |
uses: eLco/setup-terragrunt@v1 | |
with: | |
terragrunt_version: ${{ env.tg_version }} | |
- name: Install 1Password CLI | |
uses: 1password/install-cli-action@v1 | |
- name: 'Install OpenTofu' | |
uses: opentofu/setup-opentofu@v1 | |
with: | |
tofu_version: ${{ env.tofu_version }} | |
tofu_wrapper: false | |
- name: 'Get build artifact' | |
uses: actions/download-artifact@v4 | |
with: | |
name: tiles-build-output | |
path: "${{ github.workspace }}/dist" | |
- name: Plan All | |
working-directory: ${{ github.workspace }}/deployment | |
env: | |
ENVIRONMENT: ${{ matrix.environment }} | |
OP_SERVICE_ACCOUNT_TOKEN: ${{ matrix.environment == 'prod' && secrets.OP_TF_PROD_ENV || secrets.OP_TF_DEV_ENV }} | |
TF_VAR_tiles_build_dir: "${{ github.workspace }}/dist" | |
run: op run --env-file=".env" -- terragrunt run-all plan -no-color 2>&1 | tee "${{github.workspace}}/plan_output.txt" && exit ${PIPESTATUS[0]}; | |
kv-warming: | |
needs: [build, test] | |
name: KV Warming | |
runs-on: mich | |
if: github.event_name == 'workflow_dispatch' || github.ref == 'refs/heads/main' | |
defaults: | |
run: | |
working-directory: ./tiles | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: './tiles/.nvmrc' | |
- name: Run npm install | |
run: npm ci | |
- name: Get tiles.json | |
run: echo "TILES_JSON=$(jq -c . < ${{ github.workspace }}/deployment/modules/cloudflare/tiles-worker/tiles.tfvars.json)" >> $GITHUB_ENV | |
- name: Run kv warming | |
env: | |
S3_ACCESS_KEY: ${{ secrets.CLOUDFLARE_TILES_R2_KV_TOKEN_ID }} | |
S3_SECRET_KEY: ${{ secrets.CLOUDFLARE_TILES_R2_KV_TOKEN_HASHED_VALUE }} | |
S3_ENDPOINT: https://${{ secrets.CLOUDFLARE_ACCOUNT_ID }}.r2.cloudflarestorage.com | |
KV_API_KEY: ${{ secrets.CLOUDFLARE_TILES_R2_KV_TOKEN_VALUE }} | |
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
# Figure out how to extract this from terraform at some point or get it into github vars | |
KV_NAMESPACE_ID: 5a4b82694e8b490db8b8904cdaea4f00 | |
BUCKET_KEY: tiles-weur | |
DEPLOYMENT_KEY: ${{ fromJson(env.TILES_JSON).pmtiles_deployment_key }} | |
run: npm run kv:warm | |
deploy-terragrunt: | |
needs: [build, test, kv-warming] | |
name: Deploy Terragrunt | |
runs-on: ubuntu-latest | |
if: github.event_name == 'workflow_dispatch' || github.ref == 'refs/heads/main' | |
env: | |
ENVIRONMENT: ${{ github.ref == 'refs/heads/main' && 'prod' || 'dev' }} | |
steps: | |
- name: 'Checkout' | |
uses: actions/checkout@main | |
- name: Install 1Password CLI | |
uses: 1password/install-cli-action@v1 | |
- name: Install Terragrunt | |
uses: eLco/setup-terragrunt@v1 | |
with: | |
terragrunt_version: ${{ env.tg_version }} | |
- name: 'Install OpenTofu' | |
uses: opentofu/setup-opentofu@v1 | |
with: | |
tofu_version: ${{ env.tofu_version }} | |
tofu_wrapper: false | |
- name: 'Get build artifact' | |
uses: actions/download-artifact@v4 | |
with: | |
name: tiles-build-output | |
path: "${{ github.workspace }}/dist" | |
- name: Deploy All | |
working-directory: ${{ github.workspace }}/deployment | |
env: | |
OP_SERVICE_ACCOUNT_TOKEN: ${{ github.ref == 'refs/heads/main' && secrets.OP_TF_PROD_ENV || secrets.OP_TF_DEV_ENV }} | |
TF_VAR_tiles_build_dir: "${{ github.workspace }}/dist" | |
run: op run --env-file=".env" -- terragrunt run-all apply --terragrunt-non-interactive |