Skip to content

Commit 1d3fd31

Browse files
authored
Merge branch 'main' into codex/fix-typo-in-public_activity-initializer
2 parents a559c04 + 6ac0f4e commit 1d3fd31

File tree

155 files changed

+1847
-365
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

155 files changed

+1847
-365
lines changed

.github/workflows/rubyonrails.yml

Lines changed: 86 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,109 @@
1-
# This workflow uses actions that are not certified by GitHub. They are
2-
# provided by a third-party and are governed by separate terms of service,
3-
# privacy policy, and support documentation.
4-
#
5-
# This workflow will install a prebuilt Ruby version, install dependencies, and
6-
# run tests and linters.
71
name: "Ruby on Rails CI"
8-
on:
9-
push:
10-
branches: [ "main", "dev" ]
11-
pull_request:
12-
branches: [ "main", "dev" ]
2+
3+
on: { push: { branches: [main, dev] }, pull_request: { branches: [main, dev] } }
4+
135
jobs:
146
rspec:
157
runs-on: ubuntu-latest
8+
environment: test
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
include:
13+
- ruby: '3.4.4'
14+
rails: '7.1.5.1'
15+
allowed_failure: false # ✅ required
16+
- ruby: '3.4.4'
17+
rails: '7.2'
18+
allowed_failure: true # ⚠️ allowed to fail
19+
- ruby: '3.4.4'
20+
rails: '8.0'
21+
allowed_failure: true # ⚠️ allowed to fail
22+
23+
env:
24+
RAILS_ENV: test
25+
DATABASE_URL: "postgis://rails:password@localhost:5432/rails_test"
26+
ES_HOST: "http://localhost"
27+
RAILS_VERSION: ${{ matrix.rails }}
28+
1629
services:
1730
postgres:
1831
image: postgis/postgis:latest
19-
ports:
20-
- "5432:5432"
21-
env:
22-
POSTGRES_DB: rails_test
23-
POSTGRES_USER: rails
24-
POSTGRES_PASSWORD: password
32+
ports: ["5432:5432"]
33+
env: { POSTGRES_DB: rails_test, POSTGRES_USER: rails, POSTGRES_PASSWORD: password }
2534
elasticsearch:
2635
image: elasticsearch:7.17.23
27-
ports:
28-
- "9200:9200"
36+
ports: ["9200:9200"]
2937
env:
30-
"node.name": elasticsearch
31-
"cluster.name": better-together-es
32-
"discovery.seed_hosts": elasticsearch
33-
"discovery.type": single-node
34-
"bootstrap.memory_lock": true
35-
"ES_JAVA_OPTS": "-Xms512m -Xmx512m"
36-
env:
37-
RAILS_ENV: test
38-
DATABASE_URL: "postgis://rails:password@localhost:5432/rails_test"
39-
ES_HOST: "http://localhost"
38+
node.name: elasticsearch
39+
cluster.name: better-together-es
40+
discovery.seed_hosts: elasticsearch
41+
discovery.type: single-node
42+
bootstrap.memory_lock: "true"
43+
ES_JAVA_OPTS: "-Xms512m -Xmx512m"
44+
4045
steps:
4146
- name: Checkout code
4247
uses: actions/checkout@v3
43-
# Add or replace dependency steps here
44-
- name: Install Ruby and gems
48+
49+
- name: Install Ruby & gems
4550
uses: ruby/setup-ruby@v1
4651
with:
47-
bundler-cache: true
48-
# Add or replace database setup steps here
49-
- name: Set up database schema
50-
run: rm -f spec/dummy/tmp/pids/server.pid && cd ./spec/dummy && bundle exec rails db:schema:load
51-
# Add or replace test runners here
52-
- name: Run tests
53-
run: rm -f spec/dummy/tmp/pids/server.pid && bundle exec rspec
52+
ruby-version: ${{ matrix.ruby }}
53+
54+
# Run the automatic bundle-install only on 7.1.
55+
# For 7.2 / 8.0 it just sets up Ruby *and* restores a cache layer
56+
# that we’ll reuse in the later manual install.
57+
bundler-cache: ${{ matrix.rails == '7.1.5.1' }}
5458

