Skip to content
Open
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
73 changes: 38 additions & 35 deletions .github/templates/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,80 +2,83 @@ name: CI

on:
push:
branches: [ main ]
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}-${{ github.event.ref }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. This is actually bad... If you make this change, in my experience, it never catches things as concurrency issues and cancels them, as each build is a new event ref.
  2. I would also add that on my repos, I like main to always build (not cancel later pushes). If so, the cancel-in-progress suggestion below allows it to only cancel from later pushes on the same PR.
Suggested change
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}-${{ github.event.ref }}
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}

cancel-in-progress: true

env:
BUNDLE_WITHOUT: production
CI: true
RAILS_ENV: test
POSTGRES_USER: root
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
SECRET_KEY_BASE: '123' # Dummy value for tests

jobs:
compile_assets:
name: Compile assets
project-stats:
name: Project Stats
runs-on: blacksmith-4vcpu-ubuntu-2404
timeout-minutes: 5
outputs:
cache-hit: ${{ steps.check-asset-cache.outputs.cache-hit }}
timeout-minutes: 3
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: actions/checkout@v6
- uses: RoleModel/actions/project-stats@v3

- uses: RoleModel/actions/compile-assets@v2
compile-assets:
name: Compile Assets
runs-on: blacksmith-4vcpu-ubuntu-2404
timeout-minutes: 5
steps:
- uses: actions/checkout@v6
- uses: RoleModel/actions/compile-assets@v3
id: check-asset-cache

non-system-test:
name: Linting & Ruby Non-System Tests
runs-on: blacksmith-8vcpu-ubuntu-2404
name: Linting, Security, & Ruby Tests
runs-on: blacksmith-4vcpu-ubuntu-2404
timeout-minutes: 5
needs: compile_assets
if: always() && (needs.compile_assets.outputs.cache-hit == 'true' || (needs.compile_assets.result == 'success'))

services:
postgres:
image: postgres:17
ports:
- "5432:5432"
env:
POSTGRES_USER: root
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password

steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: actions/checkout@v6
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true

- name: Run shared flow
uses: RoleModel/actions/linting-and-non-system-tests@v2
- run: bin/bundler-audit
- run: bin/brakeman --quiet --no-pager --exit-on-warn --exit-on-error
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure this will work for every repo? I guess people can remove it if they don't have brakeman installed...?


- uses: RoleModel/actions/linting-and-non-system-tests@v3
with:
needs-compiled-assets: false
linting_step_required: true
linting_step_command: bundle exec rubocop --format github

system-test:
name: Ruby System Tests
runs-on: blacksmith-16vcpu-ubuntu-2404
name: System Tests
runs-on: blacksmith-8vcpu-ubuntu-2404
timeout-minutes: 10
if: always() && (needs.compile_assets.outputs.cache-hit == 'true' || (needs.compile_assets.result == 'success'))
needs: compile_assets
needs: compile-assets

services:
postgres:
image: postgres:17
ports:
- "5432:5432"
env:
POSTGRES_USER: root
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password

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

- name: Setup vips
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we ever (often?) need vips? Should we leave this in but commented out, for those who need it?

run: |
sudo apt-get update
sudo apt-get install -y libvips

- name: Run shared flow
uses: RoleModel/actions/system-tests@v2

- uses: actions/checkout@v6
- uses: RoleModel/actions/system-tests@v3
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
rolemodel_rails (0.26.0)
rolemodel_rails (0.26.1)
rails (> 7.1)

GEM
Expand Down
2 changes: 1 addition & 1 deletion example_rails7/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: ..
specs:
rolemodel_rails (0.26.0)
rolemodel_rails (0.26.1)
rails (> 7.1)

GEM
Expand Down
4 changes: 2 additions & 2 deletions example_rails8/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: ..
specs:
rolemodel_rails (0.26.0)
rolemodel_rails (0.26.1)
rails (> 7.1)

GEM
Expand Down Expand Up @@ -522,7 +522,7 @@ CHECKSUMS
regexp_parser (2.11.3) sha256=ca13f381a173b7a93450e53459075c9b76a10433caadcb2f1180f2c741fc55a4
reline (0.6.3) sha256=1198b04973565b36ec0f11542ab3f5cfeeec34823f4e54cebde90968092b1835
rexml (3.4.4) sha256=19e0a2c3425dfbf2d4fc1189747bdb2f849b6c5e74180401b15734bc97b5d142
rolemodel_rails (0.26.0)
rolemodel_rails (0.26.1)
rubocop (1.84.1) sha256=14cc626f355141f5a2ef53c10a68d66b13bb30639b26370a76559096cc6bcc1a
rubocop-ast (1.49.0) sha256=49c3676d3123a0923d333e20c6c2dbaaae2d2287b475273fddee0c61da9f71fd
rubocop-performance (1.26.1) sha256=cd19b936ff196df85829d264b522fd4f98b6c89ad271fa52744a8c11b8f71834
Expand Down
2 changes: 1 addition & 1 deletion lib/rolemodel_rails/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module RolemodelRails
VERSION = '0.26.0'
VERSION = '0.26.1'
end
2 changes: 1 addition & 1 deletion spec/generators/rolemodel/github_generator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

it 'creates ci.yml and updates the database.yml' do
assert_file '.github/workflows/ci.yml' do |content|
expect(content).to include('Linting & Ruby Non-System Tests')
expect(content).to include('Linting, Security, & Ruby Tests')
end

assert_file 'config/database.yml' do |content|
Expand Down