Skip to content

Commit afae69b

Browse files
authored
Run demo in macOS (#2295)
* Run demo in macOS * run demo on yml change * Just run the project * remove cd * Always use zip library
1 parent e5c4b25 commit afae69b

File tree

3 files changed

+16
-22
lines changed

3 files changed

+16
-22
lines changed

.github/workflows/demo.yml

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010
paths:
1111
- "**.cs"
1212
- "**.csproj"
13+
- "**/demo.yml"
1314

1415
jobs:
1516
build:
@@ -18,7 +19,7 @@ jobs:
1819
runs-on: ${{ matrix.os }}
1920
strategy:
2021
matrix:
21-
os: [windows-2022]
22+
os: [windows-2022, macos-latest]
2223
env:
2324
DOTNET_VERSION: '6.0.x' # The .NET SDK version to use
2425

@@ -27,21 +28,14 @@ jobs:
2728
- uses: actions/setup-dotnet@v1
2829
with:
2930
dotnet-version: ${{ env.DOTNET_VERSION }}
30-
- name: Setup MSBuild
31-
uses: microsoft/[email protected]
3231
- name: Setup NuGet
3332
uses: NuGet/[email protected]
3433

3534
- name: Install dependencies
35+
working-directory: ./demos/PuppeteerSharpPdfDemo
3636
run: |
37-
cd demos/PuppeteerSharpPdfDemo
38-
dir
3937
dotnet restore PuppeteerSharpPdfDemo-Local.csproj
40-
- name: Build
41-
run: |
42-
cd demos/PuppeteerSharpPdfDemo
43-
msbuild PuppeteerSharpPdfDemo-Local.csproj
4438
- name: Run Project
39+
working-directory: ./demos/PuppeteerSharpPdfDemo
4540
run: |
46-
cd demos/PuppeteerSharpPdfDemo
4741
dotnet run -p PuppeteerSharpPdfDemo-Local.csproj -f net6.0 auto-exit

lib/PuppeteerSharp/BrowserFetcher.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,13 @@ private string GetFolderPath(string revision)
268268

269269
private void NativeExtractToDirectory(string zipPath, string folderPath)
270270
{
271+
var destinationDirectoryInfo = new DirectoryInfo(folderPath);
272+
273+
if (!destinationDirectoryInfo.Exists)
274+
{
275+
destinationDirectoryInfo.Create();
276+
}
277+
271278
using var process = new Process();
272279
process.StartInfo.FileName = "unzip";
273280
process.StartInfo.Arguments = $"\"{zipPath}\" -d \"{folderPath}\"";
@@ -392,14 +399,7 @@ private async Task UnpackArchiveAsync(string archivePath, string outputPath, str
392399
{
393400
if (archivePath.EndsWith(".zip", StringComparison.OrdinalIgnoreCase))
394401
{
395-
if (Platform == Platform.MacOS)
396-
{
397-
NativeExtractToDirectory(archivePath, outputPath);
398-
}
399-
else
400-
{
401-
ZipFile.ExtractToDirectory(archivePath, outputPath);
402-
}
402+
ZipFile.ExtractToDirectory(archivePath, outputPath);
403403
}
404404
else if (archivePath.EndsWith(".tar.bz2", StringComparison.OrdinalIgnoreCase))
405405
{

lib/PuppeteerSharp/PuppeteerSharp.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
<Description>Headless Browser .NET API</Description>
1313
<PackageId>PuppeteerSharp</PackageId>
1414
<PackageReleaseNotes></PackageReleaseNotes>
15-
<PackageVersion>11.0.2</PackageVersion>
16-
<ReleaseVersion>11.0.2</ReleaseVersion>
17-
<AssemblyVersion>11.0.2</AssemblyVersion>
18-
<FileVersion>11.0.2</FileVersion>
15+
<PackageVersion>11.0.3</PackageVersion>
16+
<ReleaseVersion>11.0.3</ReleaseVersion>
17+
<AssemblyVersion>11.0.3</AssemblyVersion>
18+
<FileVersion>11.0.3</FileVersion>
1919
<SynchReleaseVersion>false</SynchReleaseVersion>
2020
<StyleCopTreatErrorsAsWarnings>false</StyleCopTreatErrorsAsWarnings>
2121
<DebugType>embedded</DebugType>

0 commit comments

Comments
 (0)