Skip to content

Commit 550bad2

Browse files
p-schlickmannrosa
authored andcommitted
Adding artifact when CI fails to inspect logs
1 parent 7dca00b commit 550bad2

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

.github/workflows/main.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ jobs:
5252
env:
5353
TARGET_DB: ${{ matrix.database }}
5454
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
55+
RAILS_ENV: test
5556
steps:
5657
- name: Checkout code
5758
uses: actions/checkout@v4
@@ -68,3 +69,12 @@ jobs:
6869
bin/rails db:setup
6970
- name: Run tests
7071
run: bin/rails test
72+
- name: Upload logs on failure
73+
if: ${{ failure() }}
74+
uses: actions/upload-artifact@v4
75+
with:
76+
name: logs
77+
path: |
78+
test/dummy/log/test.log
79+
if-no-files-found: ignore
80+
retention-days: 7

test/dummy/config/environments/test.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,9 @@
5959
config.solid_queue.logger = ActiveSupport::Logger.new(nil)
6060

6161
config.solid_queue.shutdown_timeout = 2.seconds
62+
63+
config.log_formatter = proc do |severity, timestamp, progname, msg|
64+
ts = timestamp.getlocal.strftime("%H:%M:%S.%3N")
65+
"#{ts} #{msg}\n"
66+
end
6267
end

0 commit comments

Comments
 (0)