From a2525b3f946f4850ac19776a89ad95a91a877758 Mon Sep 17 00:00:00 2001 From: John Heusinger Date: Mon, 29 May 2023 14:35:00 +0200 Subject: [PATCH] Add GitHub Actions workflow --- .github/workflows/build_and_test.yml | 218 +++++++++++++++++++++++++++ 1 file changed, 218 insertions(+) create mode 100644 .github/workflows/build_and_test.yml diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml new file mode 100644 index 00000000..60dbd97e --- /dev/null +++ b/.github/workflows/build_and_test.yml @@ -0,0 +1,218 @@ +on: + pull_request: + branches: + - master + workflow_dispatch: + +jobs: + build_module: + runs-on: windows-latest + steps: + - uses: actions/checkout@v3 + - name: Build Module + run: | + ./Tools/setup.ps1 + Invoke-Build -Task ShowInfo + + + + + + +resources: + - repo: self + clean: true + + trigger: + branches: + include: + - master + - "*" + exclude: + - refs/tag/* + + phases: + - phase: Phase_1 + displayName: Build Module + + condition: succeeded() + queue: + name: Hosted VS2017 + + steps: + - powershell: | + . ./Tools/setup.ps1 + Invoke-Build -Task ShowInfo + displayName: Setup + + - powershell: 'Invoke-Build -Task Clean, Build' + displayName: Build + + - task: PublishBuildArtifacts@1 + displayName: 'Publish Artifact: Built Module' + inputs: + PathtoPublish: Release + ArtifactName: Release + + + - phase: Phase_2 + displayName: Test Module on Windows (PSv5) + + dependsOn: Phase_1 + condition: succeeded() + queue: + name: Hosted VS2017 + + steps: + - task: DownloadBuildArtifacts@0 + displayName: 'Download Build Artifacts' + inputs: + artifactName: Release + downloadPath: '$(Build.SourcesDirectory)' + + - powershell: | + . ./Tools/setup.ps1 + Invoke-Build -Task ShowInfo + displayName: Setup + + - powershell: 'Invoke-Build -Task Test' + displayName: Test + + - task: PublishTestResults@2 + displayName: 'Publish Test Results **/Test*.xml' + inputs: + testRunner: NUnit + testResultsFiles: '**/Test*.xml' + condition: succeededOrFailed() + + + - phase: Phase_3 + displayName: Test Module on Ubuntu + + dependsOn: Phase_1 + condition: succeeded() + queue: + name: Hosted Ubuntu 1604 + + steps: + - task: DownloadBuildArtifacts@0 + displayName: 'Download Build Artifacts' + inputs: + artifactName: Release + downloadPath: '$(Build.SourcesDirectory)' + + + - powershell: | + . ./Tools/setup.ps1 + Invoke-Build -Task ShowInfo + displayName: Setup + + - powershell: 'Invoke-Build -Task Test' + displayName: Test + + - task: PublishTestResults@2 + displayName: 'Publish Test Results **/Test*.xml' + inputs: + testRunner: NUnit + testResultsFiles: '**/Test*.xml' + condition: succeededOrFailed() + + + - phase: Phase_4 + displayName: Test Module on macOS + + dependsOn: Phase_1 + condition: succeeded() + queue: + name: Hosted macOS + + steps: + - task: DownloadBuildArtifacts@0 + displayName: 'Download Build Artifacts' + inputs: + artifactName: Release + downloadPath: '$(Build.SourcesDirectory)' + + - powershell: | + . ./Tools/setup.ps1 + Invoke-Build -Task ShowInfo + displayName: Setup + + - powershell: 'Invoke-Build -Task Test' + displayName: Test + + - task: PublishTestResults@2 + displayName: 'Publish Test Results **/Test*.xml' + inputs: + testRunner: NUnit + testResultsFiles: '**/Test*.xml' + condition: succeededOrFailed() + + + # Waiting for the agent to support pwsh: + # https://github.com/Microsoft/azure-pipelines-image-generation/issues/232 + # - phase: Phase_5 + # displayName: Test Module on Windows (PSv6) + + # dependsOn: Phase_1 + # condition: succeeded() + # queue: + # name: Hosted VS2017 + + # steps: + # - task: DownloadBuildArtifacts@0 + # displayName: 'Download Build Artifacts' + # inputs: + # artifactName: Release + # downloadPath: '$(Build.SourcesDirectory)' + + # - powershell: | + # . ./Tools/setup.ps1 + # Invoke-Build -Task ShowInfo + # displayName: Setup + # pwsh: true + + # - powershell: 'Invoke-Build -Task Test' + # displayName: Test + # pwsh: true + + # - task: PublishTestResults@2 + # displayName: 'Publish Test Results **/Test-*.xml' + # inputs: + # testRunner: NUnit + # testResultsFiles: '**/Test*.xml' + # condition: succeededOrFailed() + + - phase: Phase_6 + displayName: Test Module against Cloud Server + + dependsOn: Phase_1 + condition: succeeded() + queue: + name: Hosted VS2017 + + steps: + - task: DownloadBuildArtifacts@0 + displayName: 'Download Build Artifacts' + inputs: + artifactName: Release + downloadPath: '$(Build.SourcesDirectory)' + + - powershell: | + . ./Tools/setup.ps1 + Invoke-Build -Task ShowInfo + displayName: Setup + + - powershell: 'Invoke-Build -Task Test -Tag "Integration" -ExcludeTag ""' + env: + JiraURI: JiraURI + JiraUser: JiraUser + JiraPass: JiraPass + displayName: Test + + - task: PublishTestResults@2 + displayName: 'Publish Test Results **/Test*.xml' + inputs: + testRunner: NUnit + testResultsFiles: '**/Test*.xml' + condition: succeededOrFailed()