-
Notifications
You must be signed in to change notification settings - Fork 28
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
Add GH actions CI testing #24
Conversation
a701108
to
5a2ae4f
Compare
[test smart_proxy_ansible] |
1 similar comment
[test smart_proxy_ansible] |
roles_path, 'roles' do | ||
Dir.glob("#{roles_path}/*").map do |path| | ||
path.split('/').last | ||
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 indenting looks odd
7e96ba1
to
eb55e98
Compare
Gemfile
Outdated
gem 'pry' | ||
|
||
if ENV.fetch('BUNDLE_SMART_PROXY', '1') == '1' |
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.
I was thinking about ENV['SMART_PROXY_PATH']
which is the path
to pass to gem 'smart_proxy'
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.
oh, RIGHT! 👍
05045d9
to
7f88fbb
Compare
Added new passing tests, it looks better now ;) |
.github/workflows/ci.yml
Outdated
test_ruby: | ||
runs-on: ubuntu-latest | ||
needs: rubocop | ||
env: | ||
SMART_PROXY_PATH: '../smart-proxy' | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
smart-proxy-branch: [develop] | ||
ruby-version: [2.5, 2.7] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
repository: theforeman/smart-proxy | ||
ref: ${{ matrix.smart-proxy-branch }} | ||
path: smart-proxy | ||
- uses: actions/checkout@v2 | ||
with: | ||
path: smart_proxy_ansible | ||
- name: Setup Ruby | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: ${{ matrix.ruby-version }} | ||
bundler-cache: true | ||
working-directory: smart_proxy_ansible | ||
- name: Create logs dir | ||
working-directory: smart_proxy_ansible | ||
run: mkdir logs | ||
- name: Run plugin tests | ||
working-directory: smart_proxy_ansible | ||
run: | | ||
bundle exec rake test |
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.
FYI: I already enabled testing on Jenkins so this is redundant now.
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.
nice work 👍
7f88fbb
to
262704e
Compare
FYI: you can trigger the tests by pushing a branch to Github with these actions. You can then delete the branch and get back to your fork. Then they show up in this PR. |
|
||
if (smart_proxy_path = ENV.fetch('SMART_PROXY_PATH', nil)) | ||
gem 'smart_proxy', path: smart_proxy_path | ||
elsif ENV.fetch('BUNDLE_SMART_PROXY', '1') != '0' |
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.
Is this still needed?
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.
Well you might want to completely disable bundling it, eg for the rubocop.
rubocop: | ||
runs-on: ubuntu-latest | ||
env: | ||
BUNDLE_SMART_PROXY: '0' |
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.
Doesn't an empty string work just as well?
Also, you can set BUNDLE_WITHOUT: development
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.
That would not work IMO, the smart-proxy is not in development and on contrary, we want to install some development dependencies.
262704e
to
0cffbeb
Compare
lib/smart_proxy_ansible/plugin.rb
Outdated
http_rackup_path File.expand_path('http_config.ru', | ||
File.expand_path('../', __FILE__)) | ||
File.expand_path(__dir__)) | ||
https_rackup_path File.expand_path('http_config.ru', | ||
File.expand_path('../', __FILE__)) | ||
File.expand_path(__dir__)) |
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.
I also think the double call to File.expand_path
is redundant.
If you rely on Smart Proxy 2.3 or newer, you can use rackup_path File.expand_path('http_config.ru', __dir__)
instead of the two separate calls.
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.
I've got no idea if it's safe to assume that and the only dependency is development dependency 🤔
Although it would be nice to fix it, I don't think it should be part of this 🤔
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.
Agreed, but just wanted you to know. You can at least simplify it further with https_rackup_path File.expand_path('http_config.ru', __dir__)
. The extra File.expand_path
doesn't really add anything.
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.
I've put it on one line, and I'd like to postpone it after the merge of this.
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.
But lets have a PR for it not to forget: #25 :)
6b19441
to
290ea44
Compare
4bd3463
to
75a8267
Compare
What's the plan here? |
0423359
to
ad9689d
Compare
ad9689d
to
2f23d86
Compare
It does weird stuff. Tho the question is, do we want this? :) |
That depends. What was the original reason for this? |
I guess add rubocop in GH actions to have inline RuboCop... probably was supposed to be followed up by GH action tests |
Taking a new stab at this: #68. |
Bumps the minimal Ruby version to match the
smart-proxy
version.Adds the rubocop gem and GH actions
Passing:
https://github.com/ezr-ondrej/smart_proxy_ansible/actions/runs/399558335https://github.com/ezr-ondrej/smart_proxy_ansible/actions/runs/404608706In this PR, thanks @ekohl :)