Skip to content

Commit

Permalink
ci: Partial setup for running unit tests in new CI infrastructure.
Browse files Browse the repository at this point in the history
This PR includes:
- The Windows Dockerfile that will be used for Windows builds.
- A script that runs unit tests.

The rest of the setup is internal.
  • Loading branch information
amanda-tarafa committed May 22, 2023
1 parent dd7ae96 commit add85af
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .kokoro/gcp_windows_docker/Dockerfile
@@ -0,0 +1,27 @@
# We use the .NET 6 Windows Server Core 2019 official image as starter.
# Kokoro supports up to Windows Server 2019 only.
# We build in .NET 6
FROM mcr.microsoft.com/dotnet/sdk:6.0-windowsservercore-ltsc2019

# Install extra .NET target frameworks that we test in.
# https://github.com/dotnet/dotnet-docker/blob/main/documentation/scenarios/installing-dotnet.md#installing-from-dotnet-install-script
# Setup Powershell
RUN powershell -Command $ErrorActionPreference = 'Stop';
RUN powershell -Command $ProgressPreference = 'SilentlyContinue';
# Download dotnet-install.ps1
RUN powershell -Command Invoke-WebRequest -UseBasicParsing -Uri https://dot.net/v1/dotnet-install.ps1 -OutFile dotnet-install.ps1;
# Install .NET Core 3.1
RUN powershell -Command ./dotnet-install.ps1 -InstallDir '/Program Files/dotnet' -Channel 3.1;
# Delete dotnet-install.ps1
RUN powershell -Command Remove-Item -Force dotnet-install.ps1;

# Install Chocolatey
ENV ChocolateyUseWindowsCompression false
RUN powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"

# Install Chocolatey packages
RUN choco install git.install -y

# Default to PowerShell.
# This is what Kokoro owned Docker images do. We'll do the same at least for now.
CMD ["powershell.exe", "-NoLogo", "-ExecutionPolicy", "Bypass"]
7 changes: 7 additions & 0 deletions RunUnitTests.sh
@@ -0,0 +1,7 @@
#!/bin/bash

set -e

dotnet build Src/Support/GoogleApisClient.sln
dotnet test --no-restore Src/Support/Google.Apis.Auth.Tests/Google.Apis.Auth.Tests.csproj
dotnet test --no-restore Src/Support/Google.Apis.Tests/Google.Apis.Tests.csproj

0 comments on commit add85af

Please sign in to comment.