| ... | ... | @@ -22,29 +22,149 @@ jobs: |
| 22 | 22 | name: main |
| 23 | 23 | displayName: 'Build' |
| 24 | 24 | - job: BuildWindows |
| 25 | timeoutInMinutes: 360 |
| 25 | 26 | pool: |
| 26 | 27 | vmImage: 'windows-2019' |
| 27 | | timeoutInMinutes: 360 |
| 28 | variables: |
| 29 | TARGET: 'x86_64-windows-gnu' |
| 30 | ZIG_LLVM_CLANG_LLD_NAME: 'zig+llvm+lld+clang-${{ variables.TARGET }}-0.9.1' |
| 31 | ZIG_LLVM_CLANG_LLD_URL: 'https://ziglang.org/deps/${{ variables.ZIG_LLVM_CLANG_LLD_NAME }}.zip' |
| 28 | 32 | 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 |
| 33 | - pwsh: | |
| 34 | (New-Object Net.WebClient).DownloadFile("$(ZIG_LLVM_CLANG_LLD_URL)", "${ZIG_LLVM_CLANG_LLD_NAME}.zip") |
| 35 | & 'C:\Program Files\7-Zip\7z.exe' x "${ZIG_LLVM_CLANG_LLD_NAME}.zip" |
| 36 | name: install |
| 37 | displayName: 'Install ZIG/LLVM/CLANG/LLD' |
| 38 | |
| 39 | - pwsh: | |
| 40 | Set-Variable -Name ZIGBUILDDIR -Value "$(Get-Location)\build" |
| 41 | Set-Variable -Name ZIGINSTALLDIR -Value "${ZIGBUILDDIR}\dist" |
| 42 | Set-Variable -Name ZIGPREFIXPATH -Value "$(Get-Location)\$(ZIG_LLVM_CLANG_LLD_NAME)" |
| 43 | |
| 44 | # Make the `zig version` number consistent. |
| 45 | # This will affect the `zig build` command below which uses `git describe`. |
| 46 | git config core.abbrev 9 |
| 47 | git fetch --tags |
| 48 | if ((git rev-parse --is-shallow-repository) -eq "true") { |
| 49 | git fetch --unshallow # `git describe` won't work on a shallow repo |
| 50 | } |
| 51 | |
| 52 | # The dev kit zip file that we have here is old, and may be incompatible with |
| 53 | # the build.zig script of master branch. So we keep an old version of build.zig |
| 54 | # here in the CI directory. |
| 55 | mv build.zig build.zig.master |
| 56 | mv ci/azure/build.zig build.zig |
| 57 | |
| 58 | mkdir $ZIGBUILDDIR |
| 59 | cd $ZIGBUILDDIR |
| 60 | |
| 61 | & "${ZIGPREFIXPATH}/bin/zig.exe" build ` |
| 62 | --prefix "$ZIGINSTALLDIR" ` |
| 63 | --search-prefix "$ZIGPREFIXPATH" ` |
| 64 | -Dstage1 ` |
| 65 | <# stage2 is omitted until we resolve https://github.com/ziglang/zig/issues/6485 #> ` |
| 66 | -Domit-stage2 ` |
| 67 | -Dstatic-llvm ` |
| 68 | -Drelease ` |
| 69 | -Dstrip ` |
| 70 | -Duse-zig-libcxx ` |
| 71 | -Dtarget=$(TARGET) |
| 72 | |
| 73 | cd - |
| 74 | |
| 75 | # Now that we have built an up-to-date zig.exe, we restore the original |
| 76 | # build script from master branch. |
| 77 | rm build.zig |
| 78 | mv build.zig.master build.zig |
| 79 | |
| 80 | name: build |
| 81 | displayName: 'Build' |
| 82 | |
| 83 | - pwsh: | |
| 84 | Set-Variable -Name ZIGINSTALLDIR -Value "$(Get-Location)\build\dist" |
| 85 | |
| 86 | # Sadly, stage2 is omitted from this build to save memory on the CI server. Once self-hosted is |
| 87 | # built with itself and does not gobble as much memory, we can enable these tests. |
| 88 | #& "$ZIGINSTALLDIR\bin\zig.exe" test "..\test\behavior.zig" -fno-stage1 -fLLVM -I "..\test" 2>&1 |
| 89 | |
| 90 | & "$ZIGINSTALLDIR\bin\zig.exe" build test-toolchain -Dskip-non-native -Dskip-stage2-tests 2>&1 |
| 91 | & "$ZIGINSTALLDIR\bin\zig.exe" build test-std -Dskip-non-native 2>&1 |
| 92 | name: test |
| 93 | displayName: 'Test' |
| 94 | |
| 95 | - pwsh: | |
| 96 | Set-Variable -Name ZIGINSTALLDIR -Value "$(Get-Location)\build\dist" |
| 97 | |
| 98 | & "$ZIGINSTALLDIR\bin\zig.exe" build docs |
| 99 | timeoutInMinutes: 60 |
| 100 | name: doc |
| 101 | displayName: 'Documentation' |
| 102 | |
| 42 | 103 | - task: DownloadSecureFile@1 |
| 43 | 104 | inputs: |
| 44 | | secureFile: s3cfg |
| 45 | | - script: ci/azure/windows_script.bat |
| 46 | | name: main |
| 47 | | displayName: 'Build and test' |
| 105 | name: aws_credentials |
| 106 | secureFile: aws_credentials |
| 107 | |
| 108 | - pwsh: | |
| 109 | Set-Variable -Name ZIGBUILDDIR -Value "$(Get-Location)\build" |
| 110 | $Env:AWS_SHARED_CREDENTIALS_FILE = "$Env:DOWNLOADSECUREFILE_SECUREFILEPATH" |
| 111 | |
| 112 | # Workaround Azure networking issue |
| 113 | # https://github.com/aws/aws-cli/issues/5749 |
| 114 | $Env:AWS_EC2_METADATA_DISABLED = "true" |
| 115 | $Env:AWS_REGION = "us-west-2" |
| 116 | |
| 117 | cd "$ZIGBUILDDIR" |
| 118 | mv ../LICENSE dist/ |
| 119 | mv ../zig-cache/langref.html dist/ |
| 120 | mv dist/bin/zig.exe dist/ |
| 121 | rmdir dist/bin |
| 122 | |
| 123 | # Remove the unnecessary zig dir in $prefix/lib/zig/std/std.zig |
| 124 | mv dist/lib/zig dist/lib2 |
| 125 | rmdir dist/lib |
| 126 | mv dist/lib2 dist/lib |
| 127 | |
| 128 | Set-Variable -Name VERSION -Value $(./dist/zig.exe version) |
| 129 | Set-Variable -Name DIRNAME -Value "zig-windows-x86_64-$VERSION" |
| 130 | Set-Variable -Name TARBALL -Value "$DIRNAME.zip" |
| 131 | mv dist "$DIRNAME" |
| 132 | 7z a "$TARBALL" "$DIRNAME" |
| 133 | |
| 134 | aws s3 cp ` |
| 135 | "$TARBALL" ` |
| 136 | s3://ziglang.org/builds/ ` |
| 137 | --acl public-read ` |
| 138 | --cache-control 'public, max-age=31536000, immutable' |
| 139 | |
| 140 | Set-Variable -Name SHASUM -Value (Get-FileHash "$TARBALL" -Algorithm SHA256 | select-object -ExpandProperty Hash) |
| 141 | Set-Variable -Name BYTESIZE -Value (Get-Item "$TARBALL").length |
| 142 | |
| 143 | Set-Variable -Name JSONFILE -Value "windows-${Env:BUILD_SOURCEBRANCHNAME}.json" |
| 144 | echo $null > $JSONFILE |
| 145 | echo ('{"tarball": "' + $TARBALL + '",') >> $JSONFILE |
| 146 | echo ('"shasum": "' + $SHASUM + '",') >> $JSONFILE |
| 147 | echo ('"size": ' + $BYTESIZE + '}' ) >> $JSONFILE |
| 148 | |
| 149 | aws s3 cp ` |
| 150 | "$JSONFILE" ` |
| 151 | s3://ziglang.org/builds/ ` |
| 152 | --acl public-read ` |
| 153 | --cache-control 'max-age=0, must-revalidate' |
| 154 | |
| 155 | aws s3 cp ` |
| 156 | "$JSONFILE" ` |
| 157 | "s3://ziglang.org/builds/x86_64-windows-${VERSION}.json" ` |
| 158 | --acl public-read |
| 159 | |
| 160 | echo "##vso[task.setvariable variable=tarball;isOutput=true]$TARBALL" |
| 161 | echo "##vso[task.setvariable variable=shasum;isOutput=true]$SHASUM" |
| 162 | echo "##vso[task.setvariable variable=bytesize;isOutput=true]$BYTESIZE" |
| 163 | |
| 164 | name: upload |
| 165 | condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) |
| 166 | displayName: 'Upload' |
| 167 | |
| 48 | 168 | - job: OnMasterSuccess |
| 49 | 169 | dependsOn: |
| 50 | 170 | - BuildMacOS |