Skip to content

Commit

Permalink
ruby3.x-rails-8.0: new packages (#39902)
Browse files Browse the repository at this point in the history
<!---
Provide a short summary in the Title above. Examples of good PR titles:
* "ruby-3.1: new package"
* "haproxy: fix CVE-2014-123456"
-->

<!--
Please include references to any related issues or delete this section
otherwise.
 -->

Creates Ruby on Rails package for Ruby 3.4, 3.3, and 3.2

Related: chainguard-dev/image-requests#5160
EOL: https://endoflife.date/rails

### Pre-review Checklist

<!--
This checklist is mostly useful as a reminder of small things that can
easily be
forgotten – it is meant as a helpful tool rather than hoops to jump
through.

At the moment of this PR you have the most information on what all the
change
will affect, so please take the time to jot it down.

Put an `x` in all the items that apply, make notes next to any that
haven't been
addressed, and remove any items that are not relevant to this PR.

-->

#### For new package PRs only
<!-- remove if unrelated -->
- [ ] This PR is marked as fixing a pre-existing package request bug
- [ ] Alternatively, the PR is marked as related to a pre-existing
package request bug, such as a dependency
- [x] REQUIRED - The package is available under an OSI-approved or
FSF-approved license
- [x] REQUIRED - The version of the package is still receiving security
updates
- [x] This PR links to the upstream project's support policy (e.g.
`endoflife.date`)

---------

Signed-off-by: Michael Paul <31833332+MickeyPvX@users.noreply.github.com>
  • Loading branch information
MickeyPvX authored Jan 21, 2025
1 parent 9f6b8d9 commit bafb1a8
Show file tree
Hide file tree
Showing 3 changed files with 471 additions and 0 deletions.
157 changes: 157 additions & 0 deletions ruby3.2-rails-8.0.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
package:
name: ruby3.2-rails-8.0
version: 8.0.1
epoch: 0
description: Rails is a web-application framework that includes everything needed to create database-backed web applications according to the Model-View-Controller (MVC) pattern.
copyright:
- license: MIT
dependencies:
provides:
- ruby${{vars.rubyMM}}-rails=${{package.full-version}}
runtime:
- gcc
- git
- glibc-dev
- make
- ruby${{vars.rubyMM}}-bundler
- ruby-${{vars.rubyMM}}-dev
- tzdata

environment:
contents:
packages:
- gcc
- glibc-dev
- make
- ruby-${{vars.rubyMM}}
- ruby-${{vars.rubyMM}}-dev
- yaml-dev

vars:
gem: rails

pipeline:
- uses: git-checkout
with:
expected-commit: cf6ff17e9a3c6c1139040b519a341f55f0be16cf
repository: https://github.com/rails/rails
tag: v${{package.version}}

- uses: ruby/build
with:
gem: ${{vars.gem}}

- name: Custom install
runs: |
mkdir -p ${{targets.contextdir}}/usr/bin
gem install ${{vars.gem}}-${{package.version}}.gem \
--bindir /tmp/bin/ \
--install-dir ${{targets.contextdir}}/usr/share/ruby/gems/${{vars.rubyMM}}.0/ \
--no-document \
--verbose \
--version ${{package.version}}
mv /tmp/bin/rails ${{targets.contextdir}}/usr/bin/
- uses: ruby/clean

test:
environment:
environment:
GEM_PATH: /usr/lib/ruby/gems/${{rubyMM}}.0/:/usr/share/ruby/gems/${{vars.rubyMM}}.0/
pipeline:
- name: Test installation
runs: rails --version
- name: Test new app creation / run server
uses: test/daemon-check-output
with:
setup: rails new test-app
start: test-app/bin/rails server
expected_output: |
Booting Puma
Rails ${{package.version}} application starting in development
Puma starting in single mode
Listening on http://127.0.0.1:3000
error_strings: |
"msg":"error"
"level":"error"
"panic"
"fatal"
failed
Error:
error:
denied
- name: Test basic rails commands
runs: |
rails new test-app
cd test-app
# Test creating a database model
bin/rails generate model Product name:string
ls db/migrate | grep create_products.rb
ls app/models | grep product.rb
ls test/models | grep product_test.rb
ls test/fixtures | grep products.yml
# Test a db migration
bin/rails db:migrate
# Test creating a controller
bin/rails generate controller Products index
ls app/controllers | grep products_controller.rb
ls app/views/products | grep index.html.erb
ls test/controllers | grep products_controller_test.rb
ls app/helpers | grep products_helper.rb
# Test running generated tests
bin/rails test
# Test the rails console startup
bin/rails console
# Test routes
bin/rails routes
# Test creating authentication
bin/rails generate authentication
ls db/migrate | grep create_users.rb
ls db/migrate | grep create_sessions.rb
ls test/models | grep user_test.rb
ls test/fixtures | grep users.yml
bin/rails db:migrate # should create the users and sessions tables
# Test enabling caching in dev
bin/rails dev:cache | grep "caching enabled for development mode."
# Test installing action text
bin/rails action_text:install
ls app/assets/stylesheets | grep actiontext.css
ls app/views/layouts/action_text/contents | grep content.html.erb
ls test/fixtures/action_text | grep rich_texts.yml
# Test completing action text installation
bundle install
bin/rails db:migrate # should create the action text and active storage tables
# Test built-in linter rubocop
bin/rubocop | grep "no offenses detected"
# Test built-in security scanner brakeman
bin/brakeman | grep "No warnings found"
update:
enabled: true
ignore-regex-patterns:
- 'rc\d+$'
github:
identifier: rails/rails
strip-prefix: v
tag-filter: v8.0.
use-tag: true

