devops: do not download browsers on release

This commit is contained in:
Max Schmitt 2022-03-02 20:32:44 +01:00
Родитель 6863e80900
Коммит 97d946962a
10 изменённых файлов: 21 добавлений и 43 удалений

Просмотреть файл

@ -27,6 +27,12 @@ stages:
displayName: Build & Package
steps:
- task: UseDotNet@2
displayName: 'Use .NET 3.1 SDK'
inputs:
packageType: sdk
version: 3.1.x
- task: UseDotNet@2
displayName: 'Use .NET 5 SDK'
inputs:
@ -38,9 +44,9 @@ stages:
signType: '${{ parameters.signType }}'
feedSource: 'https://devdiv.pkgs.visualstudio.com/DefaultCollection/_packaging/MicroBuildToolset/nuget/v3/index.json'
# We need to download the browsers first, so we can build
# We need to download the driver first, so we can build
- task: DotNetCoreCLI@2
displayName: Download the browsers
displayName: Download the driver
inputs:
command: 'run'
arguments: '--project $(Build.SourcesDirectory)/src/tools/Playwright.Tooling/Playwright.Tooling.csproj -- download-drivers --basepath $(Build.SourcesDirectory)'

4
.github/workflows/nuget-package-tests.yml поставляемый
Просмотреть файл

@ -21,7 +21,9 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
dotnet-version: |
3.1.x
6.0.x
- name: Install prerequisites and download drivers
shell: bash
run: |

4
.github/workflows/smoke-tests.yml поставляемый
Просмотреть файл

@ -20,7 +20,9 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
dotnet-version: |
3.1.x
6.0.x
- name: Install prerequisites and download drivers
shell: bash
run: ./build.sh --download-driver

Просмотреть файл

@ -3,7 +3,7 @@
| | Linux | macOS | Windows |
| :--- | :---: | :---: | :---: |
| Chromium <!-- GEN:chromium-version -->100.0.4863.0<!-- GEN:stop --> | ✅ | ✅ | ✅ |
| Chromium <!-- GEN:chromium-version -->101.0.4915.0<!-- GEN:stop --> | ✅ | ✅ | ✅ |
| WebKit <!-- GEN:webkit-version -->15.4<!-- GEN:stop --> | ✅ | ✅ | ✅ |
| Firefox <!-- GEN:firefox-version -->96.0.1<!-- GEN:stop --> | ✅ | ✅ | ✅ |

Просмотреть файл

@ -6,7 +6,7 @@
<Summary>The Playwright CLI dotnet tool.</Summary>
<Description>Playwright enables reliable end-to-end testing for modern web apps. It is built to enable cross-browser web automation that is ever-green, capable, reliable and fast. Learn more at https://playwright.dev/dotnet/.</Description>
<PackageIcon>icon.png</PackageIcon>
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
<TargetFramework>netcoreapp3.1</TargetFramework>
<DebugSymbols>true</DebugSymbols>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<RunWithWarnings>true</RunWithWarnings>

Просмотреть файл

@ -9,7 +9,7 @@
and fixtures to enable using it within MSTest.
</Description>
<PackageIcon>icon.png</PackageIcon>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<TargetFramework>netstandard2.0</TargetFramework>
<DebugSymbols>true</DebugSymbols>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<RunWithWarnings>true</RunWithWarnings>

Просмотреть файл

@ -9,7 +9,7 @@
and fixtures to enable using it within NUnit.
</Description>
<PackageIcon>icon.png</PackageIcon>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<TargetFramework>netstandard2.0</TargetFramework>
<DebugSymbols>true</DebugSymbols>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<RunWithWarnings>true</RunWithWarnings>

Просмотреть файл

@ -7,7 +7,7 @@
<Summary>The .NET port of Playwright, used to automate Chromium, Firefox and WebKit with a single API.</Summary>
<Description>Playwright enables reliable end-to-end testing for modern web apps. It is built to enable cross-browser web automation that is ever-green, capable, reliable and fast. Learn more at https://playwright.dev/dotnet/.</Description>
<PackageIcon>icon.png</PackageIcon>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<TargetFramework>netstandard2.0</TargetFramework>
<DebugSymbols>true</DebugSymbols>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<DocumentationFile>Microsoft.Playwright.xml</DocumentationFile>

Просмотреть файл

@ -24,15 +24,12 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Net.Http;
using System.Net.Sockets;
using System.Runtime.InteropServices;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using System.Xml;
using DriverDownloader.Linux;
@ -113,7 +110,7 @@ namespace Playwright.Tooling
cdn += "/next";
}
using var client = CreateHTTPClient();
using var client = new HttpClient();
string url = $"{cdn}/playwright-{driverVersion}-{platform}.zip";
try
@ -152,35 +149,6 @@ namespace Playwright.Tooling
}
}
// Workaround for https://github.com/dotnet/runtime/issues/44686#issuecomment-733797994 which otherwise leads in timeout exceptions on macOS
public HttpClient CreateHTTPClient()
{
SocketsHttpHandler handler = new SocketsHttpHandler
{
ConnectCallback = IPv4ConnectAsync,
};
return new HttpClient(handler);
static async ValueTask<Stream> IPv4ConnectAsync(SocketsHttpConnectionContext context, CancellationToken cancellationToken)
{
// By default, we create dual-mode sockets:
// Socket socket = new Socket(SocketType.Stream, ProtocolType.Tcp);
Socket socket = new(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
socket.NoDelay = true;
try
{
await socket.ConnectAsync(context.DnsEndPoint, cancellationToken).ConfigureAwait(false);
return new NetworkStream(socket, ownsSocket: true);
}
catch
{
socket.Dispose();
throw;
}
}
}
private async Task<bool> ExecuteAsync()
{
var destinationDirectory = new DirectoryInfo(Path.Combine(BasePath, "src", "Playwright", ".drivers"));

Просмотреть файл

@ -2,7 +2,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
<ReleaseVersion>0.0.0</ReleaseVersion>
<IsTool>true</IsTool>
</PropertyGroup>