Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
rnystrom committed Dec 11, 2024
0 parents commit dae5db8
Show file tree
Hide file tree
Showing 4,809 changed files with 355,347 additions and 0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
18 changes: 18 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.git
**/node_modules
**/dist
**/out
**/.next
**/.turbo
api
elasticsearch
logs
notebooks
ops/aws
script
vendor
.venv
.vercel
.vscode
.github
zapier
8 changes: 8 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# See https://git-scm.com/docs/gitattributes for more about git attribute files.

# Mark any vendored files as having been vendored.
api/vendor/* linguist-vendored
vendor/* linguist-vendored

# Mark the database schema as generated.
packages/types/generated.ts linguist-generated
21 changes: 21 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version: 2
updates:
- package-ecosystem: 'npm'
directory: '/'
versioning-strategy: increase
schedule:
interval: 'weekly'
day: 'monday'
allow:
- dependency-name: '@sentry/*'
- dependency-name: '@tanstack/*'
- dependency-name: 'next'
- dependency-name: 'eslint-config-next'
- dependency-name: '@next/bundle-analyzer'
# This option has no impact on security updates which have a separate internal limit of 10 PRs
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#open-pull-requests-limit
open-pull-requests-limit: 2
commit-message:
# Prefix all commit messages with "chore: "
prefix: 'chore'
include: 'scope'
2 changes: 2 additions & 0 deletions .github/labeler/migrations.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
"Migrations pending":
- "api/db/migrate/**/*"
16 changes: 16 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name-template: "v$RESOLVED_VERSION"
tag-template: "v$RESOLVED_VERSION"

version-resolver:
default: major

template: |
---
title: Changelog title
date: 2023-MM-DD
slug: 2023-MM-DD-changelog-title-slugified
contributors: $CONTRIBUTORS
feature_image: optional
---
$CHANGES
35 changes: 35 additions & 0 deletions .github/set-deploy-refs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env bash

DRY_RUN=${DRY_RUN:-false}

# get description of the latest tag matching the pattern (e.g. "api*")
# then remove the commit hash and number of commits since the tag to get the raw tag name
# works for annotated and lightweight tags
function echo_ref() {

# find the latest commit matching the tag pattern
MATCH=$(git describe --match "$1*" --tags 2>/dev/null)

# if no match, default to the first commit which should guarantee a deploy
if [ -z "$MATCH" ]; then
MATCH=$(git rev-list --max-parents=0 HEAD)
fi

LATEST_TAG=$(echo $MATCH | sed 's/-[0-9]*-g[0-9a-f]\{7,9\}//')
LATEST_REF=$(git rev-list -n 1 $LATEST_TAG)
ECHO_OUTPUT="$1=$LATEST_REF"
if [[ $DRY_RUN == "true" ]]; then
echo $ECHO_OUTPUT
else
echo $ECHO_OUTPUT >> $GITHUB_OUTPUT
fi
}

echo_ref "api"
echo_ref "site"
echo_ref "web"
echo_ref "elasticsearch"
echo_ref "logs"
echo_ref "html-to-image"
echo_ref "sync-server"
echo_ref "styled-text-server"
22 changes: 22 additions & 0 deletions .github/set-git-message
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash

DRY_RUN=${DRY_RUN:-false}

# get the message and trim to the first line
GIT_MESSAGE=$(git log -1 --pretty=%B HEAD | head -n 1)
ECHO_MESSAGE_OUTPUT="git-message=$GIT_MESSAGE"
ESCAPED_GIT_MESSAGE=$(echo "$GIT_MESSAGE" | sed 's/"/\\"/g')
ECHO_ESCAPED_MESSAGE_OUTPUT="escaped-git-message=$ESCAPED_GIT_MESSAGE"

SHA_SHORT=$(git rev-parse --short HEAD)
ECHO_SHA_OUTPUT="git-sha=$SHA_SHORT"

if [[ $DRY_RUN == "true" ]]; then
echo $ECHO_MESSAGE_OUTPUT
echo $ECHO_ESCAPED_MESSAGE_OUTPUT
echo $ECHO_SHA_OUTPUT
else
echo $ECHO_MESSAGE_OUTPUT >> $GITHUB_OUTPUT
echo $ECHO_ESCAPED_MESSAGE_OUTPUT >> $GITHUB_OUTPUT
echo $ECHO_SHA_OUTPUT >> $GITHUB_OUTPUT
fi
21 changes: 21 additions & 0 deletions .github/workflows/api-tests-skip.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: API Tests

on:
pull_request:
# must be in sync with the paths filter in tests.yml
paths-ignore:
- '.github/workflows/api-tests.yml'
- 'api/**'

jobs:
# names must match those in tests.yml
test:
name: tests
runs-on: ubuntu-latest
steps:
- run: 'echo "No build required"'

lint:
runs-on: ubuntu-latest
steps:
- run: 'echo "No build required"'
100 changes: 100 additions & 0 deletions .github/workflows/api-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: API Tests

