Skip to content
Merged
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
82 changes: 82 additions & 0 deletions .github/workflows/generators.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Test Generators

on:
push:
branches:
- master
paths:
- 'lib/generators/**'
- '.github/workflows/generators.yml'
- 'lib/inertia_rails/generators/**'
pull_request:
paths:
- 'lib/generators/**'
- '.github/workflows/generators.yml'
- 'lib/inertia_rails/generators/**'

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
framework: [react, vue, svelte, svelte4]
typescript: [true, false]
tailwind: [true, false]
ruby: ['3.3']
node: ['22']
inertia_version: ['1.2.0', 'next', 'beta']
exclude:
# 1.2.0 does not support typescript
- typescript: true
inertia_version: '1.2.0'
# 1.2.0 doesn't support Svelte 5
- framework: svelte
inertia_version: '1.2.0'

name: ${{ matrix.framework }} (TS:${{ matrix.typescript }}, TW:${{ matrix.tailwind }}, Inertia:${{ matrix.inertia_version }})

steps:
- uses: actions/checkout@v4

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

- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}

- name: Cache dependencies
uses: actions/cache@v3
with:
path: |
tmp/bundle_cache
tmp/npm_cache
~/.npm
key: ${{ runner.os }}-deps-${{ matrix.framework }}-${{ matrix.inertia_version }}-${{ hashFiles('**/Gemfile.lock') }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-deps-${{ matrix.framework }}-
${{ runner.os }}-deps-

- name: Install Rails
run: gem install rails

- name: Run test script
run: |
ts_flag=${{ matrix.typescript && '--typescript' || '--no-typescript' }}
tw_flag=${{ matrix.tailwind && '--tailwind' || '--no-tailwind' }}
bin/generate_scaffold_example --framework=${{ matrix.framework }} --inertia-version=${{ matrix.inertia_version }} $ts_flag $tw_flag

- name: Upload test artifacts
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-output-${{ matrix.framework }}-ts${{ matrix.typescript }}-tw${{ matrix.tailwind }}-v${{ matrix.inertia_version }}
path: |
tmp/scaffold_example/log
tmp/scaffold_example/tmp/screenshots
if-no-files-found: ignore
21 changes: 20 additions & 1 deletion .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,20 @@ on:
- '**.md'

jobs:
lint:
runs-on: ubuntu-latest
name: Linter
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.3"
bundler: latest
bundler-cache: true
- name: Run RuboCop
run: bundle exec rubocop

test:
strategy:
fail-fast: false
Expand All @@ -31,6 +45,11 @@ jobs:
- name: Setup System
run: sudo apt-get install libsqlite3-dev

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22.x

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
Expand All @@ -40,6 +59,6 @@ jobs:
RAILS_VERSION: ${{ matrix.rails }}

- name: Run tests
run: bundle exec rake
run: bundle exec rspec
env:
RAILS_VERSION: ${{ matrix.rails }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
/pkg/
/spec/reports/
/tmp/
/.cache/
/Gemfile.lock

/spec/dummy/db/*.sqlite3
Expand Down
15 changes: 15 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
inherit_from: .rubocop_todo.yml

AllCops:
TargetRubyVersion: 3.0
NewCops: enable
SuggestExtensions: false

Metrics:
Enabled: false

Style/Documentation:
Enabled: false

Style/TrailingCommaInHashLiteral:
EnforcedStyleForMultiline: consistent_comma
Loading
Loading