diff --git a/build/azure-nuget.yml b/build/azure-nuget.yml index e01d66b57d2..9a7378d59d0 100644 --- a/build/azure-nuget.yml +++ b/build/azure-nuget.yml @@ -14,7 +14,69 @@ variables: stages: - stage: Build jobs: + - job: BuildLinux + pool: + name: Azure Pipelines + vmImage: 'ubuntu-18.04' + workspace: + clean: all + + # Note: We only have one distro for now, but this lets others be added more easily in the future. + strategy: + matrix: + centos: + distro: 'centos' + + steps: + - checkout: self + lfs: true + fetchDepth: 1 + + - task: PowerShell@2 + displayName: 'Set ICU Version' + inputs: + targetType: filePath + filePath: './build/scripts/Set-ICUVersion.ps1' + arguments: '-icuVersionFile "$(BUILD.SOURCESDIRECTORY)\version.txt"' + + - task: Docker@2 + displayName: 'Setup Docker Container: $(distro)' + inputs: + command: build + Dockerfile: 'build/dockerfiles/$(distro)/Dockerfile' + arguments: -t ms-icu-container + + - script: | + mkdir /tmp/build-output && docker run --rm -v $(pwd):/src -v /tmp/build-output:/dist ms-icu-container /src/build/scripts/build-icu.sh + displayName: 'Build, test, and make install' + + - script: | + cd /tmp/build-output && ls -Rl + displayName: 'DIAG: ls -Rl' + + - task: PublishBuildArtifacts@1 + displayName: 'Publish Artifacts' + inputs: + PathtoPublish: '/tmp/build-output/icu-binaries.tar.gz' + ArtifactName: 'linux_$(distro).tar.gz' + + # Note: We only copy the .so files with the full version (ex: libicuuc.so.67.1.0.4) + - script: | + mkdir /tmp/icu-binaries + ls -al /tmp/build-output/icu/usr/local/lib/ + cp /tmp/build-output/icu/usr/local/lib/libicudata.so.$(ICUVersion) /tmp/icu-binaries + cp /tmp/build-output/icu/usr/local/lib/libicui18n.so.$(ICUVersion) /tmp/icu-binaries + cp /tmp/build-output/icu/usr/local/lib/libicuuc.so.$(ICUVersion) /tmp/icu-binaries + displayName: 'Copy .so files' + + - task: PublishBuildArtifacts@1 + displayName: 'Publish: binaries' + inputs: + PathtoPublish: '/tmp/icu-binaries' + ArtifactName: 'linux-x64' + - job: BuildWindows + timeoutInMinutes: 30 pool: name: Azure Pipelines vmImage: 'vs2017-win2016' @@ -176,6 +238,7 @@ stages: name: Package ES CodeHub Lab E jobs: - job: CodeSignBits + timeoutInMinutes: 30 workspace: clean: all @@ -257,6 +320,7 @@ stages: jobs: - job: CreateNugetAndCodeSign + timeoutInMinutes: 30 workspace: clean: all steps: @@ -307,6 +371,12 @@ stages: artifactName: 'win-ARM64' downloadPath: '$(Build.BINARIESDIRECTORY)\bits' + - task: DownloadBuildArtifacts@0 + displayName: 'Download linux-x64' + inputs: + artifactName: 'linux-x64' + downloadPath: '$(Build.BINARIESDIRECTORY)\bits' + # Symbols (PDBs) - task: DownloadBuildArtifacts@0 displayName: 'Download symbols-win-x86' diff --git a/build/dockerfiles/centos/Dockerfile b/build/dockerfiles/centos/Dockerfile new file mode 100644 index 00000000000..b936e5c1c4c --- /dev/null +++ b/build/dockerfiles/centos/Dockerfile @@ -0,0 +1,19 @@ +# This uses the DotNet CentOS 7 docker image to build. +# https://github.com/dotnet/dotnet-buildtools-prereqs-docker + +FROM mcr.microsoft.com/dotnet-buildtools/prereqs:centos-7-359e48e-20200313130914 +MAINTAINER Jeff Genovy <29107334+jefgen@users.noreply.github.com> +LABEL com.github.microsoft.icu="centos-7" + +# Remove icu-dev, so it doesn't conflict. +RUN yum -y remove libicu-devel + +# When we run the docker container we will mount the source repo here +VOLUME /src + +# The output from make install will go here +VOLUME /dist + +# Do the actual build in tmp +RUN mkdir /tmp/build +WORKDIR /tmp/build diff --git a/build/nuget/SignConfig-ICU-Nuget.xml b/build/nuget/SignConfig-ICU-Nuget.xml index 0cc2f442e2e..0e58298b4eb 100644 --- a/build/nuget/SignConfig-ICU-Nuget.xml +++ b/build/nuget/SignConfig-ICU-Nuget.xml @@ -8,6 +8,7 @@ + diff --git a/build/scripts/Create-Nuget-Runtime.ps1 b/build/scripts/Create-Nuget-Runtime.ps1 index 6cf5e13af48..e2bc21c2691 100644 --- a/build/scripts/Create-Nuget-Runtime.ps1 +++ b/build/scripts/Create-Nuget-Runtime.ps1 @@ -97,6 +97,8 @@ foreach ($rid in $runtimeIdentifiers) $ret = New-Item -Path "$stagingLocation\runtimes\$rid" -ItemType Directory $ret = New-Item -Path "$stagingLocation\runtimes\$rid\native" -ItemType Directory + $haveSymbols = 0 + if ($rid.StartsWith('win')) { # Compiled DLLs @@ -114,8 +116,13 @@ foreach ($rid in $runtimeIdentifiers) # If we have symbols, also add them to the package location as well. if (Test-Path "$icuSymbols\symbols-$rid" -PathType Container) { Copy-Item "$icuSymbols\symbols-$rid\*.pdb" -Destination $dllOutput -Recurse + $haveSymbols = 1 } } + elseif ($rid.StartsWith('linux')) + { + Copy-Item "$icuBinaries\$rid\*.so*" -Destination "$stagingLocation\runtimes\$rid\native" -Recurse + } # Add the License file Write-Host 'Copying the License file into the Nuget location.' @@ -140,7 +147,10 @@ foreach ($rid in $runtimeIdentifiers) &cmd /c Tree /F /A $stagingLocation # Actually do the "nuget pack" operation - $nugetCmd = ("nuget pack $stagingLocation\$runtimePackageId.nuspec -BasePath $stagingLocation -OutputDirectory $output\package -Symbols -SymbolPackageFormat snupkg") + $nugetCmd = "nuget pack $stagingLocation\$runtimePackageId.nuspec -BasePath $stagingLocation -OutputDirectory $output\package" + if ($haveSymbols) { + $nugetCmd = "$nugetCmd -Symbols -SymbolPackageFormat snupkg" + } Write-Host 'Executing: ' $nugetCmd &cmd /c $nugetCmd } diff --git a/build/scripts/build-icu.sh b/build/scripts/build-icu.sh new file mode 100755 index 00000000000..d174889696a --- /dev/null +++ b/build/scripts/build-icu.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +# echo commands when executing them +set -x + +# Disable color output +export TERM=xterm + +# Number of CPU Cores to use for make +export CPUCORES=$(nproc) + +echo Building in: $(pwd) + +# Configure ICU for building. Skip layout[ex] and samples +/src/icu/icu4c/source/runConfigureICU Linux --disable-layout --disable-layoutex --disable-samples || exit 1 + +# Build, run the tests, then install into DESTDIR. +make -j${CORES} check && make -j${CORES} DESTDIR=/dist/icu releaseDist || exit 1 + +# Test that icuinfo works with the built libs in the installed location +LD_LIBRARY_PATH=/dist/icu/usr/local/lib /dist/icu/usr/local/bin/icuinfo || exit 1 + +# Copy OS Release (name of the distro) if it exists +if [ -f /etc/os-release ]; +then + cat /etc/os-release + cp /etc/os-release /dist/icu +fi + +# Copy the MS-ICU version number +cp /src/version.txt /dist/icu + +# Pack up the binaries into a tarball +cd /dist && tar -czpf icu-binaries.tar.gz -C /dist/icu .