var-transforms:
- from: ${{package.name}}
match: ^ruby(\d\.\d+)-.*
replace: $1
to: rubyMM
157 changes: 157 additions & 0 deletions ruby3.3-rails-8.0.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
package:
name: ruby3.3-rails-8.0
version: 8.0.1
epoch: 0
description: Rails is a web-application framework that includes everything needed to create database-backed web applications according to the Model-View-Controller (MVC) pattern.
copyright:
- license: MIT
dependencies:
provides:
- ruby${{vars.rubyMM}}-rails=${{package.full-version}}
runtime:
- gcc
- git
- glibc-dev
- make
- ruby${{vars.rubyMM}}-bundler
- ruby-${{vars.rubyMM}}-dev
- tzdata

environment:
contents:
packages:
- gcc
- glibc-dev
- make
- ruby-${{vars.rubyMM}}
- ruby-${{vars.rubyMM}}-dev
- yaml-dev

vars:
gem: rails

pipeline:
- uses: git-checkout
with:
expected-commit: cf6ff17e9a3c6c1139040b519a341f55f0be16cf
repository: https://github.com/rails/rails
tag: v${{package.version}}

- uses: ruby/build
with:
gem: ${{vars.gem}}

- name: Custom install
runs: |
mkdir -p ${{targets.contextdir}}/usr/bin
gem install ${{vars.gem}}-${{package.version}}.gem \
--bindir /tmp/bin/ \
--install-dir ${{targets.contextdir}}/usr/share/ruby/gems/${{vars.rubyMM}}.0/ \
--no-document \
--verbose \
--version ${{package.version}}
mv /tmp/bin/rails ${{targets.contextdir}}/usr/bin/
- uses: ruby/clean

test:
environment:
environment:
GEM_PATH: /usr/lib/ruby/gems/${{rubyMM}}.0/:/usr/share/ruby/gems/${{vars.rubyMM}}.0/
pipeline:
- name: Test installation
runs: rails --version
- name: Test new app creation / run server
uses: test/daemon-check-output
with:
setup: rails new test-app
start: test-app/bin/rails server
expected_output: |
Booting Puma
Rails ${{package.version}} application starting in development
Puma starting in single mode
Listening on http://127.0.0.1:3000
error_strings: |
"msg":"error"
"level":"error"
"panic"
"fatal"
failed
Error:
error:
denied
- name: Test basic rails commands
runs: |
rails new test-app
cd test-app
# Test creating a database model
bin/rails generate model Product name:string
ls db/migrate | grep create_products.rb
ls app/models | grep product.rb
ls test/models | grep product_test.rb
ls test/fixtures | grep products.yml
# Test a db migration
bin/rails db:migrate
# Test creating a controller
bin/rails generate controller Products index
ls app/controllers | grep products_controller.rb
ls app/views/products | grep index.html.erb
ls test/controllers | grep products_controller_test.rb
ls app/helpers | grep products_helper.rb
# Test running generated tests
bin/rails test
# Test the rails console startup
bin/rails console
# Test routes
bin/rails routes
# Test creating authentication
bin/rails generate authentication
ls db/migrate | grep create_users.rb
ls db/migrate | grep create_sessions.rb
ls test/models | grep user_test.rb
ls test/fixtures | grep users.yml
bin/rails db:migrate # should create the users and sessions tables
# Test enabling caching in dev
bin/rails dev:cache | grep "caching enabled for development mode."
# Test installing action text
bin/rails action_text:install
ls app/assets/stylesheets | grep actiontext.css
ls app/views/layouts/action_text/contents | grep content.html.erb
ls test/fixtures/action_text | grep rich_texts.yml
# Test completing action text installation
bundle install
bin/rails db:migrate # should create the action text and active storage tables
# Test built-in linter rubocop
bin/rubocop | grep "no offenses detected"
# Test built-in security scanner brakeman
bin/brakeman | grep "No warnings found"
update:
enabled: true
ignore-regex-patterns:
- 'rc\d+$'
github:
identifier: rails/rails
strip-prefix: v
tag-filter: v8.0.
use-tag: true

var-transforms:
- from: ${{package.name}}
match: ^ruby(\d\.\d+)-.*
replace: $1
to: rubyMM
Loading

0 comments on commit bafb1a8

Please sign in to comment.