Skip to content
代码片段 群组 项目
ci.yml 15.0 KB
更新 更旧
  • 了解如何忽略特定修订
  • #
    # See https://docs.microsoft.com/en-us/vsts/pipelines/yaml-schema for details on this file.
    #
    
    # Configure which branches trigger builds
    trigger:
      batch: true
      branches:
        include:
        - master
        - release/*
    
    # Run PR validation on all branches
    pr:
    
    variables:
    - name: DOTNET_SKIP_FIRST_TIME_EXPERIENCE
      value: true
    
    
    - template: jobs/default-build.yml
      parameters:
        jobName: Code_check
        jobDisplayName: Code check
        agentOs: Windows
        steps:
        - powershell: ./eng/scripts/CodeCheck.ps1 -ci
          displayName: Run eng/scripts/CodeCheck.ps1
    
    
    # Build Windows (x64/x86)
    - template: jobs/default-build.yml
      parameters:
        codeSign: true
        jobName: Windows_build
        jobDisplayName: "Build: Windows x64/x86"
        agentOs: Windows
    
        - script: "echo ##vso[build.addbuildtag]daily-build"
    
          condition: and(ne(variables['Build.Reason'], 'PullRequest'), notin(variables['DotNetFinalVersionKind'], 'release', 'prerelease'))
    
          displayName: 'Set CI tags'
        - script: "echo ##vso[build.addbuildtag]release-candidate"
    
          condition: and(ne(variables['Build.Reason'], 'PullRequest'), in(variables['DotNetFinalVersionKind'], 'release', 'prerelease'))
    
        # !!! NOTE !!! Some of these steps have disabled code signing.
        # This is intentional to workaround https://github.com/dotnet/arcade/issues/1957 which always re-submits for code-signing, even
        # if they have already been signed. This results in slower builds due to re-submitting the same .nupkg many times for signing.
        # The sign settings have been configured to
    
        - script: ./eng/scripts/cibuild.cmd -BuildNative -arch x64 /p:DisableCodeSigning=true /bl:artifacts/log/build.x64.binlog
    
        # TODO: make it possible to build for one Windows architecture at a time
        # This is going to actually build x86 native assets. See https://github.com/aspnet/AspNetCore/issues/7196
    
    
        # Set DisableSignCheck because we'll run sign check in an explicit step after installers build
    
        - script: ./eng/scripts/cibuild.cmd -arch x86 -NoRestore -BuildNative /t:BuildSharedFx /p:DisableCodeSigning=true /bl:artifacts/log/build.x86.binlog
    
    
        # This is in a separate build step with -forceCoreMsbuild to workaround MAX_PATH limitations - https://github.com/Microsoft/msbuild/issues/53
        - script: ./build.cmd -ci -sign -forceCoreMsbuild /p:DisableCodeSigning=true -projects ./src/SiteExtensions/LoggingAggregate/src/Microsoft.AspNetCore.AzureAppServices.SiteExtension/Microsoft.AspNetCore.AzureAppServices.SiteExtension.csproj
          displayName: Build SiteExtension
    
    
    Justin Kotalik's avatar
    Justin Kotalik 已提交
        # Remove all task build output
        - script: rmdir /s /q build\tasks\bin
          displayName: Clear task build output
    
    
        # This runs code-signing on all packages, zips, and jar files as defined in build/CodeSign.targets. If https://github.com/dotnet/arcade/issues/1957 is resolved,
        # consider running code-signing inline with the other previous steps.
        # Sign check is disabled because it is run in a separate step below, after installers are built.
    
    John Luo's avatar
    John Luo 已提交
        - script: ./build.cmd -ci -sign -NoRestore /t:CodeSign /p:SignType=$(_SignType) /p:DisableSignCheck=true /bl:artifacts/log/build.codesign.binlog
    
        # Windows installers bundle both x86 and x64 assets
    
        - powershell: ./src/Installers/Windows/build.ps1 -ci /p:SignType=$(_SignType)
    
        # Run sign check to verify everything was code signed.
    
    John Luo's avatar
    John Luo 已提交
        - script: ./build.cmd -ci -sign -NoRestore /t:SignCheck /p:SignType=$(_SignType) /bl:artifacts/log/build.signcheck.binlog
    
          displayName: Run sign check
          condition: eq(variables['_SignType'], 'real')
    
        artifacts:
        - name: Windows_Packages
          path: artifacts/packages/
        - name: Windows_VSIX
          path: artifacts/VSSetup/
        - name: Windows_Manifests
          path: artifacts/manifests/
        - name: Windows_Installers
          path: artifacts/installers/
        - name: Windows_Logs
    
    John Luo's avatar
    John Luo 已提交
          path: artifacts/log/
    
    
    # Build Windows ARM
    - template: jobs/default-build.yml
      parameters:
        codeSign: true
        jobName: Windows_arm_build
        jobDisplayName: "Build: Windows ARM"
        agentOs: Windows
    
        buildScript: ./eng/scripts/cibuild.cmd
    
    John Luo's avatar
    John Luo 已提交
        buildArgs: -arch arm -NoBuildNodeJS -NoBuildJava /p:SignType=$(_SignType) /bl:artifacts/log/build.win-arm.binlog
    
        installNodeJs: false
        installJdk: false
    
        afterBuild:
        # Remove packages that are not rid-specific.
        # TODO add a flag so builds only produce runtime packages
    
        - powershell: gci artifacts/packages/ -recurse -exclude 'runtime.*', 'Microsoft.AspNetCore.App.Runtime.*' -file | rm -ea ignore
    
        artifacts:
        - name: Windows_arm_Packages
          path: artifacts/packages/
        - name: Windows_arm_Manifests
          path: artifacts/manifests/
        - name: Windows_arm_Installers
          path: artifacts/installers/
        - name: Windows_arm_Logs
    
    John Luo's avatar
    John Luo 已提交
          path: artifacts/log/
    
    
    # Build MacOS
    - template: jobs/default-build.yml
      parameters:
        jobName: MacOs_x64_build
        jobDisplayName: "Build: macOS"
        agentOs: macOs
        buildScript: ./eng/scripts/cibuild.sh
    
    John Luo's avatar
    John Luo 已提交
        buildArgs: --no-build-nodejs --no-build-java /bl:artifacts/log/build.macos.binlog
    
        afterBuild:
        # Remove packages that are not rid-specific.
        # TODO add a flag so macOS/Linux builds only produce runtime packages
    
        - script: if [ -d 'artifacts/packages' ]; then find artifacts/packages/ -type f -not -name 'runtime.*' -not -name 'Microsoft.AspNetCore.App.Runtime.*' -delete; fi
    
        artifacts:
        - name: MacOS_x64_Packages
          path: artifacts/packages/
        - name: MacOS_x64_Manifests
          path: artifacts/manifests/
        - name: MacOS_x64_Installers
          path: artifacts/installers/
        - name: MacOS_x64_Logs
    
    John Luo's avatar
    John Luo 已提交
          path: artifacts/log/
    
    - template: jobs/codesign-xplat.yml
      parameters:
        inputName: MacOS_x64
    
    # Build Linux x64
    - template: jobs/default-build.yml
      parameters:
        jobName: Linux_x64_build
        jobDisplayName: "Build: Linux x64"
        agentOs: Linux
    
    John Luo's avatar
    John Luo 已提交
        - script: ./eng/scripts/cibuild.sh --arch x64 --no-build-nodejs --no-build-java /bl:artifacts/log/build.lin-x64.binlog
    
          displayName: Run cibuild.sh
        - script: |
            rm -rf .dotnet/
            git clean -xfd src/
            ./dockerbuild.sh bionic \
              --ci --pack --all --no-build-nodejs --no-build-java \
              --arch x64 \
              -e KOREBUILD_SKIP_INSTALL_NETFX=0 \
    
              /t:BuildSharedFx  \
              /p:BuildRuntimeArchive=false \
    
    John Luo's avatar
    John Luo 已提交
              /bl:artifacts/log/build.deb.binlog
    
          displayName: Build Debian installers
        - script: |
            rm -rf .dotnet/
            git clean -xfd src/
            ./dockerbuild.sh rhel \
              --ci --pack --all --no-build-nodejs --no-build-java \
              --arch x64 \
              -e KOREBUILD_SKIP_INSTALL_NETFX=0 \
    
              /t:BuildSharedFx  \
              /p:BuildRuntimeArchive=false \
    
    John Luo's avatar
    John Luo 已提交
              /bl:artifacts/log/build.rpm.binlog
    
          displayName: Build RPM installers
        afterBuild:
        # Remove packages that are not rid-specific.
        # TODO add a flag so macOS/Linux builds only produce runtime packages
    
        - script: if [ -d 'artifacts/packages' ]; then find artifacts/packages/ -type f -not -name 'runtime.*' -not -name 'Microsoft.AspNetCore.App.Runtime.*' -delete; fi
    
        artifacts:
        - name: Linux_x64_Packages
          path: artifacts/packages/
        - name: Linux_x64_Manifests
          path: artifacts/manifests/
        - name: Linux_x64_Installers
          path: artifacts/installers/
        - name: Linux_x64_Logs
    
    John Luo's avatar
    John Luo 已提交
          path: artifacts/log/
    
    - template: jobs/codesign-xplat.yml
      parameters:
        inputName: Linux_x64
    
    # Build Linux ARM
    - template: jobs/default-build.yml
      parameters:
        jobName: Linux_arm_build
        jobDisplayName: "Build: Linux ARM"
        agentOs: Linux
        buildScript: ./eng/scripts/cibuild.sh
    
    John Luo's avatar
    John Luo 已提交
        buildArgs: --arch arm --no-build-nodejs --no-build-java /bl:artifacts/log/build.lin-arm.binlog
    
        afterBuild:
        # Remove packages that are not rid-specific.
        # TODO add a flag so macOS/Linux builds only produce runtime packages
    
        - script: if [ -d 'artifacts/packages' ]; then find artifacts/packages/ -type f -not -name 'runtime.*' -not -name 'Microsoft.AspNetCore.App.Runtime.*' -delete; fi
    
        artifacts:
        - name: Linux_arm_Packages
          path: artifacts/packages/
        - name: Linux_arm_Manifests
          path: artifacts/manifests/
        - name: Linux_arm_Installers
          path: artifacts/installers/
        - name: Linux_arm_Logs
    
    John Luo's avatar
    John Luo 已提交
          path: artifacts/log/
    
    - template: jobs/codesign-xplat.yml
      parameters:
        inputName: Linux_arm
    
    # Build Linux ARM64
    - template: jobs/default-build.yml
      parameters:
        jobName: Linux_arm64_build
        jobDisplayName: "Build: Linux ARM64"
        agentOs: Linux
        buildScript: ./eng/scripts/cibuild.sh
    
    John Luo's avatar
    John Luo 已提交
        buildArgs: --arch arm64 --no-build-nodejs --no-build-java /bl:artifacts/log/build.arm64.binlog
    
        afterBuild:
        # Remove packages that are not rid-specific.
        # TODO add a flag so macOS/Linux builds only produce runtime packages
    
        - script: if [ -d 'artifacts/packages' ]; then find artifacts/packages/ -type f -not -name 'runtime.*' -not -name 'Microsoft.AspNetCore.App.Runtime.*' -delete; fi
    
        artifacts:
        - name: Linux_arm64_Packages
          path: artifacts/packages/
        - name: Linux_arm64_Manifests
          path: artifacts/manifests/
        - name: Linux_arm64_Installers
          path: artifacts/installers/
        - name: Linux_arm64_Logs
    
    John Luo's avatar
    John Luo 已提交
          path: artifacts/log/
    
    - template: jobs/codesign-xplat.yml
      parameters:
        inputName: Linux_arm64
    
    # Build Linux Musl x64
    - template: jobs/default-build.yml
      parameters:
        jobName: Linux_musl_x64_build
        jobDisplayName: "Build: Linux Musl x64"
        agentOs: Linux
        buildScript: ./dockerbuild.sh alpine
    
    John Luo's avatar
    John Luo 已提交
        buildArgs: --ci --pack --all -e KOREBUILD_SKIP_INSTALL_NETFX=0 --arch x64 --os-name linux-musl --no-build-nodejs --no-build-java /bl:artifacts/log/build.musl.binlog
    
        afterBuild:
        # Remove packages that are not rid-specific.
        # TODO add a flag so macOS/Linux builds only produce runtime packages
    
        - script: if [ -d 'artifacts/packages' ]; then find artifacts/packages/ -type f -not -name 'runtime.*' -not -name 'Microsoft.AspNetCore.App.Runtime.*' -delete; fi
    
        artifacts:
        - name: Linux_musl_x64_Packages
          path: artifacts/packages/
        - name: Linux_musl_x64_Manifests
          path: artifacts/manifests/
        - name: Linux_musl_x64_Installers
          path: artifacts/installers/
        - name: Linux_musl_x64_Logs
    
    John Luo's avatar
    John Luo 已提交
          path: artifacts/log/
    
    - template: jobs/codesign-xplat.yml
      parameters:
        inputName: Linux_musl_x64
    
    
    # Build Linux Musl arm64
    - template: jobs/default-build.yml
      parameters:
        jobName: Linux_musl_arm64_build
        jobDisplayName: "Build: Linux Musl ARM64"
        agentOs: Linux
        buildScript: ./dockerbuild.sh ubuntu-alpine37
    
    John Luo's avatar
    John Luo 已提交
        buildArgs: --ci --pack --all -e KOREBUILD_SKIP_INSTALL_NETFX=0 --arch arm64 --os-name linux-musl --no-build-nodejs --no-build-java /bl:artifacts/log/build.musl.binlog
    
        installNodeJs: false
        afterBuild:
        # Remove packages that are not rid-specific.
        # TODO add a flag so macOS/Linux builds only produce runtime packages
        - script: if [ -d 'artifacts/packages' ]; then find artifacts/packages/ -type f -not -name 'runtime.*' -not -name 'Microsoft.AspNetCore.App.Runtime.*' -delete; fi
          condition: always()
        artifacts:
        - name: Linux_musl_arm64_Packages
          path: artifacts/packages/
        - name: Linux_musl_arm64_Manifests
          path: artifacts/manifests/
        - name: Linux_musl_arm64_Installers
          path: artifacts/installers/
        - name: Linux_musl_arm64_Logs
    
    John Luo's avatar
    John Luo 已提交
          path: artifacts/log/
    
          publishOnError: true
    - template: jobs/codesign-xplat.yml
      parameters:
        inputName: Linux_musl_arm64
    
    
        condition: ne(variables['SkipTests'], 'true')
        jobName: Windows_Test
        jobDisplayName: "Test: Windows Server 2016 x64"
    
        agentOs: Windows
    
        buildScript: ./eng/scripts/cibuild.cmd
    
        buildArgs: -test -BuildNative "/p:SkipIISNewHandlerTests=true /p:SkipIISTests=true /p:SkipIISExpressTests=true /p:SkipIISNewShimTests=true /p:RunTemplateTests=false /p:BuildSiteExtensions=false"
    
        - powershell: "& ./src/Servers/IIS/tools/UpdateIISExpressCertificate.ps1; & ./src/Servers/IIS/tools/update_schema.ps1"
    
          displayName: Setup IISExpress test certificates and schema
    
        - powershell: "& ./build.ps1 -CI -NoBuild -Test /p:RunFlakyTests=true"
          displayName: Run Flaky Tests
          continueOnError: true
    
        artifacts:
        - name: Windows_Test_Logs
    
    John Luo's avatar
    John Luo 已提交
          path: artifacts/log/
    
          publishOnError: true
    
    - template: jobs/default-build.yml
      parameters:
        condition: ne(variables['SkipTests'], 'true')
        jobName: Windows_Templates_Test
        jobDisplayName: "Test: Templates - Windows Server 2016 x64"
        agentOs: Windows
    
        buildScript: ./src/ProjectTemplates/build.cmd
    
        buildArgs: -ci -test -NoRestore -NoBuild -NoBuilddeps "/p:RunTemplateTests=true /p:BuildSiteExtensions=false"
    
        beforeBuild:
        - powershell:  ./eng/scripts/cibuild.cmd
          displayName: Build Repo
        artifacts:
        - name: Windows_Test_Templates_Logs
    
    John Luo's avatar
    John Luo 已提交
          path: artifacts/log/
    
    - template: jobs/default-build.yml
    
        condition: ne(variables['SkipTests'], 'true')
        jobName: MacOs_Test
        jobDisplayName: "Test: macOS 10.13"
    
        buildScript: ./eng/scripts/cibuild.sh
    
        beforeBuild:
        - bash: "./eng/scripts/install-nginx-mac.sh"
          displayName: Installing Nginx
    
        afterBuild:
        - bash: ./build.sh --no-build --ci --test -p:RunFlakyTests=true
          displayName: Run Flaky Tests
          continueOnError: true
    
        artifacts:
        - name: MacOS_Test_Logs
    
    John Luo's avatar
    John Luo 已提交
          path: artifacts/log/
    
          publishOnError: true
    
    - template: jobs/default-build.yml
    
        condition: ne(variables['SkipTests'], 'true')
        jobName: Linux_Test
        jobDisplayName: "Test: Ubuntu 16.04 x64"
    
        buildScript: ./eng/scripts/cibuild.sh
    
        beforeBuild:
        - bash: "./eng/scripts/install-nginx-linux.sh"
          displayName: Installing Nginx
    
        - bash: "echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p"
          displayName: Increase inotify limit
    
        afterBuild:
        - bash: ./build.sh --no-build --ci --test -p:RunFlakyTests=true
          displayName: Run Flaky Tests
          continueOnError: true
    
        artifacts:
        - name: Linux_Test_Logs
    
    John Luo's avatar
    John Luo 已提交
          path: artifacts/log/
    
          publishOnError: true