<commit_before>on: [push, pull_request, release]
name: Continuous Integration

jobs:
  test:
    name: Test
    runs-on: windows-latest
    steps:
        - name: Checkout
          uses: actions/checkout@v2

        - name: Install .NET 5.0.x
          uses: actions/setup-dotnet@v1
          with:
             dotnet-version: '5.0.x'

        - name: Compile
          run: dotnet build -c Debug build/Desktop.proj

        - name: Test
          run: dotnet test $pwd/*.Tests/bin/Debug/*/*.Tests.dll --settings $pwd/build/vstestconfig.runsettings --logger:nunit
          shell: powershell

        - name: Report NUnit Logs
          uses: MirrorNG/nunit-reporter@v1.0.9
          with:
            path: './TestResults/TestResults.xml'
            access-token: ${{ secrets.GITHUB_TOKEN }}

  inspect-code:
     name: Code Quality
     needs: test
     runs-on: ubuntu-latest
     steps:
        - name: Checkout
          uses: actions/checkout@v2

        # FIXME: Tools won't run in .NET 5.0 unless you install 3.1.x LTS and 2.1 LTS side by side.
        # https://itnext.io/how-to-support-multiple-net-sdks-in-github-actions-workflows-b988daa884e
        - name: Install .NET 2.1.x LTS
          uses: actions/setup-dotnet@v1
          with:
            dotnet-version: '2.1.x'

        - name: Install .NET 3.1.x LTS
          uses: actions/setup-dotnet@v1
          with:
             dotnet-version: '3.1.x'

        - name: Install .NET 5.0.x
          uses: actions/setup-dotnet@v1
          with:
             dotnet-version: '5.0.x'
 
        - name: Restore Tools
          run: dotnet tool restore
        
        - name: Restore Packages
          run: dotnet restore

        - name: CodeFileSanity
          run: |
            # Suppress warnings from templates project
            # https://unix.stackexchange.com/questions/104641/how-can-i-suppress-output-from-grep-so-that-it-only-returns-the-exit-status
            dotnet codefilesanity | while read -r line; do
               if [ $(echo $line| grep -q "./osu.Framework.Templates/"; echo $?) == 1 ]; then
                 echo "::warning::$line"
               fi
            done

        - name: .NET Format (Dry Run)
          run: dotnet format --dry-run --check

        - name: InspectCode
          run: |
            dotnet jb inspectcode $(pwd)/osu-framework.Desktop.slnf --output=inspectcodereport.xml --cachesDir=$(pwd)/inspectcode --verbosity=WARN
            dotnet nvika parsereport $(pwd)/inspectcodereport.xml  --treatwarningsaserrors

  pack-n-publish:
         name: Pack and Publish
         runs-on: windows-latest
         needs: inspect-code
         defaults:
           run:
             shell: powershell
         steps:
            - name: Checkout
              uses: actions/checkout@v2
          
            - name: Set Variables
              id: deployment
              shell: bash
              run: |
               if [ ${{ github.event == 'release' && github.actor == 'peppy' }} == true ]; then
                 echo "::set-output name=VERSION::${GITHUB_REF#/refs\/tags\//}"
               else
                 echo "::set-output name=VERSION::0.0.0+${{github.run_id}}"
               fi
       
            - name: Set Artifacts Directory
              id: artifactsPath
              run: echo "::set-output name=NUGET_ARTIFACTS::${{github.workspace}}\artifacts"
   

            # FIXME: 3.1 LTS is required here because iOS builds still uses 3.1.
            # https://itnext.io/how-to-support-multiple-net-sdks-in-github-actions-workflows-b988daa884e<commit_msg>trim more whitespaces<commit_after>on: [push, pull_request, release]
name: Continuous Integration

jobs:
  test:
    name: Test
    runs-on: windows-latest
    steps:
        - name: Checkout
          uses: actions/checkout@v2

        - name: Install .NET 5.0.x
          uses: actions/setup-dotnet@v1
          with:
             dotnet-version: '5.0.x'

        - name: Compile
          run: dotnet build -c Debug build/Desktop.proj

        - name: Test
          run: dotnet test $pwd/*.Tests/bin/Debug/*/*.Tests.dll --settings $pwd/build/vstestconfig.runsettings --logger:nunit
          shell: powershell

        - name: Report NUnit Logs
          uses: MirrorNG/nunit-reporter@v1.0.9
          with:
            path: './TestResults/TestResults.xml'
            access-token: ${{ secrets.GITHUB_TOKEN }}

  inspect-code:
     name: Code Quality
     needs: test
     runs-on: ubuntu-latest
     steps:
        - name: Checkout
          uses: actions/checkout@v2

        # FIXME: Tools won't run in .NET 5.0 unless you install 3.1.x LTS and 2.1 LTS side by side.
        # https://itnext.io/how-to-support-multiple-net-sdks-in-github-actions-workflows-b988daa884e
        - name: Install .NET 2.1.x LTS
          uses: actions/setup-dotnet@v1
          with:
            dotnet-version: '2.1.x'

        - name: Install .NET 3.1.x LTS
          uses: actions/setup-dotnet@v1
          with:
             dotnet-version: '3.1.x'

        - name: Install .NET 5.0.x
          uses: actions/setup-dotnet@v1
          with:
             dotnet-version: '5.0.x'
 
        - name: Restore Tools
          run: dotnet tool restore

        - name: Restore Packages
          run: dotnet restore

        - name: CodeFileSanity
          run: |
            # Suppress warnings from templates project
            # https://unix.stackexchange.com/questions/104641/how-can-i-suppress-output-from-grep-so-that-it-only-returns-the-exit-status
            dotnet codefilesanity | while read -r line; do
               if [ $(echo $line| grep -q "./osu.Framework.Templates/"; echo $?) == 1 ]; then
                 echo "::warning::$line"
               fi
            done

        - name: .NET Format (Dry Run)
          run: dotnet format --dry-run --check

        - name: InspectCode
          run: |
            dotnet jb inspectcode $(pwd)/osu-framework.Desktop.slnf --output=inspectcodereport.xml --cachesDir=$(pwd)/inspectcode --verbosity=WARN
            dotnet nvika parsereport $(pwd)/inspectcodereport.xml  --treatwarningsaserrors

  pack-n-publish:
         name: Pack and Publish
         runs-on: windows-latest
         needs: inspect-code
         defaults:
           run:
             shell: powershell
         steps:
            - name: Checkout
              uses: actions/checkout@v2
          
            - name: Set Variables
              id: deployment
              shell: bash
              run: |
               if [ ${{ github.event == 'release' && github.actor == 'peppy' }} == true ]; then
                 echo "::set-output name=VERSION::${GITHUB_REF#/refs\/tags\//}"
               else
                 echo "::set-output name=VERSION::0.0.0+${{github.run_id}}"
               fi

            - name: Set Artifacts Directory
              id: artifactsPath
              run: echo "::set-output name=NUGET_ARTIFACTS::${{github.workspace}}\artifacts"

            # FIXME: 3.1 LTS is required here because iOS builds still uses 3.1.
            # https://itnext.io/how-to-support-multiple-net-sdks-in-github-actions-workflows-b988daa884e
{'fraction_non_alphanumeric': 0.11373480508592985, 'fraction_numerical': 0.016207908341483862, 'mean_word_length': 1.6029090909090908, 'pattern_counts': {'":': 8, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2192178', 'n_tokens_mistral': 2280, 'n_tokens_neox': 2159, 'n_words': 499}