Ejemplo n.º 1
0
        public void PowershellWithConditionIndividualStepTest()
        {
            //Arrange
            Conversion conversion = new Conversion();
            string     yaml       = @"
- task: PowerShell@2
  displayName: 'PowerShell test task'
  condition: and(eq('ABCDE', 'BCD'), ne(0, 1))
  inputs:
    targetType: inline
    script: Write-Host 'Hello World'";

            //Act
            ConversionResponse gitHubOutput = conversion.ConvertAzurePipelineTaskToGitHubActionTask(yaml);

            //Assert
            string expected = @"
- name: PowerShell test task
  run: Write-Host 'Hello World'
  shell: powershell
  if: and(eq('ABCDE', 'BCD'),ne(0, 1))
";

            expected = UtilityTests.TrimNewLines(expected);
            Assert.AreEqual(expected, gitHubOutput.actionsYaml);
        }
Ejemplo n.º 2
0
        public void VariablesWithConditionalStatementsTest()
        {
            //Arrange
            string     input      = @"
variables:
  # Agent VM image name
  vmImageName: 'ubuntu-latest'
  
  {{#if reviewApp}}
  # Name of the new namespace being created to deploy the PR changes.
  k8sNamespaceForPR: 'inconditionalstatement'
  {{/if}}";
            Conversion conversion = new Conversion();

            //Act
            ConversionResponse gitHubOutput = conversion.ConvertAzurePipelineToGitHubAction(input);

            //Assert
            string expected = @"
env:
  vmImageName: ubuntu-latest
  k8sNamespaceForPR: inconditionalstatement";

            expected = UtilityTests.TrimNewLines(expected);
            Assert.AreEqual(expected, gitHubOutput.actionsYaml);
        }
Ejemplo n.º 3
0
        public void ParametersReservedWordTest()
        {
            //Arrange
            string input = @"
parameters: # defaults for any parameters that aren't specified
  plainVar: 'ok'
  environment: 'Dev'
  strategy: Dev
  pool: 'Dev'
";

            Conversion conversion = new Conversion();

            //Act
            ConversionResponse gitHubOutput = conversion.ConvertAzurePipelineToGitHubAction(input);

            //Assert
            string expected = @"
env:
  plainVar: ok
  environment2: Dev
  strategy2: Dev
  pool2: Dev
";

            expected = UtilityTests.TrimNewLines(expected);
            Assert.AreEqual(expected, gitHubOutput.actionsYaml);
        }
Ejemplo n.º 4
0
        public void Docker2PushStepTest()
        {
            //Arrange
            Conversion conversion = new Conversion();
            string     yaml       = @"
- task: Docker@2
  displayName: Push image
  inputs:
    containerRegistry: |
      $(dockerHub)
    repository: $(imageName)
    command: push
    tags: |
      test1
      test2
";

            //Act
            ConversionResponse gitHubOutput = conversion.ConvertAzurePipelineTaskToGitHubActionTask(yaml);

            //Assert
            string expected = @"
- name: Push image
  run: docker push ${{ env.dockerHub }} ${{ env.imageName }} --tags test1,test2
";

            expected = UtilityTests.TrimNewLines(expected);
            Assert.AreEqual(expected, gitHubOutput.actionsYaml);
        }
Ejemplo n.º 5
0
        public void SimpleVariablesAndSimpleTriggerTest()
        {
            //Arrange
            string     input      = @"
trigger:
- master
- develop
variables:
  myVariable: myValue
  myVariable2: myValue2";
            Conversion conversion = new Conversion();

            //Act
            ConversionResponse gitHubOutput = conversion.ConvertAzurePipelineToGitHubAction(input);

            //Assert
            string expected = @"
on:
  push:
    branches:
    - master
    - develop
env:
  myVariable: myValue
  myVariable2: myValue2";

            expected = UtilityTests.TrimNewLines(expected);
            Assert.AreEqual(expected, gitHubOutput.actionsYaml);
        }
Ejemplo n.º 6
0
        public void Docker1BuildStepTest()
        {
            //Arrange
            Conversion conversion = new Conversion();
            string     yaml       = @"
  - task: Docker@1
    displayName: 'Build an image'
    inputs:
      azureSubscriptionEndpoint: '$(Azure.ServiceConnectionId)'
      azureContainerRegistry: '$(ACR.FullName)'
      command: build
      dockerFile: '**/Dockerfile'
";

            //Act
            ConversionResponse gitHubOutput = conversion.ConvertAzurePipelineTaskToGitHubActionTask(yaml);

            //Assert
            string expected = @"
- name: Build an image
  run: docker build . --file **/Dockerfile
";

            expected = UtilityTests.TrimNewLines(expected);
            Assert.AreEqual(expected, gitHubOutput.actionsYaml);
        }
Ejemplo n.º 7
0
        public void Docker2BuildStepTest()
        {
            //Arrange
            Conversion conversion = new Conversion();
            string     yaml       = @"
- task: Docker@2
  displayName: Build
  inputs:
    command: build
    repository: contosoRepository
    Dockerfile: app/Dockerfile

";

            //Act
            ConversionResponse gitHubOutput = conversion.ConvertAzurePipelineTaskToGitHubActionTask(yaml);

            //Assert
            string expected = @"
- name: Build
  run: docker build . --file app/Dockerfile contosoRepository
";

            expected = UtilityTests.TrimNewLines(expected);
            Assert.AreEqual(expected, gitHubOutput.actionsYaml);
        }
Ejemplo n.º 8
0
        public void DotNetCoreCLIPackIndividualStepTest()
        {
            //Arrange
            Conversion conversion = new Conversion();
            string     yaml       = @"
- task: DotNetCoreCLI@2
  displayName: 'dotnet pack'
  inputs:
    command: pack
    packagesToPack: MyProject/MyProject.Models/MyProject.Models.csproj
    versioningScheme: byEnvVar
    versionEnvVar: BuildVersion
";

            //Act
            ConversionResponse gitHubOutput = conversion.ConvertAzurePipelineTaskToGitHubActionTask(yaml);

            //Assert
            string expected = @"
- name: dotnet pack
  run: dotnet pack MyProject/MyProject.Models/MyProject.Models.csproj
";

            expected = UtilityTests.TrimNewLines(expected);
            Assert.AreEqual(expected, gitHubOutput.actionsYaml);
        }
Ejemplo n.º 9
0
        public void SwapSlotsIndividualStepTest()
        {
            //Arrange
            Conversion conversion = new Conversion();
            string     yaml       = @"
    - task: AzureAppServiceManage@0
      displayName: 'Swap Slots: website'
      inputs:
        azureSubscription: 'MyProject connection to Azure Portal'
        WebAppName: $(WebsiteName)
        ResourceGroupName: $(ResourceGroupName)
        SourceSlot: 'staging'      
";

            //Act
            ConversionResponse gitHubOutput = conversion.ConvertAzurePipelineTaskToGitHubActionTask(yaml);

            //Assert
            string expected = @"
- name: 'Swap Slots: website'
  uses: Azure/[email protected]
  with:
    inlineScript: az webapp deployment slot swap --resource-group ${{ env.ResourceGroupName }} --name ${{ env.WebsiteName }} --slot staging --target-slot production
";

            expected = UtilityTests.TrimNewLines(expected);
            Assert.AreEqual(expected, gitHubOutput.actionsYaml);
        }
Ejemplo n.º 10
0
        public void DeployFunctionAppContainerIndividualStepTest()
        {
            //Arrange
            Conversion conversion = new Conversion();
            string     yaml       = @"
  - task: AzureFunctionAppContainer@1
    displayName: 'Azure Function App on Container Deploy'
    inputs:
      azureSubscription: '$(AzureServiceConnectionId)'
      appName: $(AppName)
      imageName: '$(ACRFullName)/$(ACRImageName)'
";

            //Act
            ConversionResponse gitHubOutput = conversion.ConvertAzurePipelineTaskToGitHubActionTask(yaml);

            //Assert
            string expected = @"
- name: Azure Function App on Container Deploy
  uses: Azure/webapps-deploy@v2
  with:
    app-name: ${{ env.AppName }}
    images: ${{ env.ACRFullName }}/${{ env.ACRImageName }}
";

            expected = UtilityTests.TrimNewLines(expected);
            Assert.AreEqual(expected, gitHubOutput.actionsYaml);
        }
Ejemplo n.º 11
0
        public void DotNetCoreCLIPublishIndividualStepTest()
        {
            //Arrange
            Conversion conversion = new Conversion();
            string     yaml       = @"
- task: DotNetCoreCLI@2
  displayName: Publish
  inputs:
    command: publish
    publishWebProjects: false
    projects: MyProject/MyProject.Models/MyProject.Models.csproj
    arguments: '--configuration $(BuildConfiguration) --output $(build.artifactstagingdirectory)'
    zipAfterPublish: false
";

            //Act
            ConversionResponse gitHubOutput = conversion.ConvertAzurePipelineTaskToGitHubActionTask(yaml);

            //Assert
            string expected = @"
- name: Publish
  run: dotnet publish MyProject/MyProject.Models/MyProject.Models.csproj --configuration ${{ env.BuildConfiguration }} --output ${GITHUB_WORKSPACE}
";

            expected = UtilityTests.TrimNewLines(expected);
            Assert.AreEqual(expected, gitHubOutput.actionsYaml);
        }
Ejemplo n.º 12
0
        public void DeployWebAppIndividualStepTest()
        {
            //Arrange
            Conversion conversion = new Conversion();
            string     yaml       = @"
    - task: AzureRmWebAppDeployment@3
      displayName: 'Azure App Service Deploy: web site'
      inputs:
        azureSubscription: 'MyProject connection to Azure Portal'
        WebAppName: $(WebsiteName)
        DeployToSlotFlag: true
        ResourceGroupName: $(ResourceGroupName)
        SlotName: 'staging'
        Package: '$(build.artifactstagingdirectory)/drop/MyProject.Web.zip'
        TakeAppOfflineFlag: true
        JSONFiles: '**/appsettings.json'  
";

            //Act
            ConversionResponse gitHubOutput = conversion.ConvertAzurePipelineTaskToGitHubActionTask(yaml);

            //Assert
            string expected = @"
- name: 'Azure App Service Deploy: web site'
  uses: Azure/webapps-deploy@v2
  with:
    app-name: ${{ env.WebsiteName }}
    package: ${GITHUB_WORKSPACE}/drop/MyProject.Web.zip
    slot-name: staging
";

            expected = UtilityTests.TrimNewLines(expected);
            Assert.AreEqual(expected, gitHubOutput.actionsYaml);
        }
Ejemplo n.º 13
0
        public void PublishPipelineArtifactsIndividualStepTest()
        {
            //Arrange
            Conversion conversion = new Conversion();
            string     yaml       = @"
- task: PublishPipelineArtifact@0
  displayName: Store artifact
  inputs:
    artifactName: 'drop'
    targetPath: 'MyProject/bin/release/netcoreapp2.2/publish/'
";

            //Act
            ConversionResponse gitHubOutput = conversion.ConvertAzurePipelineTaskToGitHubActionTask(yaml);

            //Assert
            string expected = @"
- name: Store artifact
  uses: actions/upload-artifact@v2
  with:
    path: MyProject/bin/release/netcoreapp2.2/publish/
    name: drop
";

            expected = UtilityTests.TrimNewLines(expected);
            Assert.AreEqual(expected, gitHubOutput.actionsYaml);
        }
Ejemplo n.º 14
0
        public void AzureWebAppDeploymentIndividualStepTest()
        {
            //Arrange
            Conversion conversion = new Conversion();
            string     yaml       = @"
- task: AzureRmWebAppDeployment@4
  inputs:
    connectionType: 'AzureRM'
    azureSubscription: ""$(azureSubscription)""
    appType: 'functionApp'
    webAppName: ""$(functionappName)""
";

            //Act
            ConversionResponse gitHubOutput = conversion.ConvertAzurePipelineTaskToGitHubActionTask(yaml);

            //Assert
            string expected = @"
- uses: Azure/webapps-deploy@v2
  with:
    app-name: ${{ env.functionappName }}
";

            expected = UtilityTests.TrimNewLines(expected);
            Assert.AreEqual(expected, gitHubOutput.actionsYaml);
        }
Ejemplo n.º 15
0
        public void PoolNameDemandsListStringTest()
        {
            //Arrange
            string input = @"
pool:
  name: Hosted VS2017
  demands: 
  - npm
  - Agent.OS -equals Windows_NT";

            Conversion conversion = new Conversion();

            //Act
            ConversionResponse gitHubOutput = conversion.ConvertAzurePipelineToGitHubAction(input);

            //Assert
            string expected = @"
#Note: GitHub Actions does not have a 'demands' command on 'runs-on' yet
jobs:
  build:
    runs-on: Hosted VS2017";

            expected = UtilityTests.TrimNewLines(expected);
            Assert.AreEqual(expected, gitHubOutput.actionsYaml);
        }
Ejemplo n.º 16
0
        public void SQLAzureDacPacDeployStepTest()
        {
            //Arrange
            Conversion conversion = new Conversion();
            string     yaml       = @"
          - task: SqlAzureDacpacDeployment@1
            displayName: 'Azure SQL dacpac publish'
            inputs:
              azureSubscription: 'my connection to Azure Portal'
              ServerName: '$(databaseServerName).database.windows.net'
              DatabaseName: '$(databaseName)'
              SqlUsername: '******'
              SqlPassword: '******'
              DacpacFile: '$(build.artifactstagingdirectory)/drop/MyDatabase.dacpac'
              additionalArguments: '/p:BlockOnPossibleDataLoss=true'   
";

            //Act
            ConversionResponse gitHubOutput = conversion.ConvertAzurePipelineTaskToGitHubActionTask(yaml);

            //Assert
            string expected = @"
- # ""Note: Connection string needs to be specified - this is different than Pipelines where the server, database, user, and password were specified separately. It's recommended you use secrets for the connection string.""
  name: Azure SQL dacpac publish
  uses: azure/sql-action@v1
  with:
    server-name: ${{ env.databaseServerName }}.database.windows.net
    connection-string: ${{ secrets.AZURE_SQL_CONNECTION_STRING }}
    dacpac-package: ${GITHUB_WORKSPACE}/drop/MyDatabase.dacpac
    arguments: /p:BlockOnPossibleDataLoss=true";

            expected = UtilityTests.TrimNewLines(expected);
            Assert.AreEqual(expected, gitHubOutput.actionsYaml);
        }
Ejemplo n.º 17
0
        public void PoolMultipleInstancesWithDemandsTest()
        {
            //Arrange
            string     input      = @"
pool: 'Pipeline-Demo-Windows'

stages:
- stage: Build
  jobs: 
    - job: BuildSpark
      pool:
        name: 'Pipeline-Demo-Windows'
        demands:
        - Agent.OS -equals Windows_NT
";
            Conversion conversion = new Conversion();

            //Act
            ConversionResponse gitHubOutput = conversion.ConvertAzurePipelineToGitHubAction(input);

            //Assert
            string expected = @"
jobs:
  Build_Stage_BuildSpark:
    runs-on: Pipeline-Demo-Windows";

            expected = UtilityTests.TrimNewLines(expected);
            Assert.AreEqual(expected, gitHubOutput.actionsYaml);
        }
Ejemplo n.º 18
0
        public void AntStepTest()
        {
            //Arrange
            Conversion conversion = new Conversion();
            string     yaml       = @"
- task: Ant@1
  inputs:
    workingDirectory: ''
    buildFile: 'build.xml'
    javaHomeOption: 'JDKVersion'
    jdkVersionOption: '1.8'
    jdkArchitectureOption: 'x64'
    publishJUnitResults: true
    testResultsFiles: '**/TEST-*.xml'  
";

            //Act
            ConversionResponse gitHubOutput = conversion.ConvertAzurePipelineTaskToGitHubActionTask(yaml);

            //Assert
            string expected = @"
- run: ant -noinput -buildfile build.xml
";

            expected = UtilityTests.TrimNewLines(expected);
            Assert.AreEqual(expected, gitHubOutput.actionsYaml);
        }
Ejemplo n.º 19
0
        public void Docker2BuildAndPushStepTest()
        {
            //Arrange
            Conversion conversion = new Conversion();
            string     yaml       = @"
- task: Docker@2
  displayName: Build and Push
  inputs:
    command: buildAndPush
    containerRegistry: dockerRegistryServiceConnection1
    repository: contosoRepository
    tags: |
      tag1
      tag2
";

            //Act
            ConversionResponse gitHubOutput = conversion.ConvertAzurePipelineTaskToGitHubActionTask(yaml);

            //Assert
            string expected = @"
- # 'Note: No conversion path currently exists for build-push (does it need two tasks in GitHub?)'
  name: Build and Push
  run: docker build-push . dockerRegistryServiceConnection1 contosoRepository --tags tag1,tag2
";

            expected = UtilityTests.TrimNewLines(expected);
            Assert.AreEqual(expected, gitHubOutput.actionsYaml);
        }
Ejemplo n.º 20
0
        public void ArmTemplateDeploymentStepTest()
        {
            //Arrange
            Conversion conversion = new Conversion();
            string     yaml       = @"
  - task: AzureResourceGroupDeployment@2
    displayName: 'Deploy ARM Template to resource group'
    inputs:
      azureSubscription: 'connection to Azure Portal'
      resourceGroupName: $(ResourceGroupName)
      location: '[resourceGroup().location]'
      csmFile: '$(build.artifactstagingdirectory)/drop/ARMTemplates/azuredeploy.json'
      csmParametersFile: '$(build.artifactstagingdirectory)/drop/ARMTemplates/azuredeploy.parameters.json'
      overrideParameters: '-environment $(AppSettings.Environment) -locationShort $(ArmTemplateResourceGroupLocation)' 
";

            //Act
            ConversionResponse gitHubOutput = conversion.ConvertAzurePipelineTaskToGitHubActionTask(yaml);

            //Assert
            string expected = @"
- name: Deploy ARM Template to resource group
  uses: Azure/[email protected]
  with:
    inlineScript: az deployment group create --resource-group ${{ env.ResourceGroupName }} --template-file ${GITHUB_WORKSPACE}/drop/ARMTemplates/azuredeploy.json --parameters  ${GITHUB_WORKSPACE}/drop/ARMTemplates/azuredeploy.parameters.json -environment ${{ env.AppSettings.Environment }} -locationShort ${{ env.ArmTemplateResourceGroupLocation }}
";

            expected = UtilityTests.TrimNewLines(expected);
            Assert.AreEqual(expected, gitHubOutput.actionsYaml);
        }
Ejemplo n.º 21
0
        public void Docker1PushStepTest()
        {
            //Arrange
            Conversion conversion = new Conversion();
            string     yaml       = @"
  - task: Docker@1
    displayName: 'Push an image'
    inputs:
      azureSubscriptionEndpoint: '$(Azure.ServiceConnectionId)'
      azureContainerRegistry: '$(ACR.FullName)'
      imageName: '$(ACR.ImageName)'
      command: push
        ";

            //Act
            ConversionResponse gitHubOutput = conversion.ConvertAzurePipelineTaskToGitHubActionTask(yaml);

            //Assert
            string expected = @"
- name: Push an image
  run: docker push ${{ env.ACR.ImageName }}
";

            expected = UtilityTests.TrimNewLines(expected);
            Assert.AreEqual(expected, gitHubOutput.actionsYaml);
        }
Ejemplo n.º 22
0
        public void NPMToBuildAngularStepTest()
        {
            //Arrange
            Conversion conversion = new Conversion();
            string     yaml       = @"
- task: Npm@1
  displayName: 'Build Angular'
  inputs:
    command: custom
    customCommand: run build -- --prod
    workingDir: src/angular7
";

            //Act
            ConversionResponse gitHubOutput = conversion.ConvertAzurePipelineTaskToGitHubActionTask(yaml);

            //Assert
            string expected = @"
- name: Build Angular
  run: npm run build -- --prod src/angular7
";

            expected = UtilityTests.TrimNewLines(expected);
            Assert.AreEqual(expected, gitHubOutput.actionsYaml);
        }
Ejemplo n.º 23
0
        public void ComplexVariablesTest()
        {
            //Arrange
            string     input      = @"
variables:
- name: myVariable
  value: myValue
- name: myVariable2
  value: myValue2
- group: myVariablegroup
";
            Conversion conversion = new Conversion();

            //Act
            ConversionResponse gitHubOutput = conversion.ConvertAzurePipelineToGitHubAction(input);

            //Assert
            string expected = @"
env:
  myVariable: myValue
  myVariable2: myValue2
  group: myVariablegroup";

            expected = UtilityTests.TrimNewLines(expected);
            Assert.AreEqual(expected, gitHubOutput.actionsYaml);
        }
Ejemplo n.º 24
0
        public void TimeoutAndContinueOnErrorStepTest()
        {
            //Arrange
            Conversion conversion = new Conversion();
            string     yaml       = @"
- task: CmdLine@2
  inputs:
    script: echo your commands here 
  continueOnError: true
  timeoutInMinutes: 12
";

            //Act
            ConversionResponse gitHubOutput = conversion.ConvertAzurePipelineTaskToGitHubActionTask(yaml);

            //Assert
            string expected = @"
- run: echo your commands here
  shell: cmd
  continue-on-error: true
  timeout-minutes: 12
";

            expected = UtilityTests.TrimNewLines(expected);
            Assert.AreEqual(expected, gitHubOutput.actionsYaml);
        }
Ejemplo n.º 25
0
        public void VariableInsertationTest()
        {
            //Arrange
            string     input      = @"
variables:
  ${{ if ne(variables['Build.SourceBranchName'], 'master') }}:
    prId: ""$(System.PullRequest.PullRequestId)""
  ${{ if eq(variables['Build.SourceBranchName'], 'master') }}:
    prId: '000'
  prName: ""PR$(prId)""
";
            Conversion conversion = new Conversion();

            //Act
            ConversionResponse gitHubOutput = conversion.ConvertAzurePipelineToGitHubAction(input);

            //Assert
            string expected = @"
env:
  prId: 000
  prName: PR${{ env.prId }}
";

            expected = UtilityTests.TrimNewLines(expected);
            Assert.AreEqual(expected, gitHubOutput.actionsYaml);
        }
        public void SimpleJobTest()
        {
            //Arrange
            Conversion conversion = new Conversion();
            string     yaml       = @"
jobs:
- job: Build
  displayName: 'Build job'
  pool:
    vmImage: 'windows-latest'
  steps:
  - task: CmdLine@2
    inputs:
      script: echo your commands here 
";

            //Act
            ConversionResponse gitHubOutput = conversion.ConvertAzurePipelineToGitHubAction(yaml);

            //Assert
            string expected = @"
jobs:
  Build:
    name: Build job
    runs-on: windows-latest
    steps:
    - uses: actions/checkout@v2
    - run: echo your commands here
      shell: cmd
";

            expected = UtilityTests.TrimNewLines(expected);
            Assert.AreEqual(expected, gitHubOutput.actionsYaml);
            Assert.AreEqual(true, gitHubOutput.v2ConversionSuccessful);
        }
Ejemplo n.º 27
0
        public void VariablesWithConditionalStatementsVariationTest()
        {
            //Arrange
            string     input      = @"
  variables:
    ${{ if ne(variables['Build.SourceBranchName'], 'master') }}:
      prId: '00A'
    ${{ if eq(variables['Build.SourceBranchName'], 'master') }}:
      prId: '00B'
    prUC: '002'
    prLC: '003'";
            Conversion conversion = new Conversion();

            //Act
            ConversionResponse gitHubOutput = conversion.ConvertAzurePipelineToGitHubAction(input);

            //Assert
            string expected = @"
env:
  prId: 00B
  prUC: 002
  prLC: 003";

            expected = UtilityTests.TrimNewLines(expected);
            Assert.AreEqual(expected, gitHubOutput.actionsYaml);
        }
Ejemplo n.º 28
0
        public void ScheduleTriggerTest()
        {
            //Arrange
            string     input      = @"
schedules:
- cron: '0 0 * **'
  displayName: Test schedule
  branches:
    include: [ master ] 
    exclude: 
    - 'features/experimental/*'
  always: true";
            Conversion conversion = new Conversion();

            //Act
            ConversionResponse gitHubOutput = conversion.ConvertAzurePipelineToGitHubAction(input);

            //Assert
            string expected = @"
on:
  schedule:
  - cron: '0 0 * **'
";

            expected = UtilityTests.TrimNewLines(expected);
            Assert.AreEqual(expected, gitHubOutput.actionsYaml);
        }
Ejemplo n.º 29
0
        public void TemplatesCallingYamlTest()
        {
            //Arrange
            string     input      = @"
jobs:
- template: azure-pipelines-build-template.yml
  parameters:
    buildConfiguration: 'Release'
    buildPlatform: 'Any CPU'
    vmImage: windows-latest";
            Conversion conversion = new Conversion();

            //Act
            ConversionResponse gitHubOutput = conversion.ConvertAzurePipelineToGitHubAction(input);

            //Assert
            string expected = @"
#Note: Azure DevOps template does not have an equivalent in GitHub Actions yet
jobs:
  job_1_template:
    # 'Note: Azure DevOps template does not have an equivalent in GitHub Actions yet'
    steps:
    - uses: actions/checkout@v2";

            expected = UtilityTests.TrimNewLines(expected);
            Assert.AreEqual(expected, gitHubOutput.actionsYaml);
        }
Ejemplo n.º 30
0
        public void PowershellWithFileIndividualStepTest()
        {
            //Arrange
            Conversion conversion = new Conversion();
            string     yaml       = @"
    - task: PowerShell@2
      displayName: 'PowerShell test task'
      inputs:
        targetType: FilePath
        filePath: MyProject/BuildVersion.ps1
        arguments: -ProjectFile ""MyProject/MyProject.Web/MyProject.Web.csproj""
";

            //Act
            ConversionResponse gitHubOutput = conversion.ConvertAzurePipelineTaskToGitHubActionTask(yaml);

            //Assert
            string expected = @"
- name: PowerShell test task
  run: MyProject/BuildVersion.ps1 -ProjectFile ""MyProject/MyProject.Web/MyProject.Web.csproj""
  shell: powershell
";

            expected = UtilityTests.TrimNewLines(expected);
            Assert.AreEqual(expected, gitHubOutput.actionsYaml);
        }