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
2 changes: 1 addition & 1 deletion .github/workflows/version-and-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
fetch-depth: '0'

Expand Down
44 changes: 42 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,45 @@
# RoleModel/actions

### 1.0.0
## [v3.1.0] Feb 25, 2026

Add new `project-stats` action which provides a markdown version of
the output of `bin/rails stats` to your workflow's summary page on Github.

## [v3.0.0] Feb 17, 2026

Update Dependency Actions + Add an Input (#6) #major

- Standardize wording, Quoting, & Capitalization
across composite actions
- Add optional input (needs-compiled-assets) to
linting-and-non-system-tests action (def. true)
- Update Dependency Actions
- actions/cache v4 -> v5
- actions/setup-node v4 -> v6
- mikepenz/action-junit-report v4 -> v6
- browser-actions/setup-chrome v1 -> v2
- actions/upload-artifact v4 -> v6

## [v2.0.0] Apr 11, 2025

We originally had a shared workflow that contained all of these actions, but that
was too restrictive. Some projects needed special things to happen (custom install
step, setting up special ENV variables, or needing special secrets that we didn't want
to pass into the composite actions). As an alternative strategy, we're going to provide
many "composite" actions which you can reference from your projects `.github/workflows/ci.yml`.

New Composite Actions:

- compile assets
- non system tests
- and system tests

## [v1.0.0] Feb 18, 2025

- Add `test-cleanup` action to save logs
- Add `test-runtime-analyzer` action to post test runtimes
- Add `test-runtime-analyzer` action to post test runtimes

[v3.1.0]: https://github.com/RoleModel/actions/releases/tag/v3.1.0
[v3.0.0]: https://github.com/RoleModel/actions/releases/tag/v3.0.0
[v2.0.0]: https://github.com/RoleModel/actions/releases/tag/v2.0.0
[v1.0.0]: https://github.com/RoleModel/actions/releases/tag/v1.0.0
37 changes: 29 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
# RoleModel/actions

Shared Github Actions

## test-cleanup

Cleans up after test runs by uploading screenshots and dumping system information to stdout.

Inputs:
- `artifact-prefix`*: A string prefix to name the uploaded log file. Artifact name will be named `${artifact-prefix}-logs`

Example:

```yaml
- name: Cleanup
uses: RoleModel/actions/test-cleanup@v3
Expand All @@ -16,24 +19,30 @@ Example:
```

## test-runtime-analyzer

Posts the runtime of the longest test files. This is important because the most granular parallel_tests goes is at
the file level, so when running in parallel, the entire suite can never be quicker than the slowest file.

Inputs:

- `test-output-path`*: Path to the test output file that hold runtimes
- `top-count`: Number of slowest tests to show. Default: 10

Example:

```yaml
- name: Analyze test runtimes
uses: RoleModel/actions/test-runtime-analyzer@v3
with:
test-output-path: tmp/turbo_rspec_runtime.log
```

## Shared workflow actions
This is a combination of three composite actions that can be used to run your entire CI flow for a rails app using parallel_tests. Each action allow you to customize the machine, environment variables, and any custom install steps that are needed. It does require you to check out the code yourself, since some install steps might happen after that.

This is a combination of multiple composite actions that can be used to run your entire CI flow for a rails app using parallel_tests. Each action allow you to customize the machine, environment variables, and any custom install steps that are needed. It does require you to check out the code yourself, since some install steps might happen after that.

The only inputs are for the linting and non system test action. Neither are required:

- `linting-step-required`: Boolean (default is false). Only needed if you have a linting command
- `linting-step-command`: String, `bundle exec rubocop --fail-level warning --display-only-fail-level-offenses --format github`

Expand All @@ -59,13 +68,13 @@ env:
# Otherwise, the only thing that matters is that the value is not nil.

jobs:
compile_assets:
compile-assets:
name: Compile Assets
runs-on: blacksmith-4vcpu-ubuntu-2204
timeout-minutes: 5
steps:
- name: Checkout Code
uses: actions/checkout@v4
uses: actions/checkout@v6

- uses: RoleModel/actions/compile-assets@v3
id: check-asset-cache
Expand All @@ -75,7 +84,7 @@ jobs:
runs-on: blacksmith-8vcpu-ubuntu-2204
timeout-minutes: 5
# If you have non-system tests that touch the browser, you may need to uncomment the following line.
# needs: compile_assets
# needs: compile-assets
services:
postgres:
image: postgres:17
Expand All @@ -87,19 +96,19 @@ jobs:

steps:
- name: Checkout Code
uses: actions/checkout@v4
uses: actions/checkout@v6

- uses: RoleModel/actions/linting-and-non-system-tests@v3
with:
linting_step_required: true
linting_step_command: bundle exec rubocop --fail-level warning --display-only-fail-level-offenses --format github
needs-compiled-assets: false # Remove this input if you uncommented `needs: compile_assets` above.
needs-compiled-assets: false # Remove this input if you uncommented `needs: compile-assets` above.

system-test:
name: Ruby System Tests
runs-on: blacksmith-16vcpu-ubuntu-2204
timeout-minutes: 10
needs: compile_assets
needs: compile-assets
services:
postgres:
image: postgres:17
Expand All @@ -111,7 +120,7 @@ jobs:

steps:
- name: Checkout Code
uses: actions/checkout@v4
uses: actions/checkout@v6

# Custom install steps may be added between checkout & test run if needed. e.g.
# If your application processes ActiveStorage::Variant records you probably need the following step:
Expand All @@ -124,9 +133,21 @@ jobs:
# you can tell the system-tests action like this:
with:
failure-screenshot-dir: tmp/screenshots
# completely optional job (for Rails projects only) - outputs a stats table in your workflow's summary page
project-stats:
name: Project Stats
runs-on: blacksmith-4vcpu-ubuntu-2204
timeout-minutes: 5
steps:
- name: Checkout Code
uses: actions/checkout@v6

- name: Capture Project Stats
uses: RoleModel/actions/project-stats
```

## Versioning

This is using [anothrNick/github-tag-action](https://github.com/anothrNick/github-tag-action/tree/master) to automatically
post version tags when a commit is merged to master. Unless you include `#patch` or `#major` in your commit message,
it will automatically create a new tag a minor version higher. `#none` will skip tagging altogether.
42 changes: 42 additions & 0 deletions project-stats/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Project Stats
description: Runs `bin/rails stats` and converts the output to a Markdown Table for the GitHub Actions summary.
inputs:
install-ruby:
description: >
Whether Ruby & Gems install should be performed before running the command.
Set this to false if your using this action as a step within a larger job that has already setup Ruby.
required: false
default: 'true'

runs:
using: composite
steps:
- name: Install Ruby and Gems
uses: ruby/setup-ruby@v1
if: inputs.install-ruby == 'true'
with:
bundler-cache: true

- name: Run Stats Command and Capture Output
shell: bash
run: |
bin/rails stats | sed -n '/^|/p' | while IFS= read -r line; do
trimmed="${line#|}"
trimmed="${trimmed%|}"
IFS='|' read -ra cells <<< "$trimmed"
row="| "
for cell in "${cells[@]}"; do
cell="$(echo "$cell" | sed 's/^ *//;s/ *$//')"
row+="$cell | "
done
echo "$row"

if [ -z "$header_done" ]; then
sep="| "
for cell in "${cells[@]}"; do
sep+="--- | "
done
echo "$sep"
header_done=1
fi
done >> $GITHUB_STEP_SUMMARY
8 changes: 5 additions & 3 deletions test-cleanup/action.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
name: "Test Cleanup"

name: Test Cleanup
description: Uploads Test Logs and prints system info to the console after test runs.
inputs:
artifact-prefix:
type: string
description: >
Prefix for the uploaded artifact name. Full artifact name will be {prefix}-logs.
This is used to differentiate logs from different test runs (e.g. system vs non-system tests).
required: true

runs:
Expand Down
10 changes: 5 additions & 5 deletions test-runtime-analyzer/action.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: 'Test Runtime Analyzer'
description: 'Analyzes test runtimes and shows the slowest tests'
name: Test Runtime Analyzer
description: Analyzes test runtimes and shows the slowest tests
inputs:
test-output-path:
description: 'Path to the test output file'
description: Path to the test output file
required: true
top-count:
description: 'Number of slowest tests to show'
description: Number of slowest tests to show
required: false
default: '10'

runs:
using: "composite"
using: composite
steps:
- name: Analyze test runtimes
shell: bash
Expand Down