mirror of
https://github.com/System-End/hackatime.git
synced 2026-04-19 19:55:16 +00:00
TIL Hackatime uses the Disk service?! (#991)
This commit is contained in:
parent
1b7e0462dc
commit
73223f1ec7
6 changed files with 24 additions and 9 deletions
11
.github/workflows/ci.yml
vendored
11
.github/workflows/ci.yml
vendored
|
|
@ -128,11 +128,16 @@ jobs:
|
|||
- name: Set up Bun
|
||||
uses: oven-sh/setup-bun@v2
|
||||
|
||||
- name: Set up Chrome
|
||||
# Pin Chrome to version 133 to avoid flaky system test failures.
|
||||
# Chrome 134+ has a known bug causing intermittent Selenium/Capybara failures
|
||||
# where session paths don't update correctly after visit() calls.
|
||||
# See: https://github.com/teamcapybara/capybara/issues/2800
|
||||
# Remove this pin once the upstream issue is resolved.
|
||||
- name: Setup Chrome
|
||||
id: setup-chrome
|
||||
uses: browser-actions/setup-chrome@v2
|
||||
uses: browser-actions/setup-chrome@latest
|
||||
with:
|
||||
chrome-version: 142
|
||||
chrome-version: 133
|
||||
install-chromedriver: true
|
||||
|
||||
- name: Install JavaScript dependencies
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ class HeartbeatExportJob < ApplicationJob
|
|||
HeartbeatExportMailer.export_ready(
|
||||
user,
|
||||
recipient_email: recipient_email,
|
||||
blob: blob,
|
||||
blob_signed_id: blob.signed_id,
|
||||
filename: zip_filename
|
||||
).deliver_now
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,8 +1,13 @@
|
|||
class HeartbeatExportMailer < ApplicationMailer
|
||||
def export_ready(user, recipient_email:, blob:, filename:)
|
||||
def export_ready(user, recipient_email:, blob_signed_id:, filename:)
|
||||
blob = ActiveStorage::Blob.find_signed!(blob_signed_id)
|
||||
url_options = Rails.application.config.action_mailer.default_url_options || {}
|
||||
|
||||
@user = user
|
||||
@filename = filename
|
||||
@download_url = rails_blob_url(blob, disposition: "attachment")
|
||||
@download_url = ActiveStorage::Current.set(url_options:) do
|
||||
blob.url(expires_in: 7.days, disposition: "attachment")
|
||||
end
|
||||
|
||||
mail(
|
||||
to: recipient_email,
|
||||
|
|
|
|||
|
|
@ -12,6 +12,11 @@ Capybara.register_driver :headless_chromium do |app|
|
|||
options.add_argument("--disable-dev-shm-usage")
|
||||
options.add_argument("--window-size=1400,1400")
|
||||
|
||||
# (For CI pinning)
|
||||
if ENV["CHROME_BIN"].present?
|
||||
options.binary = ENV["CHROME_BIN"]
|
||||
end
|
||||
|
||||
service = Selenium::WebDriver::Chrome::Service.new(
|
||||
path: ENV.fetch("CHROMEDRIVER_BIN", "/usr/bin/chromedriver")
|
||||
)
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ class HeartbeatExportJobTest < ActiveJob::TestCase
|
|||
assert_equal "src/first.rb", payload.fetch("heartbeats").first.fetch("entity")
|
||||
assert_equal "src/second.rb", payload.fetch("heartbeats").last.fetch("entity")
|
||||
|
||||
assert_includes mail.text_part.body.decoded, "/rails/active_storage/blobs/redirect/"
|
||||
assert_includes mail.text_part.body.decoded, "/rails/active_storage/"
|
||||
end
|
||||
|
||||
test "date-range export includes only heartbeats in range" do
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class HeartbeatExportMailerTest < ActionMailer::TestCase
|
|||
mail = HeartbeatExportMailer.export_ready(
|
||||
@user,
|
||||
recipient_email: @recipient_email,
|
||||
blob: blob,
|
||||
blob_signed_id: blob.signed_id,
|
||||
filename: "heartbeats_test.zip"
|
||||
)
|
||||
|
||||
|
|
@ -32,7 +32,7 @@ class HeartbeatExportMailerTest < ActionMailer::TestCase
|
|||
assert_includes mail.html_part.body.decoded, "Your heartbeat export is ready"
|
||||
assert_includes mail.text_part.body.decoded, "Your Hackatime heartbeat export has been generated"
|
||||
assert_includes mail.text_part.body.decoded, @user.display_name
|
||||
assert_includes mail.text_part.body.decoded, "/rails/active_storage/blobs/redirect/"
|
||||
assert_includes mail.text_part.body.decoded, "/rails/active_storage/"
|
||||
assert_includes mail.text_part.body.decoded, "heartbeats_test.zip"
|
||||
|
||||
blob.purge
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue