Nuget Package Publishes (#14)

This commit is contained in:
Steve Faulkner 2020-05-29 20:14:09 -05:00 committed by GitHub
parent 5116dee35a
commit f308aeb929
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 61 additions and 212 deletions

View File

@ -29,7 +29,18 @@ jobs:
with:
node-version: 12.x
- run: npm ci
- run: npm run build:ci
- run: npm run build:contracts
- name: Restore Build Cache
uses: actions/cache@v2
with:
path: .cache
key: ${{ runner.os }}-build-cache
- run: npm run pack:prod
- run: npm run copyToConsumers
- uses: actions/upload-artifact@v2
with:
name: dist
path: dist/
endtoend:
name: "End to End Tests"
runs-on: windows-latest
@ -40,6 +51,11 @@ jobs:
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Restore Cypress Binary Cache
uses: actions/cache@v2
with:
path: ~/.cache/Cypress
key: ${{ runner.os }}-cypress-binary-cache
- name: End to End Tests
run: |
npm ci
@ -50,3 +66,47 @@ jobs:
env:
EMULATOR_ENDPOINT: https://0.0.0.0:8081/
NODE_TLS_REJECT_UNAUTHORIZED: 0
CYPRESS_CACHE_FOLDER: ~/.cache/Cypress
nuget:
name: Publish Nuget
needs: [build, test, endtoend]
runs-on: ubuntu-latest
env:
NUGET_SOURCE: ${{ secrets.NUGET_SOURCE }}
AZURE_DEVOPS_PAT: ${{ secrets.AZURE_DEVOPS_PAT }}
steps:
- uses: nuget/setup-nuget@v1
with:
nuget-api-key: ${{ secrets.NUGET_API_KEY }}
- name: Download Dist Folder
uses: actions/download-artifact@v2
with:
name: dist
- run: nuget sources add -Name "ADO" -Source "$NUGET_SOURCE" -UserName "GitHub" -Password "$AZURE_DEVOPS_PAT"
- run: nuget pack -Version "2.0.0-github-${GITHUB_SHA}"
- run: nuget push -Source "$NUGET_SOURCE" -ApiKey Az *.nupkg
- uses: actions/upload-artifact@v2
with:
path: "*.nupkg"
nugetmpac:
name: Publish Nuget MPAC
needs: [build, test, endtoend]
runs-on: ubuntu-latest
env:
NUGET_SOURCE: ${{ secrets.NUGET_SOURCE }}
AZURE_DEVOPS_PAT: ${{ secrets.AZURE_DEVOPS_PAT }}
steps:
- uses: nuget/setup-nuget@v1
with:
nuget-api-key: ${{ secrets.NUGET_API_KEY }}
- name: Download Dist Folder
uses: actions/download-artifact@v2
with:
name: dist
- run: sed -i 's/Azure.Cosmos.DB.Data.Explorer/Azure.Cosmos.DB.Data.Explorer.MPAC/g' DataExplorer.nuspec
- run: nuget sources add -Name "ADO" -Source "$NUGET_SOURCE" -UserName "GitHub" -Password "$AZURE_DEVOPS_PAT"
- run: nuget pack -Version "2.0.0-github-${GITHUB_SHA}"
- run: nuget push -Source "$NUGET_SOURCE" -ApiKey Az *.nupkg
- uses: actions/upload-artifact@v2
with:
path: "*.nupkg"

View File

@ -1,211 +0,0 @@
trigger:
branches:
include:
- master
- "*"
paths:
include:
- "*"
exclude:
- Product/Portal/CapacityCalculator/*
- Product/Portal/DefaultConsistency/*
pool:
vmImage: "windows-latest"
jobs:
- job: FormatLintCompile
displayName: "Format/Lint/Compile"
steps:
- task: Npm@1
displayName: "Install Dependencies"
inputs:
workingDir: 'Product\Portal\DataExplorer'
verbose: false
- task: Npm@1
displayName: "Format"
inputs:
command: custom
workingDir: 'Product\Portal\DataExplorer'
verbose: false
customCommand: "run format:check"
- task: Npm@1
displayName: "Lint"
inputs:
command: custom
workingDir: 'Product\Portal\DataExplorer'
verbose: false
customCommand: "run lint"
- task: Npm@1
displayName: "Compile"
inputs:
command: custom
workingDir: 'Product\Portal\DataExplorer'
verbose: false
customCommand: "run compile"
- task: Npm@1
displayName: "Compile Strict Mode Files"
inputs:
command: custom
workingDir: 'Product\Portal\DataExplorer'
verbose: false
customCommand: "run compile:strict"
- job: EndToEndTests
displayName: "End to End Tests"
steps:
- powershell: |
Write-Host "Starting Comsos DB Emulator"
Start-Process "$env:ProgramFiles\Azure Cosmos DB Emulator\CosmosDB.Emulator.exe" "/NoUI /DisableRateLimiting" -Verb RunAs
displayName: "Start Emulator"
- bash: |
npm ci --prefix ./Product/Portal/DataExplorer
npm start --prefix ./Product/Portal/DataExplorer &
npm ci --prefix ./Product/Portal/DataExplorer/cypress
npm run test:ci --prefix ./Product/Portal/DataExplorer/cypress -- --spec ./integration/dataexplorer/ci-tests/createDatabase.spec.ts
displayName: "Start Server and Run Tests"
env:
EMULATOR_ENDPOINT: https://0.0.0.0:8081/
NODE_TLS_REJECT_UNAUTHORIZED: 0
- task: PublishBuildArtifacts@1
displayName: "Publish Screenshots"
inputs:
targetPath: $(System.DefaultWorkingDirectory)/Product/Portal/DataExplorer/cypress/cypress/screenshots
artifactName: e2e-screenshots
condition: failed()
continueOnError: true
- task: PublishBuildArtifacts@1
displayName: "Publish Videos"
inputs:
pathtoPublish: $(System.DefaultWorkingDirectory)/Product/Portal/DataExplorer/cypress/cypress/videos
artifactName: e2e-videos
condition: succeededOrFailed()
continueOnError: true
- job: UnitTests
displayName: "Unit Tests"
steps:
- task: NodeTool@0
displayName: "Use Node 12.x"
inputs:
versionSpec: 12.x
- task: Npm@1
displayName: "Install Dependencies"
inputs:
command: custom
workingDir: "$(System.DefaultWorkingDirectory)/Product/Portal/DataExplorer"
verbose: false
customCommand: "ci"
- task: Npm@1
displayName: "Run Unit Tests"
inputs:
command: custom
workingDir: "$(System.DefaultWorkingDirectory)/Product/Portal/DataExplorer"
verbose: false
customCommand: "run test"
- task: PublishTestResults@2
displayName: "Publish Test Results"
inputs:
testResultsFormat: VSTest
testResultsFiles: "**/*.trx"
mergeTestResults: true
testRunTitle: "Check-in Tests"
condition: succeededOrFailed()
- task: PublishCodeCoverageResults@1
displayName: "Publish Code Coverage Report"
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: "$(System.DefaultWorkingDirectory)/Product/Portal/DataExplorer/coverage/cobertura-coverage.xml"
pathToSources: "$(System.DefaultWorkingDirectory)/Product/Portal/DataExplorer"
reportDirectory: "$(System.DefaultWorkingDirectory)/Product/Portal/DataExplorer/coverage/html"
- job: Build
steps:
- task: Cache@2
inputs:
key: 'dataexplorer | "$(Agent.OS)" |'
restoreKeys: 'dataexplorer | "$(Agent.OS)" |'
path: $(System.DefaultWorkingDirectory)/Product/Portal/DataExplorer/.cache
displayName: Restore Build Caches
- task: NodeTool@0
displayName: "Use Node 12.x"
inputs:
versionSpec: 12.x
- task: Npm@1
displayName: "Install Dependencies"
inputs:
workingDir: 'Product\Portal\DataExplorer'
verbose: false
- task: Npm@1
displayName: "Build Contracts"
inputs:
command: custom
workingDir: 'Product\Portal\DataExplorer'
verbose: false
customCommand: "run build:contracts"
- task: Npm@1
displayName: "Bundle - Production"
inputs:
command: custom
workingDir: 'Product\Portal\DataExplorer'
verbose: false
customCommand: "run pack:prod"
- task: Npm@1
displayName: "Copy Output Files to Consumers"
inputs:
command: custom
workingDir: 'Product\Portal\DataExplorer'
verbose: false
customCommand: "run copyToConsumers"
- powershell: |
$GitCommitSHA = $env:BUILD_SOURCEVERSION
$NuspecPath = "$env:BUILD_ARTIFACTSTAGINGDIRECTORY"
$VersionToReplace = "0.0.1-preview"
((Get-Content -path "$NuspecPath\DataExplorer.nuspec" -Raw) -replace $VersionToReplace ,("1.2.0-$GitCommitSHA")) | Set-Content -Path "$NuspecPath\DataExplorer.nuspec"
cat "$NuspecPath\DataExplorer.nuspec"
displayName: "Bump Package Version"
continueOnError: true
- task: NuGetCommand@2
displayName: "Create NuGet package"
inputs:
command: pack
packagesToPack: "$(Build.ArtifactStagingDirectory)/**/*.nuspec"
packDestination: '$(Build.ArtifactStagingDirectory)\NuGet'
- task: NuGetCommand@2
displayName: "NuGet push"
inputs:
command: push
publishVstsFeed: "4e0718b3-a885-4d77-b8c2-09bb2f6eecec"
allowPackageConflicts: true
- powershell: |
$NuspecPath = "$env:BUILD_ARTIFACTSTAGINGDIRECTORY"
$PackageId= "Azure.Cosmos.DB.Data.Explorer"
((Get-Content -path "$NuspecPath\DataExplorer.nuspec" -Raw) -replace $PackageId,("$PackageId.MPAC")) | Set-Content -Path "$NuspecPath\DataExplorer.nuspec"
cat "$NuspecPath\DataExplorer.nuspec"
displayName: "Create MPAC nuspec"
continueOnError: true
- task: NuGetCommand@2
displayName: "Create NuGet MPAC package "
inputs:
command: pack
packagesToPack: "$(Build.ArtifactStagingDirectory)/**/*.nuspec"
packDestination: '$(Build.ArtifactStagingDirectory)\NuGet'
- task: NuGetCommand@2
displayName: "NuGet push MPAC"
inputs:
command: push
publishVstsFeed: "4e0718b3-a885-4d77-b8c2-09bb2f6eecec"
allowPackageConflicts: true
- task: PublishBuildArtifacts@1
displayName: "Publish Artifact: DataExplorer NuGet"
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)\NuGet'
ArtifactName: DataExplorerNuGet