ashfurrow / danger-ruby-swiftlint

A Danger plugin for SwiftLint.
https://rubygems.org/gems/danger-swiftlint
MIT License
203 stars 81 forks source link

Failed to run swiftlint on ubuntu #177

Open Dmitry-Pliushchai opened 2 years ago

Dmitry-Pliushchai commented 2 years ago

I use github action to run danger. It works fine on macOS but doesn't work on ubuntu. Screenshot 2022-02-03 at 23 09 33

GitHub action .yml:

name: Danger
on:
  pull_request:

jobs:
  danger:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2
    - uses: actions/cache@v1
      with:
        path: vendor/bundle
        key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
        restore-keys: |
          ${{ runner.os }}-gems-
    - name: Setup Ruby
      uses: actions/setup-ruby@v1
      with:
        ruby-version: '2.5'
    - name: Setup gems
      run: |
        gem install bundler -v "2.2.21"
        bundle config path vendor/bundle
        bundle install --jobs 4 --retry 3
    - name: Run Danger
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      run: |
        bundle exec danger
aakarsh-sasi commented 2 years ago

@ashfurrow Facing the same issue on ubuntu. It works fine when the system being used is macos. But somehow fails for ubuntu-latest (20.04)

Logs are not much helpful either:

Run bash ./Scripts/danger_lint.sh
Config file was not specified.
Swiftlint will be run from /home/runner/work/SpotlightDemo/SpotlightDemo
Swiftlint will exclude the following paths: []
Swiftlint includes the following paths: []
linting with options: {:config=>nil, :reporter=>"json", :quiet=>true, :***"/home/runner/work/SpotlightDemo/SpotlightDemo", :force_exclude=>true}
Swiftlint will lint the following files: /home/runner/work/SpotlightDemo/SpotlightDemo/Dangerfile.swift
/var/lib/gems/2.[7](https://github.com/aakarsh-sasi/SpotlightDemo/runs/5216630942?check_suite_focus=true#step:5:7).0/gems/danger-swiftlint-0.2[9](https://github.com/aakarsh-sasi/SpotlightDemo/runs/5216630942?check_suite_focus=true#step:5:9).4/ext/swiftlint/bin/swiftlint: 1: ����@����@������: not found
/var/lib/gems/2.7.0/gems/danger-swiftlint-0.29.4/ext/swiftlint/bin/swiftlint: 2: Syntax error: "(" unexpected
Received from Swiftlint: {}
All green. Jolly good show.
dirtyhabits97 commented 2 years ago

Looks like the SwiftLint binary might be corrupted after the download: https://github.com/ashfurrow/danger-ruby-swiftlint/blob/a955921c8322d777ed7a4d679d1b062528274fc3/ext/swiftlint/downloadSwiftlint.sh#L39-L48

I can take a look at downloadSwiftLint.sh this weekend and see if we have any compatibility issues with Ubuntu.

ashfurrow commented 2 years ago

Thank you @dirtyhabits97 – let us know what you learn 👍

dirtyhabits97 commented 2 years ago

The downloadSwift.sh command seems to be working as intended.

Perhaps we should download swiftlint_linux.zip here: https://github.com/ashfurrow/danger-ruby-swiftlint/blob/a955921c8322d777ed7a4d679d1b062528274fc3/ext/swiftlint/Rakefile#L12 Instead of portable_swiftlint.zip.

Kiran-B commented 2 years ago

I don't think portable_swiftlint.zip will help either. Here is what I tried. I downloaded the portable version of swiftlint using Curl using the command:

curl -s -L https://github.com/realm/SwiftLint/releases/download/0.47.0/portable_swiftlint.zip -o "portable_swiftlint.zip"
unzip -o -q portable_swiftlint.zip -d ../swiftlintportable/bin

Executed Danger by defining the custom Swiftlint path in Dangerfile using: swiftlint.binary_path.

However, I still get a very similar error during execution:

/home/runner/work/repo/swiftlintportable/bin/swiftlint: 1: Syntax error: "(" unexpected
[46](https://github.com/org/repo/runs/6145317925?check_suite_focus=true#step:5:46)

I also tried installing Swiftlint via Mint. No success. But get a slightly different error:

SourceKittenFramework/library_wrapper.swift:31: Fatal error: Loading libsourcekitdInProc.so failed
idrougge commented 2 years ago

Getting this exact problem on a runner with Ubuntu 20.04.5 LTS.

PepeLoperenaaa commented 1 year ago

Hi there, is there a fix for this error or is it still giving errors? Thanks in advance!