diff --git a/.github/workflows/configlet.yml b/.github/workflows/configlet.yml new file mode 100644 index 000000000..8cf9de6a7 --- /dev/null +++ b/.github/workflows/configlet.yml @@ -0,0 +1,18 @@ +# This workflow fetches the latest configlet binary and lints this repository + +name: Configlet + +on: pull_request + +jobs: + lint: + runs-on: ubuntu-18.04 + + steps: + - uses: actions/checkout@v2 + + - name: Fetch configlet + uses: exercism/github-actions/configlet-ci@master + + - name: Configlet Linter + run: configlet lint . diff --git a/.github/workflows/danger.yml b/.github/workflows/danger.yml new file mode 100644 index 000000000..1f63d0f41 --- /dev/null +++ b/.github/workflows/danger.yml @@ -0,0 +1,33 @@ +name: Danger + SwiftLint + +on: + pull_request: + paths: + - '.github/workflows/danger.yml' + - '.swiftlint.yml' + - '**/*.swift' + - 'Dangerfile' + - 'Gemfile' + - 'Gemfile.lock' + +jobs: + lint_danger: + runs-on: ubuntu-18.04 + + steps: + - name: Checkout PR + uses: actions/checkout@v2 + + - name: Install bundler and danger gems + run: sudo gem install bundler && bundle install + + - name: Run SwiftLint and output to lintreport.json + run: swiftlint lint --quiet --reporter json | tee lintreport.json + + - name: Run Danger to enforce PR guidelines and note SwiftLint results + uses: MeilCli/danger-action@v5 + with: + danger_file: 'Dangerfile' + danger_id: 'danger-pr' + env: + DANGER_GITHUB_API_TOKEN: ${{ secrets.danger_github_api_token }} diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml new file mode 100644 index 000000000..5c20dadf8 --- /dev/null +++ b/.github/workflows/package.yml @@ -0,0 +1,31 @@ +# This workflow runs the Swift package manager + +name: Swift package manager + +on: + pull_request: + paths: + - '.github/workflows/package.yml' + - '**/*.swift' + - 'config.json' + +jobs: + package_mac: + runs-on: macos-10.15 + + steps: + - name: Checkout PR + uses: actions/checkout@v2 + + - name: Generate Xcode project + run: swift package generate-xcodeproj + + package_linux: + runs-on: ubuntu-18.04 + + steps: + - name: Checkout PR + uses: actions/checkout@v2 + + - name: Generate Xcode project + run: swift package generate-xcodeproj diff --git a/.github/workflows/swiftlint.yml b/.github/workflows/swiftlint.yml new file mode 100644 index 000000000..a319530ed --- /dev/null +++ b/.github/workflows/swiftlint.yml @@ -0,0 +1,31 @@ +# This workflow runs SwiftLint on all Swift files + +name: SwiftLint + +on: + pull_request: + paths: + - '.github/workflows/swiftlint.yml' + - '.swiftlint.yml' + - '**/*.swift' + +jobs: + lint_mac: + runs-on: macos-10.15 + + steps: + - name: Checkout PR + uses: actions/checkout@v2 + + - name: Run SwiftLint + run: swiftlint --reporter github-actions-logging + + lint_linux: + runs-on: ubuntu-18.04 + + steps: + - name: Checkout PR + uses: actions/checkout@v2 + + - name: Run SwiftLint + uses: norio-nomura/action-swiftlint@3.1.0 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 000000000..17556e7f8 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,42 @@ +# This workflow runs each exercise's test suite + +name: Exercise Tests + +on: + pull_request: + paths: + - '.github/workflows/test.yml' + - 'exercises/*/Sources/*/*Example.swift' + - 'exercises/*/Tests/*/*Tests.swift' + - 'xswift-test-spm' + +jobs: + test_mac: + runs-on: macos-10.15 + + steps: + - name: Checkout PR + uses: actions/checkout@v2 + + - name: Set up Swift environment using swiftenv + uses: YOCKOW/Action-setup-swift@v1 + with: + swift-version: '5.3' + + - name: Run exercise tests + run: ./xswift-test-spm + + test_linux: + runs-on: ubuntu-18.04 + + steps: + - name: Checkout PR + uses: actions/checkout@v2 + + - name: Set up Swift environment using swiftenv + uses: YOCKOW/Action-setup-swift@v1 + with: + swift-version: '5.3' + + - name: Run exercise tests + run: ./xswift-test-spm diff --git a/.gitignore b/.gitignore index c052a9b8c..c596291e6 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,5 @@ DerivedData LinuxMain.swift Package.resolved xswift.xcodeproj/ + +lintreport.json diff --git a/.swiftlint.yml b/.swiftlint.yml index db18e6167..261f10f21 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -19,5 +19,3 @@ disabled_rules: # rule identifiers to exclude from running - line_length - trailing_comma - force_try - -reporter: "json" diff --git a/Gemfile b/Gemfile new file mode 100644 index 000000000..e6f04b9e7 --- /dev/null +++ b/Gemfile @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +source "https://rubygems.org" + +gem "danger" diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 000000000..a13c6ca17 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,63 @@ +GEM + remote: https://rubygems.org/ + specs: + addressable (2.7.0) + public_suffix (>= 2.0.2, < 5.0) + claide (1.0.3) + claide-plugins (0.9.2) + cork + nap + open4 (~> 1.3) + colored2 (3.1.2) + cork (0.3.0) + colored2 (~> 3.1) + danger (8.2.0) + claide (~> 1.0) + claide-plugins (>= 0.9.2) + colored2 (~> 3.1) + cork (~> 0.1) + faraday (>= 0.9.0, < 2.0) + faraday-http-cache (~> 2.0) + git (~> 1.7) + kramdown (~> 2.3) + kramdown-parser-gfm (~> 1.0) + no_proxy_fix + octokit (~> 4.7) + terminal-table (~> 1) + faraday (1.1.0) + multipart-post (>= 1.2, < 3) + ruby2_keywords + faraday-http-cache (2.2.0) + faraday (>= 0.8) + git (1.7.0) + rchardet (~> 1.8) + kramdown (2.3.0) + rexml + kramdown-parser-gfm (1.1.0) + kramdown (~> 2.0) + multipart-post (2.1.1) + nap (1.1.0) + no_proxy_fix (0.1.2) + octokit (4.19.0) + faraday (>= 0.9) + sawyer (~> 0.8.0, >= 0.5.3) + open4 (1.3.4) + public_suffix (4.0.6) + rchardet (1.8.0) + rexml (3.2.4) + ruby2_keywords (0.0.2) + sawyer (0.8.2) + addressable (>= 2.3.5) + faraday (> 0.8, < 2.0) + terminal-table (1.8.0) + unicode-display_width (~> 1.1, >= 1.1.1) + unicode-display_width (1.7.0) + +PLATFORMS + ruby + +DEPENDENCIES + danger + +BUNDLED WITH + 2.1.4 diff --git a/circle.yml b/circle.yml index 3690d3f7a..30da03de6 100644 --- a/circle.yml +++ b/circle.yml @@ -9,7 +9,7 @@ jobs: - run: sudo gem install danger - run: brew update - run: brew ls --versions swiftlint && brew upgrade swiftlint || brew install swiftlint - - run: swiftlint lint --quiet | tee lintreport.json || true # Dont crash on errors + - run: swiftlint lint --quiet --reporter json | tee lintreport.json || true # Dont crash on errors - run: ./xswift-test-spm - run: swift package generate-xcodeproj - run: