CI: windows: don't create build directory

Simplify the script by not creating an unnecessary build directory and
then changing directories to and from it.
This commit is contained in:
Andrew Kelley 2022-08-17 23:34:57 -07:00
parent c4466496ff
commit 35f62bc7ae

View File

@ -37,8 +37,8 @@ jobs:
displayName: 'Install ZIG/LLVM/CLANG/LLD' displayName: 'Install ZIG/LLVM/CLANG/LLD'
- pwsh: | - pwsh: |
Set-Variable -Name ZIGBUILDDIR -Value "$(Get-Location)\build" Set-Variable -Name ZIGLIBDIR -Value "$(Get-Location)\lib"
Set-Variable -Name ZIGINSTALLDIR -Value "${ZIGBUILDDIR}\dist" Set-Variable -Name ZIGINSTALLDIR -Value "$(Get-Location)\stage3-release"
Set-Variable -Name ZIGPREFIXPATH -Value "$(Get-Location)\$(ZIG_LLVM_CLANG_LLD_NAME)" Set-Variable -Name ZIGPREFIXPATH -Value "$(Get-Location)\$(ZIG_LLVM_CLANG_LLD_NAME)"
function CheckLastExitCode { function CheckLastExitCode {
@ -56,13 +56,10 @@ jobs:
git fetch --unshallow # `git describe` won't work on a shallow repo git fetch --unshallow # `git describe` won't work on a shallow repo
} }
mkdir $ZIGBUILDDIR
cd $ZIGBUILDDIR
& "$ZIGPREFIXPATH\bin\zig.exe" build ` & "$ZIGPREFIXPATH\bin\zig.exe" build `
--prefix "$ZIGINSTALLDIR" ` --prefix "$ZIGINSTALLDIR" `
--search-prefix "$ZIGPREFIXPATH" ` --search-prefix "$ZIGPREFIXPATH" `
--zig-lib-dir "..\lib" ` --zig-lib-dir "$ZIGLIBDIR" `
-Denable-stage1 ` -Denable-stage1 `
-Dstatic-llvm ` -Dstatic-llvm `
-Drelease ` -Drelease `
@ -70,13 +67,11 @@ jobs:
-Duse-zig-libcxx ` -Duse-zig-libcxx `
-Dtarget=$(TARGET) -Dtarget=$(TARGET)
CheckLastExitCode CheckLastExitCode
cd -
name: build name: build
displayName: 'Build' displayName: 'Build'
- pwsh: | - pwsh: |
Set-Variable -Name ZIGINSTALLDIR -Value "$(Get-Location)\build\dist" Set-Variable -Name ZIGINSTALLDIR -Value "$(Get-Location)\stage3-release"
function CheckLastExitCode { function CheckLastExitCode {
if (!$?) { if (!$?) {
@ -85,39 +80,21 @@ jobs:
return 0 return 0
} }
& "$ZIGINSTALLDIR\bin\zig.exe" build test ` & "$ZIGINSTALLDIR\bin\zig.exe" build test docs `
--search-prefix "$ZIGPREFIXPATH" ` --search-prefix "$ZIGPREFIXPATH" `
-Dstatic-llvm ` -Dstatic-llvm `
-Dskip-non-native ` -Dskip-non-native `
-Dskip-stage2-tests -Dskip-stage2-tests
CheckLastExitCode CheckLastExitCode
name: test name: test
displayName: 'Test' displayName: 'Test'
- pwsh: |
Set-Variable -Name ZIGINSTALLDIR -Value "$(Get-Location)\build\dist"
function CheckLastExitCode {
if (!$?) {
exit 1
}
return 0
}
& "$ZIGINSTALLDIR\bin\zig.exe" build docs
CheckLastExitCode
timeoutInMinutes: 60
name: doc
displayName: 'Documentation'
- task: DownloadSecureFile@1 - task: DownloadSecureFile@1
inputs: inputs:
name: aws_credentials name: aws_credentials
secureFile: aws_credentials secureFile: aws_credentials
- pwsh: | - pwsh: |
Set-Variable -Name ZIGBUILDDIR -Value "$(Get-Location)\build"
$Env:AWS_SHARED_CREDENTIALS_FILE = "$Env:DOWNLOADSECUREFILE_SECUREFILEPATH" $Env:AWS_SHARED_CREDENTIALS_FILE = "$Env:DOWNLOADSECUREFILE_SECUREFILEPATH"
# Workaround Azure networking issue # Workaround Azure networking issue
@ -125,21 +102,20 @@ jobs:
$Env:AWS_EC2_METADATA_DISABLED = "true" $Env:AWS_EC2_METADATA_DISABLED = "true"
$Env:AWS_REGION = "us-west-2" $Env:AWS_REGION = "us-west-2"
cd "$ZIGBUILDDIR" mv LICENSE stage3-release/
mv ../LICENSE dist/ mv zig-cache/langref.html stage3-release/
mv ../zig-cache/langref.html dist/ mv stage3-release/bin/zig.exe stage3-release/
mv dist/bin/zig.exe dist/ rmdir stage3-release/bin
rmdir dist/bin
# Remove the unnecessary zig dir in $prefix/lib/zig/std/std.zig # Remove the unnecessary zig dir in $prefix/lib/zig/std/std.zig
mv dist/lib/zig dist/lib2 mv stage3-release/lib/zig stage3-release/lib2
rmdir dist/lib rmdir stage3-release/lib
mv dist/lib2 dist/lib mv stage3-release/lib2 stage3-release/lib
Set-Variable -Name VERSION -Value $(./dist/zig.exe version) Set-Variable -Name VERSION -Value $(./stage3-release/zig.exe version)
Set-Variable -Name DIRNAME -Value "zig-windows-x86_64-$VERSION" Set-Variable -Name DIRNAME -Value "zig-windows-x86_64-$VERSION"
Set-Variable -Name TARBALL -Value "$DIRNAME.zip" Set-Variable -Name TARBALL -Value "$DIRNAME.zip"
mv dist "$DIRNAME" mv stage3-release "$DIRNAME"
7z a "$TARBALL" "$DIRNAME" 7z a "$TARBALL" "$DIRNAME"
aws s3 cp ` aws s3 cp `