Skip to content

Commit

Permalink
Merge pull request #38 from arthurpalves/action
Browse files Browse the repository at this point in the history
Action
  • Loading branch information
arthurpalves authored Sep 30, 2020
2 parents d5d656c + cecbf76 commit e1a6bcc
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/test_action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: test_action

on:
push:
branches: [ action ]
env:
DEVELOPER_DIR: /Applications/Xcode_11.4.app/Contents/Developer
GITHUB_TOKEN: ${{ secrets.PAT }}

jobs:
build:
runs-on: macos-latest

steps:
- uses: actions/checkout@v2

- uses: arthurpalves/[email protected]
with:
source: Sources/
minimum_threshold: 60
ignore_output_result: true
only_changes: true
report_format: plain

53 changes: 53 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: 'coherent-swift'
description: 'Measures cohesion in your Swift codebase'
author: 'Arthur Alves <[email protected]>'
branding:
icon: "code"
color: "green"

inputs:
source:
description: 'Source folder to scan.'
required: true
minimum_threshold:
description: 'Overall cohesion will be validated against this minimum threshold.'
required: true
default: '80'
reports_folder:
description: 'The folder where your reports will be saved to.'
required: true
default: './coherent-swift-reports'
ignore_output_result:
description: 'If "true", measure in passive mode. Observe without enforcing changes'
required: true
default: 'false'
report_format:
description: 'Format of cohesion report. Available formats: json, plain'
required: true
default: 'json'
only_changes:
description: 'If "true", only measure cohesion on changed files.'
required: true
default: 'false'

runs:
using: "composite"
steps:
- name: Prepare spec
shell: bash
run: |
echo -e "source: ${{ inputs.source }}\n" > ${{ github.action_path }}/_coherent-swift.yml
echo -e "minimum_threshold: ${{ inputs.minimum_threshold }}\n" >> ${{ github.action_path }}/_coherent-swift.yml
echo -e "reports_folder: ${{ inputs.reports_folder }}\n" >> ${{ github.action_path }}/_coherent-swift.yml
echo -e "ignore_output_result: ${{ inputs.ignore_output_result }}\n" >> ${{ github.action_path }}/_coherent-swift.yml
echo -e "report_format: ${{ inputs.report_format }}\n" >> ${{ github.action_path }}/_coherent-swift.yml
- name: Measure cohesion
shell: bash
run: |
cd ${{ github.action_path }}
if [[ ${{ inputs.only_changes }} == 'true' ]]; then
swift run coherent-swift report -d -s _coherent-swift.yml
else
swift run coherent-swift report -s _coherent-swift.yml
fi

0 comments on commit e1a6bcc

Please sign in to comment.