diff --git a/.github/workflows/ci-code.yml b/.github/workflows/ci-code.yml new file mode 100644 index 000000000..72d71b4b8 --- /dev/null +++ b/.github/workflows/ci-code.yml @@ -0,0 +1,40 @@ +name: CI - Code + +on: + workflow_dispatch: + pull_request: + paths: + - .github/workflows/ci-code.yml + - src/** + +jobs: + verify_codebase: + name: Verify Codebase + runs-on: ubuntu-latest + steps: + # Checkout code + - name: Checkout Code + uses: actions/checkout@v2 + + # Install .NET + - name: Install .NET + uses: actions/setup-dotnet@v1 + with: + dotnet-version: '6.0.x' # SDK Version to use; x will use the latest version of the 3.1 channel + + # Build Solution + - name: Build Solution + run: dotnet build src/Promitor.sln --configuration release + + # Run Automated Tests + - name: Run Unit Tests + run: dotnet test src/Promitor.Tests.Unit/Promitor.Tests.Unit.csproj --logger "trx;LogFileName=test-results.trx" + + # Provide Unit Test Results + - name: Report Unit Test Results + uses: dorny/test-reporter@v1 + if: success() || failure() + with: + name: .NET Unit Tests + path: src/**/test-results.trx + reporter: dotnet-trx \ No newline at end of file diff --git a/build/azure-devops/agents-ci-discovery.yml b/build/azure-devops/agents-ci-discovery.yml index 949f8975d..1dbba9a2d 100644 --- a/build/azure-devops/agents-ci-discovery.yml +++ b/build/azure-devops/agents-ci-discovery.yml @@ -41,25 +41,6 @@ stages: persistedVariableName: 'Image.Tag' - publish: $(Pipeline.Workspace)/variables artifact: variables -- stage: Build - dependsOn: [Init] - jobs: - - job: Build - displayName: Build Codebase - condition: succeeded() - pool: - vmImage: ubuntu-latest - steps: - - template: templates/build/build-solution.yml - parameters: - dotnetVersion: '$(DotNet.SDK.Version)' - buildConfiguration: '$(DotNet.Configuration)' - targetFolder: '$(Pipeline.Workspace)/build' - - task: PublishPipelineArtifact@0 - displayName: 'Publish Build Pipeline Artifact' - inputs: - targetPath: '$(Pipeline.Workspace)/build' - artifactName: Build - stage: CodeQuality displayName: Code Quality dependsOn: [Init] diff --git a/build/azure-devops/agents-ci-scraper.yml b/build/azure-devops/agents-ci-scraper.yml index 6dc01e575..8cc92ed7c 100644 --- a/build/azure-devops/agents-ci-scraper.yml +++ b/build/azure-devops/agents-ci-scraper.yml @@ -39,25 +39,6 @@ stages: persistedVariableName: 'Image.Tag' - publish: $(Pipeline.Workspace)/variables artifact: variables -- stage: Build - dependsOn: [Init] - jobs: - - job: Build - displayName: Build Codebase - condition: succeeded() - pool: - vmImage: ubuntu-latest - steps: - - template: templates/build/build-solution.yml - parameters: - dotnetVersion: '$(DotNet.SDK.Version)' - buildConfiguration: '$(DotNet.Configuration)' - targetFolder: '$(Pipeline.Workspace)/build' - - task: PublishPipelineArtifact@0 - displayName: 'Publish Build Pipeline Artifact' - inputs: - targetPath: '$(Pipeline.Workspace)/build' - artifactName: Build - stage: CodeQuality displayName: Code Quality dependsOn: [Init] diff --git a/build/azure-devops/templates/build/build-solution.yml b/build/azure-devops/templates/build/build-solution.yml deleted file mode 100644 index c3f3df47b..000000000 --- a/build/azure-devops/templates/build/build-solution.yml +++ /dev/null @@ -1,22 +0,0 @@ -parameters: -- name: dotnetVersion - type: string -- name: buildConfiguration - type: string -- name: targetFolder - type: string - -steps: -- template: install-sdk.yml - parameters: - dotnetVersion: '${{ parameters.dotnetVersion }}' -- task: DotNetCoreCLI@2 - displayName: 'dotnet build' - inputs: - projects: src/Promitor.sln - arguments: '--configuration ${{ parameters.buildConfiguration }}' -- task: CopyFiles@2 - displayName: 'Copy Build Files' - inputs: - contents: 'src/**' - targetFolder: '${{ parameters.targetFolder }}' \ No newline at end of file