-
Notifications
You must be signed in to change notification settings - Fork 8.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DEV: Pull compatible themes in tests workflow #27093
Conversation
fbfec8d
to
bd6f652
Compare
# Checkout value of the version compat | ||
if checkout_version | ||
puts "checking out compatible #{theme_name} version: #{checkout_version}" | ||
|
||
update_status = | ||
system( | ||
"git -C '#{theme_path}' cat-file -e #{checkout_version} || git -C '#{theme_path}' fetch --depth 1 $(git -C '#{theme_path}' rev-parse --symbolic-full-name @{upstream} | awk -F '/' '{print $3}') #{checkout_version}; git -C '#{theme_path}' reset --hard #{checkout_version}", | ||
) | ||
|
||
abort("Unable to checkout a compatible theme version") unless update_status | ||
else | ||
puts "#{theme_name} is already at latest compatible version" | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is adapted from
discourse/lib/tasks/plugin.rake
Lines 156 to 168 in 1dcf756
checkout_version = Discourse.find_compatible_git_resource(plugin_path) | |
# Checkout value of the version compat | |
if checkout_version | |
puts "checking out compatible #{plugin} version: #{checkout_version}" | |
update_status = | |
system( | |
"git -C '#{plugin_path}' cat-file -e #{checkout_version} || git -C '#{plugin_path}' fetch --depth 1 $(git -C '#{plugin_path}' rev-parse --symbolic-full-name @{upstream} | awk -F '/' '{print $3}') #{checkout_version}; git -C '#{plugin_path}' reset --hard #{checkout_version}", | |
) | |
abort("Unable to checkout a compatible plugin version") unless update_status | |
else | |
puts "#{plugin} is already at latest compatible version" | |
end |
This commit adds a step in our tests workflow on Github actions to update the themes to use the compatible version when not running aginast the `main` branch. This is to ensure that we are not running the tests for themes against an incompatible version of Discourse.
bd6f652
to
e877642
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I also think the duplication is fine for this 👍
.glob(File.expand_path("#{Rails.root}/tmp/themes/*")) | ||
.select { |f| File.directory? f } | ||
.each do |theme_path| | ||
next unless File.directory?(theme_path + "/.git") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
next unless File.directory?(theme_path + "/.git") | |
next if !File.directory?(theme_path + "/.git") |
:P
"git -C '#{theme_path}' cat-file -e #{checkout_version} || git -C '#{theme_path}' fetch --depth 1 $(git -C '#{theme_path}' rev-parse --symbolic-full-name @{upstream} | awk -F '/' '{print $3}') #{checkout_version}; git -C '#{theme_path}' reset --hard #{checkout_version}", | ||
) | ||
|
||
abort("Unable to checkout a compatible theme version") unless update_status |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
abort("Unable to checkout a compatible theme version") unless update_status | |
abort("Unable to checkout a compatible theme version") if !update_status |
Thank you @martin-brennan 👍 |
This commit adds a step in our tests workflow on Github actions to update the themes to use the compatible version when not running aginast the `main` branch. This is to ensure that we are not running the tests for themes against an incompatible version of Discourse.
This commit adds a step in our tests workflow on Github actions to update the themes to
use the compatible version when not running aginast the
main
branch.This is to ensure that we are not running
the tests for themes against an incompatible version of Discourse.