Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
PiTrem committed Dec 2, 2024
1 parent e242b5a commit 2a7ed9d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 39 deletions.
39 changes: 1 addition & 38 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,38 +8,6 @@ on:
- main

jobs:
linting:
if: github.event.pull_request && (github.triggering_actor != 'dependabot[bot]')
runs-on: ubuntu-latest
env:
PRONTO_PULL_REQUEST_ID: ${{ github.event.pull_request.number }}
steps:
- name: checkout repository
uses: actions/checkout@v4
- run: |
git fetch --no-tags --prune --unshallow origin +refs/heads/*:refs/remotes/origin/*
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3.0'

- name: install linting dependencies
run: gem install rubocop pronto pronto-rubocop rubocop-rspec rubocop-rails rubocop-performance

- name: run Pronto
run: pronto run -f github_status github_pr_review -c origin/${{ github.base_ref }}
env:
PRONTO_GITHUB_ACCESS_TOKEN: "${{ github.token }}"
if: github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name # don't run on PRs from forks because of missing write permission: https://github.com/orgs/community/discussions/26829

- name: run Pronto on fork
# We cannot use the `github_status` formatter on forks in order to report the linting status,
# since the formatter requires write access, which isn't the default on forks.
# This is why we're using the `--exit-code` flag, which causes Pronto to propagate non-zero exit codes,
# i.e., we can use the `--exit-code` flag to fail the linting job in case Pronto reports warning or errors (https://github.com/prontolabs/pronto).
run: pronto run --exit-code -f text -c origin/${{ github.base_ref }}
if: github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name

testing:
needs: [linting]
if: always() && (needs.linting.result == 'success' || needs.linting.result == 'skipped') # https://github.com/actions/runner/issues/491
Expand Down Expand Up @@ -108,23 +76,18 @@ jobs:
- name: bundle install
run: bundle install

- name: yarn install
run: yarn install --production=false

- name: prepare postgres
run: |
RAILS_ENV=test bundle exec rake db:migrate
RAILS_ENV=test bundle exec rake db:test:prepare
RAILS_ENV=test bundle exec rake db:seed
- name: npm test
run: npm test
- name: rspec unit
run: |
service ssh restart
eval `ssh-agent`
DATACOLLECTOR_FACTORY_SFTP_USER=testuser ATACOLLECTOR_FACTORY_SFTP_KEY=id_test RAILS_ENV=test bundle exec rspec --exclude-pattern spec/{features}/**/*_spec.rb spec/lib/datacollector
DATACOLLECTOR_FACTORY_SFTP_USER=testuser DATACOLLECTOR_FACTORY_SFTP_KEY=id_test RAILS_ENV=test bundle exec rspec --exclude-pattern spec/{features}/**/*_spec.rb spec/lib/datacollector
- name: coverage rspec unit
if: github.event.pull_request && (github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name) && (github.triggering_actor != 'dependabot[bot]') # don't run on PRs from forks because of missing write permission: https://github.com/orgs/community/discussions/26829
Expand Down
3 changes: 2 additions & 1 deletion app/clients/sftp_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,15 @@ def extract_host_and_user(host, user, **options)
uri = URI.parse("ssh://#{host}")
@host = uri.host
@user = user || uri.user || options.delete(:user)
puts "Host: #{@host}, User: #{@user}"
@root_path = options.delete(:root_path) || (uri.path != '/' && uri.path.presence)
@session_options = { port: uri.port }
end

# Set some default options
def default_options(options)
@session_options = @session_options.merge(
timeout: 5, verbose: :warn, keys_only: true, auth_methods: [], number_of_password_prompts: 0,
timeout: 5, verbose: :debug, keys_only: true, auth_methods: [], number_of_password_prompts: 0,
)
@session_options[:auth_methods] = %w[publickey] if options[:keys].present? || options[:key_data].present?
@session_options[:auth_methods] += %w[password] if options[:password].present?
Expand Down

0 comments on commit 2a7ed9d

Please sign in to comment.