Skip to content
Open
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
Binary file added .DS_Store
Binary file not shown.
52 changes: 52 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# See https://docs.docker.com/engine/reference/builder/#dockerignore-file for more about ignoring files.

# Ignore git directory.
/.git/
/.gitignore

# Ignore bundler config.
/.bundle

# Ignore all environment files.
/.env*

# Ignore all default key files.
/config/master.key
/config/credentials/*.key

# Ignore all logfiles and tempfiles.
/log/*
/tmp/*
!/log/.keep
!/tmp/.keep

# Ignore pidfiles, but keep the directory.
/tmp/pids/*
!/tmp/pids/.keep

# Ignore storage (uploaded files in development and any SQLite databases).
/storage/*
!/storage/.keep
/tmp/storage/*
!/tmp/storage/.keep

# Ignore assets.
/node_modules/
/app/assets/builds/*
!/app/assets/builds/.keep
/public/assets
/public/vite*

# Ignore CI service files.
/.github

# Ignore Kamal files.
/config/deploy*.yml
/.kamal

# Ignore development files
/.devcontainer

# Ignore Docker-related files
/.dockerignore
/Dockerfile*
9 changes: 9 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# See https://git-scm.com/docs/gitattributes for more about git attribute files.

# Mark the database schema as having been generated.
db/schema.rb linguist-generated

# Mark any vendored files as having been vendored.
vendor/* linguist-vendored
config/credentials/*.yml.enc diff=rails_credentials
config/credentials.yml.enc diff=rails_credentials
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: 2
updates:
- package-ecosystem: bundler
directory: "/"
schedule:
interval: weekly
open-pull-requests-limit: 10
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: weekly
open-pull-requests-limit: 10
179 changes: 179 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
name: CI

on:
pull_request:
push:
branches: [main]

permissions:
contents: read

env:
RUBY_VERSION: 4.0.6
NODE_VERSION: 24.x

jobs:
quality:
name: Ruby and frontend quality
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v5

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ env.RUBY_VERSION }}
bundler-cache: true

- name: Set up Node
uses: actions/setup-node@v5
with:
node-version: ${{ env.NODE_VERSION }}
cache: npm

- name: Install frontend dependencies
run: npm ci

- name: Ruby style
run: bundle exec rubocop --format github

- name: Brakeman
run: bundle exec brakeman --no-pager --exit-on-warn --exit-on-error

- name: Bundler audit
run: bundle exec bundler-audit check --update

- name: Typecheck, lint and format check
run: |
npm run check
npm run lint
npm run format:check

backend:
name: Rails tests
runs-on: ubuntu-latest
services:
postgres:
image: postgres:17
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: user_management_test
ports:
- 5432:5432
options: >-
--health-cmd="pg_isready -U postgres -d user_management_test"
--health-interval=5s
--health-timeout=5s
--health-retries=12
env:
RAILS_ENV: test
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/user_management_test
PARALLEL_WORKERS: 4
PARALLEL_EXECUTOR: processes
COVERAGE: true
steps:
- name: Check out
uses: actions/checkout@v5

- name: Install native dependencies
run: sudo apt-get update && sudo apt-get install --no-install-recommends -y libpq-dev libvips

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ env.RUBY_VERSION }}
bundler-cache: true

- name: Prepare database
run: bin/rails db:prepare

- name: Run unit and integration tests
run: bin/rails test

frontend:
name: React tests and production build
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v5

- name: Set up Node
uses: actions/setup-node@v5
with:
node-version: ${{ env.NODE_VERSION }}
cache: npm

- name: Install dependencies
run: npm ci

- name: Run Jest with coverage
run: npm run test:ci

- name: Build Vite assets
run: npm run build

system:
name: Browser system tests
runs-on: ubuntu-latest
services:
postgres:
image: postgres:17
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: user_management_test
ports:
- 5432:5432
options: >-
--health-cmd="pg_isready -U postgres -d user_management_test"
--health-interval=5s
--health-timeout=5s
--health-retries=12
env:
RAILS_ENV: test
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/user_management_test
PARALLEL_WORKERS: 2
PARALLEL_EXECUTOR: processes
VITE_RUBY_AUTO_BUILD: "false"
steps:
- name: Check out
uses: actions/checkout@v5

- name: Install native dependencies
run: sudo apt-get update && sudo apt-get install --no-install-recommends -y libpq-dev libvips

- name: Set up Chrome
uses: browser-actions/setup-chrome@v1

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ env.RUBY_VERSION }}
bundler-cache: true

- name: Set up Node
uses: actions/setup-node@v5
with:
node-version: ${{ env.NODE_VERSION }}
cache: npm

- name: Install frontend dependencies
run: npm ci

- name: Prepare database and test assets
run: |
bin/rails db:prepare
bin/vite build --mode test

- name: Run browser tests
run: bin/rails test:system

- name: Upload screenshots when a system test fails
if: failure()
uses: actions/upload-artifact@v4
with:
name: system-test-screenshots
path: tmp/screenshots
if-no-files-found: ignore
47 changes: 47 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
#
# Temporary files generated by your text editor or operating system
# belong in git's global ignore instead:
# `$XDG_CONFIG_HOME/git/ignore` or `~/.config/git/ignore`

# Ignore bundler config.
/.bundle

# Ignore all environment files.
/.env*

# Ignore all logfiles and tempfiles.
/log/*
/tmp/*
!/log/.keep
!/tmp/.keep

# Ignore pidfiles, but keep the directory.
/tmp/pids/*
!/tmp/pids/
!/tmp/pids/.keep

# Ignore storage (uploaded files in development and any SQLite databases).
/storage/*
!/storage/.keep
/tmp/storage/*
!/tmp/storage/
!/tmp/storage/.keep

/public/assets
/coverage/

# Ignore key files for decrypting credentials and more.
/config/*.key


# Vite Ruby
/public/vite*
node_modules
# Vite uses dotenv and suggests to ignore local-only env files. See
# https://vitejs.dev/guide/env-and-mode.html#env-files
*.local

# Kamal secrets are loaded from the local machine and must never be committed.
/.kamal/secrets
/.kamal/secrets-*
12 changes: 12 additions & 0 deletions .kamal/secrets.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
WEB_HOST=203.0.113.10
DB_HOST=203.0.113.10
APP_HOST=people.example.com
KAMAL_REGISTRY_USERNAME=your-ghcr-user
KAMAL_REGISTRY_PASSWORD=replace-me
RAILS_MASTER_KEY=replace-me
DATABASE_URL=postgresql://user_management:replace-me@peoplehub-postgres:5432/user_management_production
POSTGRES_PASSWORD=replace-me
AWS_ACCESS_KEY_ID=replace-me
AWS_SECRET_ACCESS_KEY=replace-me
AWS_REGION=us-east-1
AWS_BUCKET=peoplehub-production
5 changes: 5 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"semi": false,
"singleQuote": true,
"trailingComma": "all"
}
8 changes: 8 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Omakase Ruby styling for Rails
inherit_gem: { rubocop-rails-omakase: rubocop.yml }

# Overwrite or add rules to create your own house style
#
# # Use `[a, [b, c]]` not `[ a, [ b, c ] ]`
# Layout/SpaceInsideArrayLiteralBrackets:
# Enabled: false
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ruby-4.0.6
Loading