From 837afab98f66d980e9c7ec1e2536a3929436bf2f Mon Sep 17 00:00:00 2001 From: Curt Bushko Date: Fri, 29 Sep 2023 00:43:01 -0400 Subject: [PATCH 1/3] inital windows build support --- .github/workflows/test.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6a8da5e46..87e10d5a5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -68,6 +68,41 @@ jobs: - name: Build Ghostty.app run: cd macos && xcodebuild + build-windows: + runs-on: windows-2019 + # this will not stop other jobs from running + continue-on-error: true + needs: test + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + submodules: recursive + fetch-depth: 0 + # This could be from a script if we wanted to but inlining here for now + # in one place. + # Using powershell so that we do not need to install WSL components. Also, + # WSLv1 is only installed on Github runners. + - name: Install zig + shell: pwsh + run: | + # Get the zig version from build.zig so that it only needs to be updated + $fileContent = Get-Content -Path "build.zig" -Raw + $pattern = 'const required_zig = "(.*?)";' + $zigVersion = [regex]::Match($fileContent, $pattern).Groups[1].Value + Write-Output $version + $version = "zig-windows-x86_64-$zigVersion" + $uri = "https://ziglang.org/builds/$version.zip" + Invoke-WebRequest -Uri "$uri" -OutFile ".\zig-windows.zip" + Expand-Archive -Path ".\zig-windows.zip" -DestinationPath ".\" -Force + Remove-Item -Path ".\zig-windows.zip" + Rename-Item -Path ".\$version" -NewName ".\zig" + Write-Host "Zig installed." + ./zig/zig.exe version + - name: Test Windows + shell: pwsh + run: ./zig/zig.exe build test + test: strategy: matrix: From 54bbcd875a5a9c876a77799defbcddbef56f76b5 Mon Sep 17 00:00:00 2001 From: Curt Bushko Date: Fri, 29 Sep 2023 00:54:19 -0400 Subject: [PATCH 2/3] run prettier --- .github/workflows/test.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 87e10d5a5..b3472a5a4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -67,7 +67,6 @@ jobs: # Nix breaks xcodebuild so this has to be run outside. - name: Build Ghostty.app run: cd macos && xcodebuild - build-windows: runs-on: windows-2019 # this will not stop other jobs from running @@ -80,7 +79,7 @@ jobs: submodules: recursive fetch-depth: 0 # This could be from a script if we wanted to but inlining here for now - # in one place. + # in one place. # Using powershell so that we do not need to install WSL components. Also, # WSLv1 is only installed on Github runners. - name: Install zig From 71d14f5dff57f66b410f4ccb50d2ad2499c61f91 Mon Sep 17 00:00:00 2001 From: Curt Bushko Date: Fri, 29 Sep 2023 10:41:28 -0400 Subject: [PATCH 3/3] create script and dump logs --- .github/workflows/test.yml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b3472a5a4..5bbe1da38 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -98,9 +98,27 @@ jobs: Rename-Item -Path ".\$version" -NewName ".\zig" Write-Host "Zig installed." ./zig/zig.exe version + + - name: Generate build testing script + shell: pwsh + run: | + # Generate a script so that we can swallow the errors + $scriptContent = @" + .\zig\zig.exe build test 2>&1 | Out-File -FilePath "build.log" -Append + exit 0 + "@ + $scriptPath = "zigbuild.ps1" + # Write the script content to a file + $scriptContent | Set-Content -Path $scriptPath + Write-Host "Script generated at: $scriptPath" + - name: Test Windows shell: pwsh - run: ./zig/zig.exe build test + run: .\zigbuild.ps1 -ErrorAction SiltentlyContinue + + - name: Dump logs + shell: pwsh + run: Get-Content -Path ".\build.log" test: strategy: