diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 00000000000..3b86deb3abe --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,120 @@ +# This is the Azure Pipelines configuration to create the precompiled release +# archives that are made available at . +# +# To trigger a build, go to and +# start a run of the precompile-release pipeline. +# +# The following pipeline variables are required: +# +# RELEASE_URL: Release archive to build. e.g. "https://rakudo.org/dl/rakudo/rakudo-2020.05.tar.gz" +# VERSION: The version that you are building. e.g. "2020.05" +# REVISION: Usually "01" +# + +trigger: +- none + +jobs: + - job: linux + displayName: Linux x86_64 build + pool: + vmImage: 'ubuntu-18.04' + container: + image: centos:6 + options: "--name raku-build-container -v /usr/bin/docker:/tmp/docker:ro" + workspace: + clean: all + steps: + - script: /tmp/docker exec -t -u 0 raku-build-container sh -c "yum -y update && yum -y install sudo" + displayName: Set up sudo (see https://github.com/microsoft/azure-pipelines-agent/issues/2043) + + - checkout: self + path: source + fetchDepth: 1 + displayName: Checkout repository + + - script: $(Agent.BuildDirectory)/source/tools/build/binary-release/build-linux.sh + failOnStderr: false + displayName: Run build script + + - publish: rakudo-linux.tar.gz + artifact: rakudo-linux + + - job: macos + displayName: MacOS x86_64 build + pool: + vmImage: 'macOS-10.15' + workspace: + clean: all + steps: + - checkout: self + path: source + fetchDepth: 1 + + - script: $(Agent.BuildDirectory)/source/tools/build/binary-release/build-macos.sh + failOnStderr: false + displayName: Run build script + + - publish: rakudo-macos.tar.gz + artifact: rakudo-macos + + - job: windows + displayName: Windows x86_64 build + pool: + vmImage: 'windows-2019' + workspace: + clean: all + steps: + - checkout: self + path: source + fetchDepth: 1 + + # Turn this Powershell console into a developer powershell console. + # https://intellitect.com/enter-vsdevshell-powershell/ + - pwsh: | + $installPath = &"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationpath + $devShell = &"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -latest -find **\Microsoft.VisualStudio.DevShell.dll + Import-Module $devShell + Enter-VsDevShell -VsInstallPath $installPath -SkipAutomaticLocation -DevCmdArguments "-arch=amd64" + $(Agent.BuildDirectory)/source/tools/build/binary-release/build-windows.ps1 + failOnStderr: false + displayName: Run build script + + - publish: rakudo-win.zip + artifact: rakudo-win + + - job: zip + displayName: Package results + dependsOn: + - linux + - macos + - windows + pool: + vmImage: 'ubuntu-18.04' + workspace: + clean: all + steps: + - checkout: none + + - download: current + artifact: rakudo-linux + displayName: Download Linux build artifacts + + - download: current + artifact: rakudo-macos + displayName: Download MacOS build artifacts + + - download: current + artifact: rakudo-win + displayName: Download Windows build artifacts + + - script: | + OUT_DIR=rakudo-builds-$(VERSION)-$(REVISION) + mkdir $OUT_DIR + cp $(Pipeline.Workspace)/rakudo-linux/rakudo-linux.tar.gz $OUT_DIR/rakudo-moar-$(VERSION)-$(REVISION)-linux-x86_64.tar.gz + cp $(Pipeline.Workspace)/rakudo-macos/rakudo-macos.tar.gz $OUT_DIR/rakudo-moar-$(VERSION)-$(REVISION)-linux-x86_64.tar.gz + cp $(Pipeline.Workspace)/rakudo-win/rakudo-win.zip $OUT_DIR/rakudo-moar-$(VERSION)-$(REVISION)-win-x86_64.zip + tar -czf rakudo-moar-builds-$(VERSION)-$(REVISION).tar.gz $OUT_DIR + + - publish: rakudo-moar-builds-$(VERSION)-$(REVISION).tar.gz + artifact: build-result diff --git a/tools/build/binary-release/build-linux.sh b/tools/build/binary-release/build-linux.sh index 40fba1c238b..9044923db59 100755 --- a/tools/build/binary-release/build-linux.sh +++ b/tools/build/binary-release/build-linux.sh @@ -1,40 +1,55 @@ #!/usr/bin/env sh -# This script should be run in a CentOS 6 installation (a container will do -# just fine). +# This script should be allowed to run sudo in a CentOS 6 installation (a +# container will do just fine). +# For some strange reason the environment variables are lost when running this +# script with `sudo` in azure pipelines. So we just do sudo our selves for the +# dependency install part. set -o errexit set -o pipefail -# Update CentOS 6 -yum -y update -yum clean all +echo "========= Starting build" -# Install dependencies -yum -y install curl git perl perl-core gcc make +echo "========= Updating CentOS 6" +sudo yum -y update +sudo yum clean all -# Download release file +echo "========= Downloading dependencies" +sudo yum -y install curl git perl perl-core gcc make + +echo "========= Downloading release" curl -o rakudo.tgz $RELEASE_URL + +echo "========= Extracting release" tar -xzf rakudo.tgz cd rakudo-* -# Build Rakudo +echo "========= Configuring Rakudo (includes building MoarVM and NQP)" perl Configure.pl --gen-moar --gen-nqp --backends=moar --moar-option='--toolchain=gnu' --relocatable + +echo "========= Building Rakudo" make + +echo "========= Installing Rakudo" make install -# Test the build +echo "========= Testing Rakudo" make test -# Build Zef +echo "========= Cloning Zef" git clone https://github.com/ugexe/zef.git + +echo "========= Installing Zef" pushd zef ../install/bin/raku -I. bin/zef install . popd -# Prepare the package +echo "========= Copying auxiliary files" cp -r tools/build/binary-release/Linux/* install cp LICENSE install + +echo "========= Preparing archive" mv install rakudo-$VERSION tar -zcv --owner=0 --group=0 --numeric-owner -f ../rakudo-linux.tar.gz rakudo-$VERSION diff --git a/tools/build/binary-release/build-macos.sh b/tools/build/binary-release/build-macos.sh index e7d4324169b..d973a33c927 100755 --- a/tools/build/binary-release/build-macos.sh +++ b/tools/build/binary-release/build-macos.sh @@ -3,32 +3,44 @@ set -o errexit set -o pipefail -# Install Dependencies +echo "========= Starting build" + +echo "========= Downloading dependencies" brew install perl brew install gnu-tar -# Download release file +echo "========= Downloading release" curl -o rakudo.tgz $RELEASE_URL + +echo "========= Extracting release" tar -xzf rakudo.tgz cd rakudo-* -# Build Rakudo +echo "========= Configuring Rakudo (includes building MoarVM and NQP)" perl Configure.pl --gen-moar --gen-nqp --backends=moar --relocatable + +echo "========= Building Rakudo" make + +echo "========= Installing Rakudo" make install -# Test the build +echo "========= Testing Rakudo" make test -# Build Zef +echo "========= Cloning Zef" git clone https://github.com/ugexe/zef.git + +echo "========= Installing Zef" pushd zef ../install/bin/raku -I. bin/zef install . popd -# Prepare the package +echo "========= Copying auxiliary files" cp -r tools/build/binary-release/MacOS/* install cp LICENSE install + +echo "========= Preparing archive" mv install rakudo-$VERSION gtar -zcv --owner=0 --group=0 --numeric-owner -f ../rakudo-macos.tar.gz rakudo-$VERSION diff --git a/tools/build/binary-release/build-windows.ps1 b/tools/build/binary-release/build-windows.ps1 index 6f79f1760a4..e0dee3392f3 100644 --- a/tools/build/binary-release/build-windows.ps1 +++ b/tools/build/binary-release/build-windows.ps1 @@ -1,10 +1,9 @@ -$ErrorActionPreference = "Stop" +$ErrorActionPreference = "stop" -# Don't display progressbars when doing Invoke-WebRequest and similar. -# That would cause the command to fail, because in the CircleCI environment -# one can't modify the display. -# "Win32 internal error “Access is denied” 0x5 occurred while reading the console output buffer. Contact Microsoft Customer Support Services." -$progressPreference = 'silentlyContinue' +# Make sure Powershell 7 doesn't just silently swallows errors. +# https://david.gardiner.net.au/2020/04/azure-pipelines-powershell-7-errors.html +# https://github.com/microsoft/azure-pipelines-tasks/issues/12799 +$ErrorView = 'NormalView' function CheckLastExitCode { if ($LastExitCode -ne 0) { @@ -18,52 +17,52 @@ Callstack: $(Get-PSCallStack | Out-String) $repoPath = Get-Location -# Install Perl +echo "========= Starting build" +echo "========= Downloading Perl" mkdir download mkdir strawberry Invoke-WebRequest http://strawberryperl.com/download/5.30.0.1/strawberry-perl-5.30.0.1-64bit.zip -OutFile download/strawberry-perl-5.30.0.1-64bit.zip + +echo "========= Extracting Perl" Expand-Archive -Path download/strawberry-perl-5.30.0.1-64bit.zip -DestinationPath strawberry strawberry\relocation.pl.bat $Env:PATH = (Join-Path -Path $repoPath -ChildPath "\strawberry\perl\bin") + ";" + (Join-Path -Path $repoPath -ChildPath "\strawberry\perl\site\bin") + ";" + (Join-Path -Path $repoPath -ChildPath "\strawberry\c\bin") + ";$Env:PATH" - -# Download release file - +echo "========= Downloading release" Invoke-WebRequest $Env:RELEASE_URL -OutFile download/rakudo.tgz + +echo "========= Extracting release" tar -xzf download/rakudo.tgz cd rakudo-* -# Build Rakudo - +echo "========= Configuring Rakudo (includes building MoarVM and NQP)" perl Configure.pl --gen-moar --gen-nqp --backends=moar --moar-option='--toolchain=msvc' --relocatable CheckLastExitCode + +echo "========= Building Rakudo" nmake install CheckLastExitCode - -# Test the build - +echo "========= Testing Rakudo" nmake test CheckLastExitCode - -# Build Zef - +echo "========= Cloning Zef" git clone https://github.com/ugexe/zef.git CheckLastExitCode + +echo "========= Installing Zef" cd zef ..\install\bin\raku.exe -I. bin\zef install . CheckLastExitCode cd .. - -# Prepare the package - +echo "========= Copying auxiliary files" cp -Force -r "tools\build\binary-release\Windows\*" install cp LICENSE install +echo "========= Preparing archive" mv install rakudo-$Env:VERSION - Compress-Archive -Path rakudo-$Env:VERSION -DestinationPath ..\rakudo-win.zip