-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
42 lines (32 loc) · 1.2 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
name: Rails test
description: Run Rails tests
inputs:
token:
description: Github personal access token (PAT) to clone other private repos
required: false
command:
description: Command to run tests
required: false
default: bundle exec rails test
runs:
using: docker
# https://pkgs.alpinelinux.org/packages?name=ruby&branch=v3.17&arch=x86_64
image: docker://voormedia/ruby-build:3.17
env:
RAILS_ENV: test
DISABLE_SPRING: 1
args:
- ssh-keyscan -H github.com > /etc/ssh/ssh_known_hosts
- git config --global url."https://oauth2:${{ inputs.token }}@github.com/".insteadOf "[email protected]:"
# Install dependencies.
- bundle config --global silence_root_warning true
- bundle install --jobs 8 --retry 3
# Run rubocop if configured.
# TODO: Extract into separate action? If so, make sure we need to run bundle only once!
- if [ -f ".rubocop.yml" ]; then bundle exec rubocop; fi
# Create test database.
- bundle exec rails db:create
# Load db structure from SQL or Ruby file.
- if [ -f "config/sequel.rb" ]; then bundle exec rails db:structure:load; else bundle exec rails db:schema:load; fi
# Run tests.
- ${{ inputs.command }}