59+
# One cache bucket per Rails version so they don’t clobber each other.
60+
cache-version: rails-${{ matrix.rails }}
61+
62+
# Updating Rails can legitimately blow up on the experimental tracks,
63+
# so we allow that *step* to error out without failing the job.
64+
- name: Update Rails & install gems
65+
if: matrix.rails != '7.1.5.1'
66+
id: update
67+
run: |
68+
# turn off deployment mode
69+
bundle config set deployment false
70+
# conservative upgrade to the target rails version
71+
bundle update rails --conservative
72+
# install missing gems (writes bin/rspec, etc)
73+
bundle install --jobs 4 --retry 3
74+
continue-on-error: ${{ matrix.allowed_failure }}
75+
76+
- name: Prepare DB schema
77+
if: (matrix.rails == '7.1.5.1') || steps.update.outcome == 'success'
78+
run: |
79+
rm -f spec/dummy/tmp/pids/server.pid
80+
bundle exec rake -f spec/dummy/Rakefile db:schema:load
81+
continue-on-error: ${{ matrix.allowed_failure }}
82+
83+
- name: Run RSpec
84+
if: (matrix.rails == '7.1.5.1') || steps.update.outcome == 'success'
85+
env:
86+
RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }}
87+
run: |
88+
rm -f spec/dummy/tmp/pids/server.pid
89+
bundle exec rspec
90+
continue-on-error: ${{ matrix.allowed_failure }}
91+
92+
# ── style & security jobs (unchanged) ───────────────────────────────────────
5593
rubocop:
5694
runs-on: ubuntu-latest
5795
steps:
58-
- name: Checkout code
59-
uses: actions/checkout@v3
60-
- name: Install Ruby and gems
61-
uses: ruby/setup-ruby@v1
62-
with:
63-
bundler-cache: true
64-
- name: Lint Ruby files with Rubocop
65-
run: bundle exec rubocop --parallel
96+
- uses: actions/checkout@v3
97+
- uses: ruby/setup-ruby@v1
98+
with: { bundler-cache: true }
99+
- run: bundle exec rubocop --parallel
66100

67101
security:
68102
runs-on: ubuntu-latest
69103
steps:
70-
- name: Checkout code
71-
uses: actions/checkout@v3
72-
- name: Install Ruby and gems
73-
uses: ruby/setup-ruby@v1
74-
with:
75-
bundler-cache: true
76-
- name: Generate binstubs
77-
run: bundle binstubs bundler-audit --force
78-
- name: Security audit dependencies
79-
run: bundle exec bundler-audit --update
80-
- name: Security audit application code
81-
run: bundle exec brakeman -q -w2
104+
- uses: actions/checkout@v3
105+
- uses: ruby/setup-ruby@v1
106+
with: { bundler-cache: true }
107+
- run: bundle binstubs bundler-audit --force
108+
- run: bundle exec bundler-audit --update
109+
- run: bundle exec brakeman -q -w2

.ruby-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.2.2
1+
3.4.4

AGENTS.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# AGENTS.md
2+
3+
## Project
4+
- Ruby: 3.4.4 (installed via rbenv in setup)
5+
- Rails: 7.1
6+
- Node: 20
7+
- DB: PostgreSQL + PostGIS
8+
- Search: Elasticsearch 7.17.23
9+
- Test app: `spec/dummy`
10+
11+
## Setup
12+
- Environment runs a setup script that installs Ruby 3.4.4, Node 20, Postgres + PostGIS, and ES7, then prepares databases.
13+
- Databases:
14+
- development: `community_engine_development`
15+
- test: `community_engine_test`
16+
- Use `DATABASE_URL` to connect (overrides fallback host in database.yml).
17+
18+
## Commands
19+
- Run tests: `bin/ci`
20+
(Equivalent: `cd spec/dummy && bundle exec rspec`)
21+
- Lint: `bundle exec rubocop`
22+
- Security: `bundle exec brakeman -q -w2` and `bundle exec bundler-audit --update`
23+
24+
## Conventions
25+
- Make incremental changes with passing tests.
26+
- Avoid introducing new external services in tests; stub where possible.
27+
28+
## Code Style
29+
- Always run `bin/codex_style_guard` before proposing a patch.
30+
- If RuboCop reports offenses after autocorrect, update the changes until it passes.

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# When pushed to dokku via git, it detects this Dockerfile and automatically chooses Docker build
33

44
# Stage 1: Build environment
5-
FROM ruby:3.2.2 AS builder
5+
FROM ruby:3.4.4 AS builder
66

77
# Define build-time variables
88
ARG AWS_ACCESS_KEY_ID
@@ -56,7 +56,7 @@ RUN bundle exec rake app:assets:precompile
5656
RUN bundle exec rake app:assets:sync
5757

5858
# Stage 2: Runtime environment
59-
FROM ruby:3.2.2
59+
FROM ruby:3.4.4
6060

6161
# Install runtime dependencies
6262
RUN apt-get update -qq \

Dockerfile.dev

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This Dockerfile is used for the development environment via `docker compose`
22

3-
FROM ruby:3.2.2
3+
FROM ruby:3.4.4
44

55
# Add system dependencies needed for building gems, running JS, and running Chrome Headless
66
RUN apt-get update -qq \

Gemfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
source 'https://rubygems.org'
44
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
55

6-
ruby '3.2.2'
6+
ruby '3.4.4'
77

88
gemspec
99

@@ -27,7 +27,7 @@ gem 'pundit-resources', '~> 1.1.4', github: 'better-together-org/pundit-resource
2727

2828
# Core Rails gem
2929
gem 'rack-protection'
30-
gem 'rails', '~> 7.1.3'
30+
gem 'rails', ENV.fetch('RAILS_VERSION', '7.1.5.1')
3131

3232
# Redis for ActionCable and background jobs
3333
gem 'redis', '~> 5.4'

0 commit comments

Comments
 (0)