Skip to content

Commit 494237c

Browse files
committed
test
1 parent 28f9bc3 commit 494237c

File tree

6 files changed

+286
-0
lines changed

6 files changed

+286
-0
lines changed

.appveyor.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
image: Visual Studio 2017
2+
3+
environment:
4+
matrix:
5+
- version: 1.19.0
6+
variant: nanoserver
7+
- version: 1.19.0
8+
variant: windowsservercore
9+
10+
build_script:
11+
- cmd: appveyor-retry docker build --pull -t rust %version%/windows/%variant%
12+
13+
after_build:
14+
- ps: docker images
15+
16+
test_script:
17+
- ps: docker run --rm rust cargo install --example toml2json toml --vers 0.4.4

1.19.0/windows/nanoserver/Dockerfile

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
FROM microsoft/nanoserver
2+
3+
ENV RUSTUP_HOME=C:\\rustup \
4+
CARGO_HOME=C:\\cargo
5+
6+
#RUN powershell -Command \
7+
# $ErrorActionPreference = 'Stop'; \
8+
# Invoke-WebRequest -Uri "http://go.microsoft.com/fwlink/?LinkId=691126" -UseBasicParsing -OutFile c:\VisualCppBuildTools_Full.exe ; \
9+
# Invoke-Command -ScriptBlock { c:\VisualCppBuildTools_Full.exe /full /NoRefresh /norestart /silent /passive } ; \
10+
# Wait-Process -Name visualcppbuildtools_full
11+
12+
RUN setx /M PATH "%PATH%;C:/Windows/System32/Forwarders"
13+
14+
RUN powershell -Command \
15+
$ErrorActionPreference = 'Stop'; \
16+
$url = 'https://download.visualstudio.microsoft.com/download/pr/10930955/e64d79b40219aea618ce2fe10ebd5f0d/vs_BuildTools.exe'; \
17+
$sha256 = '68A678D64704A4592CA003494B9C128EE5D2B381672DE174BAF9811E2A84EE72'; \
18+
Invoke-WebRequest -Uri $url -OutFile C:\vs_BuildTools.exe; \
19+
$actual256 = (Get-FileHash vs_BuildTools.exe -Algorithm sha256).Hash; \
20+
if ($actual256 -ne $sha256) { \
21+
Write-Host 'FAILED!'; \
22+
Write-Host ('expected: {0}' -f $sha256); \
23+
Write-Host ('got: {0}' -f $actual256); \
24+
exit 1; \
25+
};
26+
27+
RUN C:\\vs_BuildTools.exe \
28+
--quiet \
29+
--norestart \
30+
--noUpdateInstaller \
31+
--nocache \
32+
--wait \
33+
--add Microsoft.VisualStudio.Workload.VCTools
34+
35+
RUN powershell -Command \
36+
$ErrorActionPreference = 'Stop'; \
37+
Remove-Item .\vs_BuildTools.exe ; \
38+
Remove-Item -Force -Recurse 'C:\Program Files (x86)\Microsoft Visual Studio\Installer'
39+
40+
41+
42+
# $ProgressPreference: https://github.com/PowerShell/PowerShell/issues/2138#issuecomment-251261324
43+
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
44+
45+
RUN $url = 'https://static.rust-lang.org/rustup/archive/1.5.0/x86_64-pc-windows-msvc/rustup-init.exe'; \
46+
Write-Host ('Downloading {0} ...' -f $url); \
47+
Invoke-WebRequest -Uri $url -OutFile 'rustup-init.exe'; \
48+
\
49+
$sha256 = '7500b705855c4f8e70e222ad1192bb46de15629f73a6459a98c9fd4bd06136bc'; \
50+
Write-Host ('Verifying sha256 ({0}) ...' -f $sha256); \
51+
if ((Get-FileHash rustup-init.exe -Algorithm sha256).Hash -ne $sha256) { \
52+
Write-Host 'FAILED!'; \
53+
exit 1; \
54+
}; \
55+
\
56+
New-Item $env:CARGO_HOME\bin -type directory | Out-Null; \
57+
\
58+
# PATH isn't actually set in the Docker image, so we have to set it from
59+
# within the container. Not really sure what this comment means, but
60+
# docker-library/official-images and the go directory do this, so presumably
61+
# we should too
62+
$newPath = ('{0}\bin;{1}' -f $env:CARGO_HOME, $env:PATH); \
63+
Write-Host ('Updating PATH: {0}' -f $newPath); \
64+
[Environment]::SetEnvironmentVariable('PATH', $newPath, [EnvironmentVariableTarget]::Machine); \
65+
\
66+
C:\rustup-init.exe -y --no-modify-path --default-toolchain 1.19.0; \
67+
Remove-Item C:\rustup-init.exe;
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# escape=`
2+
3+
FROM microsoft/windowsservercore
4+
5+
ENV RUSTUP_HOME=C:\rustup `
6+
CARGO_HOME=C:\cargo
7+
8+
RUN ["powershell", "-Command", "`
9+
$ErrorActionPreference = 'Stop'; `
10+
$url = 'https://download.visualstudio.microsoft.com/download/pr/10930955/e64d79b40219aea618ce2fe10ebd5f0d/vs_BuildTools.exe'; `
11+
$sha256 = '68A678D64704A4592CA003494B9C128EE5D2B381672DE174BAF9811E2A84EE72'; `
12+
Invoke-WebRequest -Uri $url -OutFile vs_BuildTools.exe; `
13+
$actual256 = (Get-FileHash vs_BuildTools.exe -Algorithm sha256).Hash; `
14+
if ($actual256 -ne $sha256) { `
15+
Write-Host 'FAILED!'; `
16+
Write-Host ('expected: {0}' -f $sha256); `
17+
Write-Host ('got: {0}' -f $actual256); `
18+
exit 1; `
19+
}; `
20+
Install-WindowsFeature NET-Framework-45-Core"]
21+
22+
RUN [".\\vs_BuildTools.exe", `
23+
"--quiet", `
24+
"--norestart", `
25+
"--locale", "en-US", `
26+
"--add", "Microsoft.VisualStudio.Workload.VCTools", `
27+
"--includeOptional", `
28+
"--includeRecommended" `
29+
]
30+
31+
RUN ["powershell", "-Command", "`
32+
$ErrorActionPreference = 'Stop'; `
33+
Write-Host 'done'; `
34+
Remove-Item .\\vs_BuildTools.exe; `
35+
Remove-Item -Force -Recurse 'C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer'"]
36+
37+
38+
# $ProgressPreference: https://github.com/PowerShell/PowerShell/issues/2138#issuecomment-251261324
39+
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
40+
41+
RUN $url = 'https://static.rust-lang.org/rustup/archive/1.5.0/x86_64-pc-windows-msvc/rustup-init.exe'; `
42+
Write-Host ('Downloading {0} ...' -f $url); `
43+
Invoke-WebRequest -Uri $url -OutFile 'rustup-init.exe'; `
44+
`
45+
$sha256 = '7500b705855c4f8e70e222ad1192bb46de15629f73a6459a98c9fd4bd06136bc'; `
46+
Write-Host ('Verifying sha256 ({0}) ...' -f $sha256); `
47+
if ((Get-FileHash rustup-init.exe -Algorithm sha256).Hash -ne $sha256) { `
48+
Write-Host 'FAILED!'; `
49+
exit 1; `
50+
}; `
51+
`
52+
New-Item $env:CARGO_HOME\bin -type directory | Out-Null; `
53+
`
54+
$newPath = ('{0}\bin;{1}' -f $env:CARGO_HOME, $env:PATH); `
55+
Write-Host ('Updating PATH: {0}' -f $newPath); `
56+
[Environment]::SetEnvironmentVariable('PATH', $newPath, [EnvironmentVariableTarget]::Machine); `
57+
`
58+
C:\rustup-init.exe -y --no-modify-path --default-toolchain 1.19.0; `
59+
Remove-Item C:\rustup-init.exe
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
FROM microsoft/nanoserver
2+
3+
ENV RUSTUP_HOME=C:\\rustup \
4+
CARGO_HOME=C:\\cargo
5+
6+
#RUN powershell -Command \
7+
# $ErrorActionPreference = 'Stop'; \
8+
# Invoke-WebRequest -Uri "http://go.microsoft.com/fwlink/?LinkId=691126" -UseBasicParsing -OutFile c:\VisualCppBuildTools_Full.exe ; \
9+
# Invoke-Command -ScriptBlock { c:\VisualCppBuildTools_Full.exe /full /NoRefresh /norestart /silent /passive } ; \
10+
# Wait-Process -Name visualcppbuildtools_full
11+
12+
RUN setx /M PATH "%PATH%;C:/Windows/System32/Forwarders"
13+
14+
RUN powershell -Command \
15+
$ErrorActionPreference = 'Stop'; \
16+
$url = 'https://download.visualstudio.microsoft.com/download/pr/10930955/e64d79b40219aea618ce2fe10ebd5f0d/vs_BuildTools.exe'; \
17+
$sha256 = '68A678D64704A4592CA003494B9C128EE5D2B381672DE174BAF9811E2A84EE72'; \
18+
Invoke-WebRequest -Uri $url -OutFile C:\vs_BuildTools.exe; \
19+
$actual256 = (Get-FileHash vs_BuildTools.exe -Algorithm sha256).Hash; \
20+
if ($actual256 -ne $sha256) { \
21+
Write-Host 'FAILED!'; \
22+
Write-Host ('expected: {0}' -f $sha256); \
23+
Write-Host ('got: {0}' -f $actual256); \
24+
exit 1; \
25+
};
26+
27+
RUN C:\\vs_BuildTools.exe \
28+
--quiet \
29+
--norestart \
30+
--noUpdateInstaller \
31+
--nocache \
32+
--wait \
33+
--add Microsoft.VisualStudio.Workload.VCTools
34+
35+
RUN powershell -Command \
36+
$ErrorActionPreference = 'Stop'; \
37+
Remove-Item .\vs_BuildTools.exe ; \
38+
Remove-Item -Force -Recurse 'C:\Program Files (x86)\Microsoft Visual Studio\Installer'
39+
40+
41+
42+
# $ProgressPreference: https://github.com/PowerShell/PowerShell/issues/2138#issuecomment-251261324
43+
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
44+
45+
RUN $url = 'https://static.rust-lang.org/rustup/archive/%%RUSTUP-VERSION%%/x86_64-pc-windows-msvc/rustup-init.exe'; \
46+
Write-Host ('Downloading {0} ...' -f $url); \
47+
Invoke-WebRequest -Uri $url -OutFile 'rustup-init.exe'; \
48+
\
49+
$sha256 = '%%WIN-SHA256%%'; \
50+
Write-Host ('Verifying sha256 ({0}) ...' -f $sha256); \
51+
if ((Get-FileHash rustup-init.exe -Algorithm sha256).Hash -ne $sha256) { \
52+
Write-Host 'FAILED!'; \
53+
exit 1; \
54+
}; \
55+
\
56+
New-Item $env:CARGO_HOME\bin -type directory | Out-Null; \
57+
\
58+
# PATH isn't actually set in the Docker image, so we have to set it from
59+
# within the container. Not really sure what this comment means, but
60+
# docker-library/official-images and the go directory do this, so presumably
61+
# we should too
62+
$newPath = ('{0}\bin;{1}' -f $env:CARGO_HOME, $env:PATH); \
63+
Write-Host ('Updating PATH: {0}' -f $newPath); \
64+
[Environment]::SetEnvironmentVariable('PATH', $newPath, [EnvironmentVariableTarget]::Machine); \
65+
\
66+
C:\rustup-init.exe -y --no-modify-path --default-toolchain %%RUST-VERSION%%; \
67+
Remove-Item C:\rustup-init.exe;
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# escape=`
2+
3+
FROM microsoft/windowsservercore
4+
5+
ENV RUSTUP_HOME=C:\rustup `
6+
CARGO_HOME=C:\cargo
7+
8+
RUN ["powershell", "-Command", "`
9+
$ErrorActionPreference = 'Stop'; `
10+
$url = 'https://download.visualstudio.microsoft.com/download/pr/10930955/e64d79b40219aea618ce2fe10ebd5f0d/vs_BuildTools.exe'; `
11+
$sha256 = '68A678D64704A4592CA003494B9C128EE5D2B381672DE174BAF9811E2A84EE72'; `
12+
Invoke-WebRequest -Uri $url -OutFile vs_BuildTools.exe; `
13+
$actual256 = (Get-FileHash vs_BuildTools.exe -Algorithm sha256).Hash; `
14+
if ($actual256 -ne $sha256) { `
15+
Write-Host 'FAILED!'; `
16+
Write-Host ('expected: {0}' -f $sha256); `
17+
Write-Host ('got: {0}' -f $actual256); `
18+
exit 1; `
19+
}; `
20+
Install-WindowsFeature NET-Framework-45-Core"]
21+
22+
RUN [".\\vs_BuildTools.exe", `
23+
"--quiet", `
24+
"--norestart", `
25+
"--locale", "en-US", `
26+
"--add", "Microsoft.VisualStudio.Workload.VCTools", `
27+
"--includeOptional", `
28+
"--includeRecommended" `
29+
]
30+
31+
RUN ["powershell", "-Command", "`
32+
$ErrorActionPreference = 'Stop'; `
33+
Write-Host 'done'; `
34+
Remove-Item .\\vs_BuildTools.exe; `
35+
Remove-Item -Force -Recurse 'C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer'"]
36+
37+
38+
# $ProgressPreference: https://github.com/PowerShell/PowerShell/issues/2138#issuecomment-251261324
39+
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
40+
41+
RUN $url = 'https://static.rust-lang.org/rustup/archive/%%RUSTUP-VERSION%%/x86_64-pc-windows-msvc/rustup-init.exe'; `
42+
Write-Host ('Downloading {0} ...' -f $url); `
43+
Invoke-WebRequest -Uri $url -OutFile 'rustup-init.exe'; `
44+
`
45+
$sha256 = '%%WIN-SHA256%%'; `
46+
Write-Host ('Verifying sha256 ({0}) ...' -f $sha256); `
47+
if ((Get-FileHash rustup-init.exe -Algorithm sha256).Hash -ne $sha256) { `
48+
Write-Host 'FAILED!'; `
49+
exit 1; `
50+
}; `
51+
`
52+
New-Item $env:CARGO_HOME\bin -type directory | Out-Null; `
53+
`
54+
$newPath = ('{0}\bin;{1}' -f $env:CARGO_HOME, $env:PATH); `
55+
Write-Host ('Updating PATH: {0}' -f $newPath); `
56+
[Environment]::SetEnvironmentVariable('PATH', $newPath, [EnvironmentVariableTarget]::Machine); `
57+
`
58+
C:\rustup-init.exe -y --no-modify-path --default-toolchain %%RUST-VERSION%%; `
59+
Remove-Item C:\rustup-init.exe

update.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ sed_escape_rhs() {
1717
}
1818

1919
travisEnv=
20+
appveyorEnv=
2021
for version in "${versions[@]}"; do
2122
rustupVersion=$(rustupVersion "$version")
2223
linuxArchCase='dpkgArch="$(dpkg --print-architecture)"; '$'\\\n'
@@ -40,7 +41,23 @@ for version in "${versions[@]}"; do
4041
travisEnv='\n - VERSION='"$version VARIANT=$variant$travisEnv"
4142
fi
4243
done
44+
45+
windowsSha256="$(curl -fsSL "https://static.rust-lang.org/rustup/archive/${rustupVersion}/x86_64-pc-windows-msvc/rustup-init.exe.sha256" | awk '{ print $1 }')"
46+
47+
for winVariant in windowsservercore nanoserver; do
48+
if [ -d "$version/windows/$winVariant" ]; then
49+
sed -r \
50+
-e 's!%%RUST-VERSION%%!'"$version"'!g' \
51+
-e 's!%%RUSTUP-VERSION%%!'"$rustupVersion"'!g' \
52+
-e 's!%%WIN-SHA256%%!'"$windowsSha256"'!g' \
53+
"Dockerfile-windows-$winVariant.template" > "$version/windows/$winVariant/Dockerfile"
54+
appveyorEnv='\n - version: '"$version"'\n variant: '"$winVariant$appveyorEnv"
55+
fi
56+
done
4357
done
4458

4559
travis="$(awk -v 'RS=\n\n' '$1 == "env:" { $0 = "env:'"$travisEnv"'" } { printf "%s%s", $0, RS }' .travis.yml)"
4660
echo "$travis" > .travis.yml
61+
62+
appveyor="$(awk -v 'RS=\n\n' '$1 == "environment:" { $0 = "environment:\n matrix:'"$appveyorEnv"'" } { printf "%s%s", $0, RS }' .appveyor.yml)"
63+
echo "$appveyor" > .appveyor.yml

0 commit comments

Comments
 (0)