authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-02-09 18:26:56-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-02-09 18:26:56-07:00
log44b5fdf3266f11607313bc9990a876b5a7f9e174
treeb1ba8a1d90a712ac5b7fdedfa15e317779b03625
parent274b9d5c1d01c9549f2f12e76654a850df94a057

Revert "ci: azure: split build-and-test step"

This reverts commit 846eb701821a3f2af514bbad770478e3276b2d89. This did not properly translate the upload portion of the CI script to powershell which broke our CI pipeline.

5 files changed, 120 insertions(+), 120 deletions(-)

CMakeLists.txt+1-1
......@@ -63,7 +63,7 @@ if("${ZIG_VERSION}" STREQUAL "")
6363 endif()
6464 endif()
6565endif()
66message(STATUS "Configuring zig version ${ZIG_VERSION}")
66message("Configuring zig version ${ZIG_VERSION}")
6767
6868set(ZIG_STATIC off CACHE BOOL "Attempt to build a static zig executable (not compatible with glibc)")
6969set(ZIG_STATIC_LLVM off CACHE BOOL "Prefer linking against static LLVM libraries")
ci/azure/pipelines.yml+18-119
......@@ -10,7 +10,6 @@ jobs:
1010 - script: ci/azure/macos_script
1111 name: main
1212 displayName: 'Build and test'
13
1413- job: BuildMacOS_arm64
1514 pool:
1615 vmImage: 'macOS-10.15'
......@@ -22,130 +21,30 @@ jobs:
2221 - script: ci/azure/macos_arm64_script
2322 name: main
2423 displayName: 'Build'
25
2624- job: BuildWindows
27 timeoutInMinutes: 360
2825 pool:
2926 vmImage: 'windows-2019'
30 variables:
31 LLVM_CLANG_LLD_URL: 'https://ziglang.org/deps/llvm+clang+lld-13.0.0-x86_64-windows-msvc-release-mt.tar.xz'
32 LLVM_CLANG_LLD_DIR: 'llvm+clang+lld-13.0.0-x86_64-windows-msvc-release-mt'
27 timeoutInMinutes: 360
3328 steps:
34 - pwsh: |
35 (New-Object Net.WebClient).DownloadFile("$(LLVM_CLANG_LLD_URL)", "${LLVM_CLANG_LLD_DIR}.tar.xz")
36 & 'C:\Program Files\7-Zip\7z.exe' x "${LLVM_CLANG_LLD_DIR}.tar.xz"
37 & 'C:\Program Files\7-Zip\7z.exe' x "${LLVM_CLANG_LLD_DIR}.tar"
38 name: install
39 displayName: 'Install LLVM/CLANG/LLD'
40
41 - pwsh: |
42 Set-Variable -Name ZIGBUILDDIR -Value "$(Get-Location)\build"
43 Set-Variable -Name ZIGINSTALLDIR -Value "$ZIGBUILDDIR\dist"
44 Set-Variable -Name ZIGPREFIXPATH -Value "$(Get-Location)\$(LLVM_CLANG_LLD_DIR)"
45
46 # Make the `zig version` number consistent.
47 # This will affect the cmake command below.
48 git config core.abbrev 9
49 git fetch --tags
50
51 mkdir $ZIGBUILDDIR
52 cd $ZIGBUILDDIR
53 & "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
54 cmake .. `
55 -Thost=x64 `
56 -G "Visual Studio 16 2019" `
57 -A x64 `
58 -DCMAKE_INSTALL_PREFIX="$ZIGINSTALLDIR" `
59 -DCMAKE_PREFIX_PATH="$ZIGPREFIXPATH" `
60 -DCMAKE_BUILD_TYPE=Release `
61 -DZIG_OMIT_STAGE2=ON 2> out-null
62 & "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe" `
63 /maxcpucount /p:Configuration=Release INSTALL.vcxproj
64 name: build
65 displayName: 'Build'
66
67 - pwsh: |
68 Set-Variable -Name ZIGINSTALLDIR -Value "$(Get-Location)\build\dist"
69
70 # Sadly, stage2 is omitted from this build to save memory on the CI server. Once self-hosted is
71 # built with itself and does not gobble as much memory, we can enable these tests.
72 #& "$ZIGINSTALLDIR\bin\zig.exe" test "..\test\behavior.zig" -fno-stage1 -fLLVM -I "..\test" 2>&1
73
74 & "$ZIGINSTALLDIR\bin\zig.exe" build test-toolchain -Dskip-non-native -Dskip-stage2-tests 2>&1
75 & "$ZIGINSTALLDIR\bin\zig.exe" build test-std -Dskip-non-native 2>&1
76 name: test
77 displayName: 'Test'
78
79 - pwsh: |
80 Set-Variable -Name ZIGINSTALLDIR -Value "$(Get-Location)\build\dist"
81
82 & "$ZIGINSTALLDIR\bin\zig.exe" build docs
83 timeoutInMinutes: 60
84 name: doc
85 displayName: 'Documentation'
86
29 - powershell: |
30 (New-Object Net.WebClient).DownloadFile("https://github.com/msys2/msys2-installer/releases/download/2022-01-28/msys2-base-x86_64-20220128.sfx.exe", "sfx.exe")
31 .\sfx.exe -y -o\
32 displayName: Download/Extract/Install MSYS2
33 - script: |
34 @REM install updated filesystem package first without dependency checking
35 @REM because of: https://github.com/msys2/MSYS2-packages/issues/2021
36 %CD:~0,2%\msys64\usr\bin\bash -lc "pacman --noconfirm -Sydd filesystem"
37 displayName: Workaround filesystem dash MSYS2 dependency issue
38 - script: |
39 %CD:~0,2%\msys64\usr\bin\bash -lc "pacman --noconfirm -Syuu"
40 %CD:~0,2%\msys64\usr\bin\bash -lc "pacman --noconfirm -Syuu"
41 displayName: Update MSYS2
8742 - task: DownloadSecureFile@1
8843 inputs:
89 name: aws_credentials
90 secureFile: aws_credentials
91
92 - pwsh: |
93 Set-Variable -Name ZIGBUILDDIR -Value "$(Get-Location)\build"
94 $Env:AWS_SHARED_CREDENTIALS_FILE = "$Env:DOWNLOADSECUREFILE_SECUREFILEPATH"
95
96 # Workaround Azure networking issue
97 # https://github.com/aws/aws-cli/issues/5749
98 $Env:AWS_EC2_METADATA_DISABLED = "true"
99 $Env:AWS_REGION = "us-west-2"
100
101 cd "$ZIGBUILDDIR"
102 mv ../LICENSE dist/
103 mv ../zig-cache/langref.html dist/
104 mv dist/bin/zig.exe dist/
105 rmdir dist/bin
106
107 # Remove the unnecessary zig dir in $prefix/lib/zig/std/std.zig
108 mv dist/lib/zig dist/lib2
109 rmdir dist/lib
110 mv dist/lib2 dist/lib
111
112 Set-Variable -Name VERSION -Value $(./dist/zig.exe version)
113 Set-Variable -Name DIRNAME -Value "zig-windows-x86_64-$VERSION"
114 Set-Variable -Name TARBALL -Value "$DIRNAME.zip"
115 mv dist "$DIRNAME"
116 7z a "$TARBALL" "$DIRNAME"
117
118 aws s3 cp `
119 "$TARBALL" `
120 s3://ziglang.org/builds/ `
121 --cache-control 'public, max-age=31536000, immutable'
122
123 Set-Variable -Name SHASUM -Value (Get-FileHash "$TARBALL" -Algorithm SHA256 | select-object -ExpandProperty Hash)
124 Set-Variable -Name BYTESIZE -Value (Get-Item "$TARBALL").length
125
126 Set-Variable -Name JSONFILE -Value "windows-${Env:BUILD_SOURCEBRANCHNAME}.json"
127 echo $null > $JSONFILE
128 echo ('{"tarball": "' + $TARBALL + '",') >> $JSONFILE
129 echo ('"shasum": "' + $SHASUM + '",') >> $JSONFILE
130 echo ('"size": ' + $BYTESIZE + '}' ) >> $JSONFILE
131
132 aws s3 cp `
133 "$JSONFILE" `
134 s3://ziglang.org/builds/ `
135 --cache-control 'max-age=0, must-revalidate'
136
137 aws s3 cp `
138 "$JSONFILE" `
139 "s3://ziglang.org/builds/x86_64-windows-${VERSION}.json"
140
141 echo "##vso[task.setvariable variable=tarball;isOutput=true]$TARBALL"
142 echo "##vso[task.setvariable variable=shasum;isOutput=true]$SHASUM"
143 echo "##vso[task.setvariable variable=bytesize;isOutput=true]$BYTESIZE"
144
145 name: upload
146 condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
147 displayName: 'Upload'
148
44 secureFile: s3cfg
45 - script: ci/azure/windows_msvc_script.bat
46 name: main
47 displayName: 'Build and test'
14948- job: OnMasterSuccess
15049 dependsOn:
15150 - BuildMacOS
ci/azure/windows_msvc_install created+16
......@@ -0,0 +1,16 @@
1#!/bin/sh
2
3set -x
4set -e
5
6pacman -Suy --needed --noconfirm
7pacman -S --needed --noconfirm wget p7zip python3-pip tar xz
8
9TARBALL="llvm+clang+lld-13.0.0-x86_64-windows-msvc-release-mt.tar.xz"
10
11pip install s3cmd
12wget -nv "https://ziglang.org/deps/$TARBALL"
13# If the first extraction fails, re-try it once; this can happen if the tarball
14# contains symlinks that are in the table of contents before the files that
15# they point to.
16tar -xf $TARBALL || tar --overwrite -xf $TARBALL
ci/azure/windows_msvc_script.bat created+39
......@@ -0,0 +1,39 @@
1@echo on
2SET "SRCROOT=%cd%"
3SET "PREVPATH=%PATH%"
4SET "PREVMSYSTEM=%MSYSTEM%"
5
6set "PATH=%CD:~0,2%\msys64\usr\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem"
7SET "MSYSTEM=MINGW64"
8bash -lc "cd ${SRCROOT} && ci/azure/windows_msvc_install" || exit /b
9SET "PATH=%PREVPATH%"
10SET "MSYSTEM=%PREVMSYSTEM%"
11
12SET "ZIGBUILDDIR=%SRCROOT%\build"
13SET "ZIGINSTALLDIR=%ZIGBUILDDIR%\dist"
14SET "ZIGPREFIXPATH=%SRCROOT%\llvm+clang+lld-13.0.0-x86_64-windows-msvc-release-mt"
15
16call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
17
18REM Make the `zig version` number consistent.
19REM This will affect the cmake command below.
20git.exe config core.abbrev 9
21git.exe fetch --unshallow
22git.exe fetch --tags
23
24mkdir %ZIGBUILDDIR%
25cd %ZIGBUILDDIR%
26cmake.exe .. -Thost=x64 -G"Visual Studio 16 2019" -A x64 "-DCMAKE_INSTALL_PREFIX=%ZIGINSTALLDIR%" "-DCMAKE_PREFIX_PATH=%ZIGPREFIXPATH%" -DCMAKE_BUILD_TYPE=Release -DZIG_OMIT_STAGE2=ON || exit /b
27msbuild /maxcpucount /p:Configuration=Release INSTALL.vcxproj || exit /b
28
29REM Sadly, stage2 is omitted from this build to save memory on the CI server. Once self-hosted is
30REM built with itself and does not gobble as much memory, we can enable these tests.
31REM "%ZIGINSTALLDIR%\bin\zig.exe" test "..\test\behavior.zig" -fno-stage1 -fLLVM -I "..\test" || exit /b
32
33"%ZIGINSTALLDIR%\bin\zig.exe" build test-toolchain -Dskip-non-native -Dskip-stage2-tests || exit /b
34"%ZIGINSTALLDIR%\bin\zig.exe" build test-std -Dskip-non-native || exit /b
35"%ZIGINSTALLDIR%\bin\zig.exe" build docs || exit /b
36
37set "PATH=%CD:~0,2%\msys64\usr\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem"
38SET "MSYSTEM=MINGW64"
39bash -lc "cd ${SRCROOT} && ci/azure/windows_upload" || exit /b
ci/azure/windows_upload created+46
......@@ -0,0 +1,46 @@
1#!/bin/sh
2
3set -x
4set -e
5
6if [ "${BUILD_REASON}" != "PullRequest" ]; then
7 cd "$ZIGBUILDDIR"
8
9 mv ../LICENSE dist/
10 mv ../zig-cache/langref.html dist/
11 mv dist/bin/zig.exe dist/
12 rmdir dist/bin
13
14 # Remove the unnecessary zig dir in $prefix/lib/zig/std/std.zig
15 mv dist/lib/zig dist/lib2
16 rmdir dist/lib
17 mv dist/lib2 dist/lib
18
19 VERSION=$(dist/zig.exe version)
20 DIRNAME="zig-windows-x86_64-$VERSION"
21 TARBALL="$DIRNAME.zip"
22 mv dist "$DIRNAME"
23 7z a "$TARBALL" "$DIRNAME"
24
25 # mv "$DOWNLOADSECUREFILE_SECUREFILEPATH" "$HOME/.s3cfg"
26 s3cmd -c "$DOWNLOADSECUREFILE_SECUREFILEPATH" put -P --add-header="cache-control: public, max-age=31536000, immutable" "$TARBALL" s3://ziglang.org/builds/
27
28 SHASUM=$(sha256sum $TARBALL | cut '-d ' -f1)
29 BYTESIZE=$(wc -c < $TARBALL)
30
31 JSONFILE="windows-$GITBRANCH.json"
32 touch $JSONFILE
33 echo "{\"tarball\": \"$TARBALL\"," >>$JSONFILE
34 echo "\"shasum\": \"$SHASUM\"," >>$JSONFILE
35 echo "\"size\": \"$BYTESIZE\"}" >>$JSONFILE
36
37 s3cmd -c "$DOWNLOADSECUREFILE_SECUREFILEPATH" put -P --add-header="Cache-Control: max-age=0, must-revalidate" "$JSONFILE" "s3://ziglang.org/builds/$JSONFILE"
38 s3cmd -c "$DOWNLOADSECUREFILE_SECUREFILEPATH" put -P "$JSONFILE" "s3://ziglang.org/builds/x86_64-windows-$VERSION.json"
39
40 # `set -x` causes these variables to be mangled.
41 # See https://developercommunity.visualstudio.com/content/problem/375679/pipeline-variable-incorrectly-inserts-single-quote.html
42 set +x
43 echo "##vso[task.setvariable variable=tarball;isOutput=true]$TARBALL"
44 echo "##vso[task.setvariable variable=shasum;isOutput=true]$SHASUM"
45 echo "##vso[task.setvariable variable=bytesize;isOutput=true]$BYTESIZE"
46fi