Skip to content

Commit

Permalink
Upgraded to Rails 8, Ruby 3.4.1 and tailwindcss v4
Browse files Browse the repository at this point in the history
  • Loading branch information
yatish27 committed Jan 26, 2025
1 parent 5c98978 commit 4d770b0
Show file tree
Hide file tree
Showing 146 changed files with 2,780 additions and 5,218 deletions.
12 changes: 6 additions & 6 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
# Ignore bundler config.
/.bundle

# Ignore all environment files (except templates).
# Ignore all environment files.
/.env*
!/.env*.erb

# Ignore all default key files.
/config/master.key
Expand All @@ -32,20 +31,21 @@
!/tmp/storage/.keep

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

# Ignore CI service files.
/.github

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

# Ignore development files
/.devcontainer

# Ignore Docker-related files
/.dockerignore
/Dockerfile*

/Brewfile
/Brewfile.lock.json
14 changes: 0 additions & 14 deletions .editorconfig

This file was deleted.

10 changes: 0 additions & 10 deletions .env.sample

This file was deleted.

9 changes: 0 additions & 9 deletions .erb-lint.yml

This file was deleted.

9 changes: 0 additions & 9 deletions .gitattributes

This file was deleted.

14 changes: 0 additions & 14 deletions .github/PULL_REQUEST_TEMPLATE.md

This file was deleted.

17 changes: 10 additions & 7 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: monthly
time: "06:00"
timezone: America/Los_Angeles
open-pull-requests-limit: 10
- package-ecosystem: bundler
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
153 changes: 66 additions & 87 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,106 +1,85 @@
name: CI

on:
pull_request:
push:
branches:
- main
env:
RAILS_ENV: test
branches: [ main ]

jobs:
test:
name: "Test"
runs-on: ubuntu-latest
env:
DATABASE_URL: postgres://postgres:postgres@localhost:5432/ci
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_DB: ci
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- uses: oven-sh/setup-bun@v2
with:
bun-version: 1.1.8
- run: bun install
- run: bundle exec rake db:migrate
- run: bundle exec rake test:all
rubocop:
name: "Lint / rubocop"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- run: bin/rubocop
brakeman:
name: "Security / brakeman"
scan_ruby:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: .ruby-version
bundler-cache: true
- run: bundle exec brakeman --exit-on-warn --no-progress --color --output /dev/stdout
bundle-audit:
name: "Security / bundle-audit"

- name: Scan for common Rails security vulnerabilities using static analysis
run: bin/brakeman --no-pager

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: .ruby-version
bundler-cache: true
- run: bundle exec bundle-audit check --update -v
build-and-push-image:
name: "Build and push Docker image"
if: github.ref == 'refs/heads/main'

- name: Lint code for consistent style
run: bin/rubocop -f github

test:
runs-on: ubuntu-latest
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
permissions:
contents: read
packages: write

services:
postgres:
image: postgres
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
options: --health-cmd="pg_isready" --health-interval=10s --health-timeout=5s --health-retries=3

# redis:
# image: redis
# ports:
# - 6379:6379
# options: --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5

steps:
- name: Checkout repository
- name: Install packages
run: sudo apt-get update && sudo apt-get install --no-install-recommends -y build-essential git libpq-dev pkg-config google-chrome-stable

- name: Checkout code
uses: actions/checkout@v4
# Uses the `docker/login-action` action to log in to the Container registry registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here.
- name: Log in to the Container registry
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels that will be applied to the specified image. The `id` "meta" allows the output of this step to be referenced in a subsequent step. The `images` value provides the base name for the tags and labels.
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@60a0d343a0d8a18aedee9d34e62251f752153bdb
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository.
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
- name: Build and push Docker image
id: push
uses: docker/build-push-action@5176d81f87c23d6fc96624dfdbcd9f3830bbe445

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}




ruby-version: .ruby-version
bundler-cache: true

- name: Run tests
env:
RAILS_ENV: test
DATABASE_URL: postgres://postgres:postgres@localhost:5432
# REDIS_URL: redis://localhost:6379/0
run: bin/rails db:test:prepare test test:system

- name: Keep screenshots from failed system tests
uses: actions/upload-artifact@v4
if: failure()
with:
name: screenshots
path: ${{ github.workspace }}/tmp/screenshots
if-no-files-found: ignore
Loading

0 comments on commit 4d770b0

Please sign in to comment.