diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 000000000..8cff89bc5 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,27 @@ +name: lint + +on: + workflow_dispatch: # Manual trigger from GitHub UI + push: + branches: ['**'] + paths: + - '**.swift' + - '.swiftlint.yml' + - '.github/workflows/lint.yml' + pull_request: + branches: [main] + paths: + - '**.swift' + - '.swiftlint.yml' + - '.github/workflows/lint.yml' + +jobs: + swiftlint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: SwiftLint + uses: norio-nomura/action-swiftlint@3.2.1 + with: + args: --reporter github-actions-logging --lenient diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 8997890eb..8b04769b7 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -1,8 +1,9 @@ name: build_test on: + workflow_dispatch: # Manual trigger from GitHub UI push: - branches: [ main ] + branches: ['**'] pull_request: branches: [ main ] @@ -40,8 +41,8 @@ jobs: tar xzf swift-${SWIFT_VERSION}-RELEASE-ubuntu22.04.tar.gz mv swift-${SWIFT_VERSION}-RELEASE-ubuntu22.04 /opt/swift rm swift-${SWIFT_VERSION}-RELEASE-ubuntu22.04.tar.gz - export PATH="/opt/swift/usr/bin:${PATH}" - - uses: actions/checkout@v2 + echo "/opt/swift/usr/bin" >> $GITHUB_PATH + - uses: actions/checkout@v4 - name: Build run: swift build -c ${{ matrix.kind }} -v - name: Install protobuf diff --git a/.swiftlint.yml b/.swiftlint.yml new file mode 100644 index 000000000..c4c4bbd04 --- /dev/null +++ b/.swiftlint.yml @@ -0,0 +1,50 @@ +# SwiftLint Configuration for Fuzzilli +# https://github.com/realm/SwiftLint + +excluded: + - .build + - .venv + - v8 + - v8_patch + - Targets + - Package.swift + - "**/*.pb.swift" + - "**/*Test*" + +disabled_rules: + - trailing_whitespace + - line_length + - file_length + - type_body_length + - function_body_length + - cyclomatic_complexity + - identifier_name + - large_tuple + - nesting + - force_cast + - force_try + - force_unwrapping + - todo + - opening_brace + - trailing_comma + +opt_in_rules: + - empty_count + - empty_string + - fatal_error_message + - first_where + - overridden_super_call + - redundant_nil_coalescing + - sorted_first_last + - yoda_condition + - contains_over_first_not_nil + +function_parameter_count: + warning: 8 + error: 10 + +type_name: + min_length: 2 + max_length: 50 + +reporter: "github-actions-logging" diff --git a/Package.swift b/Package.swift index a70109f56..0a4ceeef3 100755 --- a/Package.swift +++ b/Package.swift @@ -63,7 +63,7 @@ let package = Package( "Protobuf/README.md", "Protobuf/gen_programproto.py"], resources: [ - // The ast.proto file is required by the node.js parser + // The ast.proto file is required by the node.js parser and stuff .copy("Protobuf/ast.proto"), .copy("Compiler/Parser")]),