Skip to content

Commit 4cf412d

Browse files
committed
Merge pull request #2 from mkyed/feature/upgrade-ruby-maglev-3-and-add-ci-tests
Upgrade Ruby to 4.0.3, MaglevCMS to 3.0.1, add CI flavor tests
2 parents 84e4ae5 + 519ebf8 commit 4cf412d

6 files changed

Lines changed: 140 additions & 10 deletions

File tree

.github/workflows/test.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Flavor Tests
2+
3+
on:
4+
push:
5+
branches: [main, master]
6+
pull_request:
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
timeout-minutes: 15
12+
strategy:
13+
matrix:
14+
flavor: [vanilla, maglev]
15+
fail-fast: false
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Build ${{ matrix.flavor }} image
21+
run: docker compose build
22+
env:
23+
JR8_FLAVOR: ${{ matrix.flavor }}
24+
25+
- name: Start ${{ matrix.flavor }} app
26+
run: docker compose up -d
27+
env:
28+
JR8_FLAVOR: ${{ matrix.flavor }}
29+
30+
- name: Wait for app to be available (up to 8 min)
31+
timeout-minutes: 8
32+
run: |
33+
until curl -sf http://localhost:3008 -o /dev/null; do
34+
sleep 5
35+
done
36+
37+
- name: Root page returns HTTP 200
38+
run: |
39+
STATUS=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:3008)
40+
echo "HTTP status: $STATUS"
41+
[ "$STATUS" = "200" ]
42+
43+
- name: Maglev editor is accessible
44+
if: matrix.flavor == 'maglev'
45+
run: |
46+
STATUS=$(curl -s -o /dev/null -w "%{http_code}" -L http://localhost:3008/maglev)
47+
echo "Maglev editor HTTP status: $STATUS"
48+
[ "$STATUS" = "200" ] || [ "$STATUS" = "302" ]
49+
50+
- name: Show logs on failure
51+
if: failure()
52+
run: docker compose logs
53+
54+
- name: Stop containers
55+
if: always()
56+
run: docker compose down -v

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Changed
11+
12+
- Updated Ruby image to 4.0.3 (pinned patch version)
13+
- Updated MaglevCMS to 3.0.1 (major version — new `maglev:publish_site` step required)
14+
- Dropped sed workaround for `maglev_client_javascript_tags` (now the canonical helper in 3.x)
15+
16+
### Added
17+
18+
- GitHub Actions CI workflow testing both flavors from scratch to browsable website
19+
- Local `just-rails-8/test.sh` for end-to-end flavor testing
20+
1021
## [2.2.0] - 2026-03-24
1122

1223
### Security

CLAUDE.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,10 @@ docker compose exec web bundle install
9494

9595
## Important Notes
9696

97-
- **MaglevCMS Version**: Uses version 2.1.0 (latest stable) with official SQLite3 support
98-
- **MaglevCMS HyperUI Kit**: Updated to 2.0 with vite_ruby pinned to ~> 3.9.0 (3.10.0 has compatibility check that rejects vite-plugin-ruby ^5.1.0)
97+
- **MaglevCMS Version**: Uses version 3.0.1 (latest stable) with official SQLite3 support
98+
- **MaglevCMS HyperUI Kit**: Uses 2.0.0 (compatible with MaglevCMS 3.x)
9999
- **Rails Version**: Pinned to ~> 8.1.3
100-
- **Database Compatibility**: MaglevCMS 2.1.0 officially supports SQLite3 as an alternative to PostgreSQL
100+
- **Database Compatibility**: MaglevCMS 3.0.x supports SQLite3 as an alternative to PostgreSQL
101101
- **Volume Management**: When switching between flavors, clean the environment with `reset.sh` to avoid gem conflicts
102102
- **Generated Files**: The Rails app is generated in the project root and persisted via volume mounts
103103
- **Reset Script**: Use `--clean-untracked` flag to remove all untracked files including Rails residue

just-rails-8/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ruby:4.0-slim
1+
FROM ruby:4.0.3-slim
22

33
# Install system dependencies for Rails
44
ENV DEBIAN_FRONTEND=noninteractive

just-rails-8/setup.sh

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ maglev() {
2323

2424
rails new . --database=sqlite3 --skip-action-cable --force
2525

26-
bundle add maglevcms -v '~> 2.1.0'
26+
bundle add maglevcms -v '~> 3.0.0'
2727
bundle add maglevcms-hyperui-kit -v '~> 2.0.0'
2828
bundle install
2929

@@ -33,12 +33,8 @@ maglev() {
3333
bundle exec rails g maglev:install
3434
bundle exec rails g maglev:hyperui:install --force
3535

36-
# HyperUI Kit 2.0 generates maglev_client_javascript_tags which doesn't
37-
# exist in MaglevCMS 2.1.0. Replace with the correct helper.
38-
sed -i 's/maglev_client_javascript_tags/maglev_live_preview_client_javascript_tag/' \
39-
app/views/theme/layout.html.erb
40-
4136
bundle exec rails maglev:create_site
37+
bundle exec rails maglev:publish_site
4238
}
4339

4440

just-rails-8/test.sh

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#!/bin/bash
2+
#
3+
# End-to-end test for both JustRails8 flavors.
4+
# Builds from scratch and verifies each flavor serves a browsable website.
5+
#
6+
# Usage:
7+
# ./just-rails-8/test.sh # test both flavors
8+
# ./just-rails-8/test.sh vanilla # test vanilla only
9+
# ./just-rails-8/test.sh maglev # test maglev only
10+
#
11+
12+
set -euo pipefail
13+
14+
FLAVORS="${*:-vanilla maglev}"
15+
TIMEOUT=480 # 8 minutes for initial build + boot
16+
17+
pass() { echo "$1"; }
18+
fail() { echo "$1"; docker compose logs; exit 1; }
19+
20+
wait_for_http() {
21+
local deadline=$((SECONDS + TIMEOUT))
22+
while [ $SECONDS -lt $deadline ]; do
23+
if curl -sf http://localhost:3008 -o /dev/null 2>/dev/null; then
24+
return 0
25+
fi
26+
sleep 5
27+
done
28+
return 1
29+
}
30+
31+
test_flavor() {
32+
local flavor=$1
33+
echo ""
34+
echo "=== Testing $flavor flavor ==="
35+
36+
./just-rails-8/reset.sh --clean-untracked
37+
38+
JR8_FLAVOR=$flavor docker compose up -d
39+
40+
echo " Waiting for app (up to ${TIMEOUT}s)..."
41+
if wait_for_http; then
42+
pass "localhost:3008 is up"
43+
else
44+
fail "app never became available after ${TIMEOUT}s"
45+
fi
46+
47+
STATUS=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:3008)
48+
[ "$STATUS" = "200" ] && pass "root page returns HTTP 200" || fail "root page returned HTTP $STATUS"
49+
50+
if [ "$flavor" = "maglev" ]; then
51+
STATUS=$(curl -s -o /dev/null -w "%{http_code}" -L http://localhost:3008/maglev)
52+
{ [ "$STATUS" = "200" ] || [ "$STATUS" = "302" ]; } \
53+
&& pass "Maglev editor accessible (HTTP $STATUS)" \
54+
|| fail "Maglev editor returned HTTP $STATUS"
55+
fi
56+
57+
docker compose down -v
58+
./just-rails-8/reset.sh --clean-untracked
59+
echo "=== $flavor: PASS ==="
60+
}
61+
62+
for flavor in $FLAVORS; do
63+
test_flavor "$flavor"
64+
done
65+
66+
echo ""
67+
echo "All flavor tests passed."

0 commit comments

Comments
 (0)