Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
version: 2
updates:
# Maintain dependencies for npm/yarn packages
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"
day: "monday"
time: "09:00"
timezone: "UTC"
open-pull-requests-limit: 10
labels:
- "dependencies"
- "automated"
commit-message:
prefix: "chore(deps)"
groups:
# Group minor and patch updates together
minor-and-patch:
patterns:
- "*"
update-types:
- "minor"
- "patch"
ignore:
# Ignore major version updates for stability - these should be reviewed manually
- dependency-name: "*"
update-types: ["version-update:semver-major"]

# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
day: "monday"
time: "09:00"
timezone: "UTC"
open-pull-requests-limit: 5
labels:
- "dependencies"
- "github-actions"
- "automated"
commit-message:
prefix: "chore(ci)"
groups:
# Group all GitHub Actions updates together
actions:
patterns:
- "*"
49 changes: 49 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: "CodeQL Security Analysis"

on:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
# Run weekly on Sundays at 00:00 UTC
- cron: "0 0 * * 0"
workflow_dispatch:

permissions:
actions: read
contents: read
security-events: write

jobs:
analyze:
name: Analyze
runs-on: blacksmith-4vcpu-ubuntu-2404
timeout-minutes: 30

strategy:
fail-fast: false
matrix:
language:
- javascript-typescript

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# Use default queries plus security-extended and security-and-quality
queries: security-extended,security-and-quality

- name: Autobuild
uses: github/codeql-action/autobuild@v3

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{ matrix.language }}"
94 changes: 94 additions & 0 deletions .github/workflows/deploy-staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Deploy to Staging

on:
push:
branches:
- main
workflow_dispatch:
inputs:
environment:
description: "Environment to deploy to"
required: true
default: "staging"
type: choice
options:
- staging

permissions:
contents: read
packages: write

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push:
name: Build and Push Docker Image
runs-on: blacksmith-4vcpu-ubuntu-2404
outputs:
image-tag: ${{ steps.meta.outputs.tags }}
image-digest: ${{ steps.build.outputs.digest }}
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=sha,prefix=staging-
type=raw,value=staging-latest

- name: Build and push Docker image
id: build
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
NEXT_PUBLIC_WEBAPP_URL=${{ vars.STAGING_WEBAPP_URL }}
NEXT_PUBLIC_API_V2_URL=${{ vars.STAGING_API_V2_URL }}

deploy:
name: Deploy to Staging
needs: build-and-push
runs-on: blacksmith-2vcpu-ubuntu-2404
environment:
name: staging
url: ${{ vars.STAGING_WEBAPP_URL }}
steps:
- name: Deploy notification
run: |
echo "Deploying image with digest: ${{ needs.build-and-push.outputs.image-digest }}"
echo "Image tags: ${{ needs.build-and-push.outputs.image-tag }}"
echo ""
echo "To complete the deployment, configure your staging environment to pull the new image."
echo "Image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:staging-latest"

- name: Create deployment summary
run: |
echo "## Staging Deployment Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Commit:** ${{ github.sha }}" >> $GITHUB_STEP_SUMMARY
echo "**Image:** \`${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:staging-latest\`" >> $GITHUB_STEP_SUMMARY
echo "**Digest:** \`${{ needs.build-and-push.outputs.image-digest }}\`" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "The Docker image has been built and pushed to the container registry." >> $GITHUB_STEP_SUMMARY
echo "Configure your staging infrastructure to pull this image for deployment." >> $GITHUB_STEP_SUMMARY
16 changes: 9 additions & 7 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,12 @@ jobs:
- uses: ./.github/actions/cache-db
- name: Run Tests
run: VITEST_MODE=integration yarn test
# TODO: Generate test results so we can upload them
# - name: Upload Test Results
# if: ${{ always() }}
# uses: actions/upload-artifact@v4
# with:
# name: test-results
# path: test-results
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v4
with:
name: integration-test-results
path: |
coverage/
test-results/
retention-days: 14
1 change: 0 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,3 @@ jobs:
- uses: ./.github/actions/yarn-install
- name: Run Lint
run: yarn lint
continue-on-error: true
14 changes: 11 additions & 3 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ jobs:
- uses: ./.github/actions/dangerous-git-checkout
- uses: ./.github/actions/yarn-install
- run: yarn prisma generate
- run: yarn test -- --no-isolate
# We could add different timezones here that we need to run our tests in
- run: TZ=America/Los_Angeles VITEST_MODE=timezone yarn test -- --no-isolate
- name: Run unit tests with coverage
run: yarn test -- --no-isolate --coverage
- name: Run timezone-dependent tests
run: TZ=America/Los_Angeles VITEST_MODE=timezone yarn test -- --no-isolate
- name: Upload coverage reports
if: always()
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage/
retention-days: 14
Loading