on:
pull_request:
paths:
- '.github/workflows/api-tests.yml'
- 'api/**'

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
MYSQL_DB: campsite_api_test
MYSQL_USER: root
MYSQL_PASSWORD: root
DATABASE_HOST: 127.0.0.1
RAILS_ENV: test

jobs:
test:
name: tests
runs-on:
labels: warp-ubuntu-latest-x64-8x
timeout-minutes: 10
permissions:
contents: write
pull-requests: read
services:
redis:
image: redis
ports:
- 6379/tcp
options: --entrypoint redis-server
steps:
- name: GitHub App token
id: gen-token
uses: tibdex/[email protected]
with:
app_id: 290357
private_key: ${{ secrets.DEPLOYBOT_TOKEN }}

- uses: actions/checkout@v4
with:
token: ${{ steps.gen-token.outputs.token }}

- name: Cache Ruby gems
uses: actions/cache@v4
with:
path: api/vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Setup MySQL
uses: shogo82148/actions-setup-mysql@v1
with:
mysql-version: '8.0'
root-password: ${{ env.MYSQL_PASSWORD }}
my-cnf: |
authentication_policy=mysql_native_password
- name: Create MySQL database
working-directory: api
run: |
mysql -h 127.0.0.1 -e 'CREATE DATABASE ${{ env.MYSQL_DB }};' -u${{ env.MYSQL_USER }} -p${{ env.MYSQL_PASSWORD }}
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -h 127.0.0.1 -u${{ env.MYSQL_USER }} -p${{ env.MYSQL_PASSWORD }} mysql
mysql -h 127.0.0.1 -u${{ env.MYSQL_USER }} -p${{ env.MYSQL_PASSWORD }} -e 'SELECT COUNT(*) FROM mysql.time_zone_name;'
- name: Setup Rails
uses: ruby/setup-ruby@v1
with:
working-directory: api
bundler-cache: true

# lint and push any fixes before building
- name: Lint Ruby files
working-directory: api
run: bundle exec rubocop --parallel --autocorrect
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: 🤖 linting with autofix
branch: ${{ github.head_ref }}
disable_globbing: true
file_pattern: >
api/**/*.rb api/**/*.erb api/Gemfile :!api/vendor/**/*
- name: Setup Elasticsearch
uses: ankane/setup-elasticsearch@v1

- name: Build and run tests
env:
REDIS_HOST: localhost
REDIS_PORT: ${{ job.services.redis.ports[6379] }}
working-directory: api
run: |
bundle exec rails db:schema:load
bundle exec rails assets:precompile
bundle exec rails test
14 changes: 14 additions & 0 deletions .github/workflows/client-build-skip.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Client Build

on:
pull_request:
paths-ignore:
- '.github/workflows/client-build.yml'
- 'apps/**'
- 'packages/**'

jobs:
client-build:
runs-on: ubuntu-latest
steps:
- run: 'echo "No build required"'
106 changes: 106 additions & 0 deletions .github/workflows/client-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: Client Build

on:
pull_request:
paths:
- '.github/workflows/client-build.yml'
- 'turbo.json'
- 'package.json'
- 'pnpm-lock.yaml'
- 'apps/**'
- 'packages/**'

env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
TIPTAP_PRIVATE_REGISTRY_KEY: ${{ secrets.TIPTAP_PRIVATE_REGISTRY_KEY }}
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
TURBO_REMOTE_ONLY: true
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: campsite-software
SENTRY_PROJECT: campsite-web

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
client-build:
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: write
pull-requests: read
steps:
- name: GitHub App token
id: gen-token
uses: tibdex/[email protected]
with:
app_id: 290357
private_key: ${{ secrets.DEPLOYBOT_TOKEN }}

- uses: actions/checkout@v4
with:
token: ${{ steps.gen-token.outputs.token }}

- uses: dorny/paths-filter@v3
id: changes
with:
filters: |
client-web:
- 'apps/web/**'
- 'packages/**'
figma:
- 'apps/figma/**'
- 'packages/ui/**'
- 'packages/config/**'
- 'packages/types/**'
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Setup pnpm
uses: pnpm/[email protected]

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- run: pnpm config set "@tiptap-pro:registry" https://registry.tiptap.dev/
- run: pnpm config set "//registry.tiptap.dev/:_authToken" ${{ secrets.TIPTAP_PRIVATE_REGISTRY_KEY }}
- run: pnpm install

- run: pnpm format
- run: pnpm lint:fix
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: 🤖 linting with autofix
branch: ${{ github.head_ref }}
- name: Run tests
run: pnpm turbo run test --filter=@campsite/web

- name: Install Vercel CLI
run: pnpm install --global vercel

- name: Vercel Build Web
if: ${{ steps.changes.outputs.client-web == 'true' }}
env:
VERCEL_PROJECT_ID: prj_ecDUhYR4IMEOyMnXJ9YkMgRInMS5
run: |
vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
- name: Figma Build
if: ${{ steps.changes.outputs.figma == 'true' }}
run: |
pnpm build --filter=@campsite/figma
Loading

0 comments on commit dae5db8

Please sign in to comment.