| ... | ... | @@ -10,6 +10,7 @@ jobs: |
| 10 | 10 | - script: ci/azure/macos_script |
| 11 | 11 | name: main |
| 12 | 12 | displayName: 'Build and test' |
| 13 | |
| 13 | 14 | - job: BuildMacOS_arm64 |
| 14 | 15 | pool: |
| 15 | 16 | vmImage: 'macOS-10.15' |
| ... | ... | @@ -21,30 +22,125 @@ jobs: |
| 21 | 22 | - script: ci/azure/macos_arm64_script |
| 22 | 23 | name: main |
| 23 | 24 | displayName: 'Build' |
| 25 | |
| 24 | 26 | - job: BuildWindows |
| 27 | timeoutInMinutes: 360 |
| 25 | 28 | pool: |
| 26 | 29 | vmImage: 'windows-2019' |
| 27 | | timeoutInMinutes: 360 |
| 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' |
| 28 | 33 | steps: |
| 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 |
| 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 | |
| 42 | 87 | - task: DownloadSecureFile@1 |
| 43 | 88 | inputs: |
| 44 | | secureFile: s3cfg |
| 45 | | - script: ci/azure/windows_msvc_script.bat |
| 46 | | name: main |
| 47 | | displayName: 'Build and test' |
| 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 = "$(aws_credentials.secureFilePath)" |
| 95 | |
| 96 | cd "$ZIGBUILDDIR" |
| 97 | mv ../LICENSE dist/ |
| 98 | mv ../zig-cache/langref.html dist/ |
| 99 | mv dist/bin/zig.exe dist/ |
| 100 | rmdir dist/bin |
| 101 | |
| 102 | # Remove the unnecessary zig dir in $prefix/lib/zig/std/std.zig |
| 103 | mv dist/lib/zig dist/lib2 |
| 104 | rmdir dist/lib |
| 105 | mv dist/lib2 dist/lib |
| 106 | |
| 107 | Set-Variable -Name VERSION -Value $(./dist/zig.exe version) |
| 108 | Set-Variable -Name DIRNAME -Value "zig-windows-x86_64-$VERSION" |
| 109 | Set-Variable -Name TARBALL -Value "$DIRNAME.zip" |
| 110 | mv dist "$DIRNAME" |
| 111 | 7z a "$TARBALL" "$DIRNAME" |
| 112 | |
| 113 | aws s3 cp ` |
| 114 | "$TARBALL" ` |
| 115 | s3://ziglang.org/builds/ ` |
| 116 | --cache-control 'public, max-age=31536000, immutable' |
| 117 | |
| 118 | Set-Variable -Name SHASUM -Value (Get-FileHash "$TARBALL" -Algorithm SHA256 | select-object -ExpandProperty Hash) |
| 119 | Set-Variable -Name BYTESIZE -Value (Get-Item "$TARBALL").length |
| 120 | |
| 121 | Set-Variable -Name JSONFILE -Value "windows-${GITBRANCH}.json" |
| 122 | echo $null > $JSONFILE |
| 123 | echo ('{"tarball": "' + $TARBALL + '",') >> $JSONFILE |
| 124 | echo ('"shasum": "' + $SHASUM + '",') >> $JSONFILE |
| 125 | echo ('"size": ' + $BYTESIZE + '}' ) >> $JSONFILE |
| 126 | |
| 127 | aws s3 cp ` |
| 128 | "$JSONFILE" ` |
| 129 | s3://ziglang.org/builds/ ` |
| 130 | --cache-control 'max-age=0, must-revalidate' |
| 131 | |
| 132 | aws s3 cp ` |
| 133 | "$JSONFILE" ` |
| 134 | "s3://ziglang.org/builds/x86_64-windows-${VERSION}.json" |
| 135 | |
| 136 | echo "##vso[task.setvariable variable=tarball;isOutput=true]$TARBALL" |
| 137 | echo "##vso[task.setvariable variable=shasum;isOutput=true]$SHASUM" |
| 138 | echo "##vso[task.setvariable variable=bytesize;isOutput=true]$BYTESIZE" |
| 139 | |
| 140 | name: upload |
| 141 | condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) |
| 142 | displayName: 'Upload' |
| 143 | |
| 48 | 144 | - job: OnMasterSuccess |
| 49 | 145 | dependsOn: |
| 50 | 146 | - BuildMacOS |