Skip to content

GitHub action for Sitecore projects that checks if solution is Helix compliant

Notifications You must be signed in to change notification settings

ethisysltd/helix-check

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

Helix Check GitHub Action

GitHub action for Sitecore projects which follow Helix principles - https://helix.sitecore.net/. Checks if solution complies with Helix rules.

General rules

Projects references:

  • Feature layer projects can only reference Foundation
  • Foundation layer projects can only reference other Foundations
  • Project layer projects can reference Feature and Foundation but not other Projects

Folders structure and naming convention:

  • There are layer folders specified in the solution

    • Feature
    • Foundation
    • Project
  • Projects are placed in correct folders, for example:

    • src\Foundation\ORM\website\Helixbase.Foundation.ORM.csproj - correct
    • src\Feature\ORM\website\Helixbase.Foundation.ORM.csproj - incorrect

Inputs

Input Description Usage
solution-file Path to the solution that will be analyzed. Required
project-name The name of your project. Required
website-folder The name of the folder that contains the website project file. In older versions of Helix, this was named "code"
Default "website".
Optional
excluded-projects List of project names that won`t be analyzed. Due to the limitations of GitHub actions it has to be a string with comma delimited project names, e.g. 'NS.Project1,NS.Project2' Optional

Outputs

Output Description
result Boolean result of the analysis. True if helix check is successful.
time Time taken for check to complete.

Example usage

Workflow

Create a yml file with the following contents (for example) in .github\workflows\ folder

name: Helix Check

on:
  push:
    branches: [ develop, master ]
  pull_request:
    branches: [ develop, master ]

jobs:
  check_job:
    name: Helix check
    runs-on: ubuntu-latest

    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Helix Check
        uses: ethisysltd/helix-check@v1.0.1
        id: check
        with:
          solution-file: 'Helixbase.sln'
          project-name: 'Helixbase'
          website-folder: 'website'
          excluded-projects: 'Helixbase.Foundation.NotFollowingHelix,Helixbase.Feature.RatherNotFollowingHelix'
      
      - name: Get the check result
        run: echo "Check result - ${{ steps.check.outputs.result }}"
      
      - name: Get the output time
        run: echo "The time was - ${{ steps.check.outputs.time }}"

Successful result

Solution file: Helixbase.sln
Project name: Helixbase
Solution file exists.
Solution is Helix compliant.

Succesful result

Unsuccessful result

Solution file: invalid/Helixbase-Invalid.sln
Project name: Helixbase
Solution file exists.

##[warning]Issues with project Helixbase.Foundation.ORM
 Folder incorrect: src\Feature\ORM\code\Helixbase.Foundation.ORM.csproj

##[warning]Issues with project Helixbase.Feature.Hero
 Folder incorrect: src\Foundation\Hero\code\Helixbase.Feature.Hero.csproj

##[warning]Issues with project Helixbase.Project.Helixbase
 Incorrect references:
  - Helixbase.Project.Common

##[warning]Issues with project Helixbase.Feature.VersionTrim
 Incorrect references:
  - Helixbase.Project.Common
  - Helixbase.Feature.ShowTitles

##[warning]Issues with project Helixbase.Foundation.Core
 Incorrect references:
  - Helixbase.Feature.Redirects
  - Helixbase.Project.Common

##[error]Solution is not Helix compliant.

Unsuccessful result