Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge zlib, curl and libxml2 into a single job #829

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 15 additions & 102 deletions .github/workflows/swift-toolchain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -969,23 +969,17 @@ jobs:
symbolsFolder: ${{ github.workspace }}/BinaryCache/1
searchPattern: '**/*.exe'

zlib:
dependencies:
runs-on: ${{ inputs.default_build_runner }}

strategy:
fail-fast: false
matrix: ${{ fromJSON(inputs.target_matrix) }}

name: ${{ matrix.os }} ${{ matrix.arch }} zlib
name: ${{ matrix.os }} ${{ matrix.arch }} Dependencies

steps:
- uses: actions/checkout@v4
with:
repository: madler/zlib
ref: ${{ inputs.zlib_revision }}
path: ${{ github.workspace }}/SourceCache/zlib
show-progress: false

# Setup build tools.
- uses: compnerd/gha-setup-vsdevenv@main
with:
host_arch: amd64
Expand All @@ -1010,14 +1004,22 @@ jobs:
uses: hendrikmuhs/ccache-action@2e0e89e8d74340a03f75d58d02aae4c5ee1b15c6
with:
max-size: 100M
key: ${{ steps.workspace_hash.outputs.hash }}-${{ matrix.os }}-${{ matrix.arch }}-zlib
key: ${{ steps.workspace_hash.outputs.hash }}-${{ matrix.os }}-${{ matrix.arch }}-dependencies
variant: sccache

- uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: ${{ inputs.ANDROID_NDK_VERSION }}

# Build zlib.
- uses: actions/checkout@v4
with:
repository: madler/zlib
ref: ${{ inputs.zlib_revision }}
path: ${{ github.workspace }}/SourceCache/zlib
show-progress: false

- name: Configure zlib
run: |
$NDKPATH = "${{ steps.setup-ndk.outputs.ndk-path }}"
Expand Down Expand Up @@ -1052,61 +1054,14 @@ jobs:
name: zlib-${{ matrix.os }}-${{ matrix.arch }}-${{ inputs.zlib_version }}
path: ${{ github.workspace }}/BuildRoot/Library/zlib-${{ inputs.zlib_version }}/usr

curl:
needs: [zlib]
runs-on: ${{ inputs.default_build_runner }}

strategy:
fail-fast: false
matrix: ${{ fromJSON(inputs.target_matrix) }}

name: ${{ matrix.os }} ${{ matrix.arch }} curl

steps:
# Build curl.
- uses: actions/checkout@v4
with:
repository: curl/curl
ref: ${{ inputs.curl_revision }}
path: ${{ github.workspace }}/SourceCache/curl
show-progress: false

- uses: actions/download-artifact@v4
with:
name: zlib-${{ matrix.os }}-${{ matrix.arch }}-${{ inputs.zlib_version }}
path: ${{ github.workspace }}/BuildRoot/Library/zlib-${{ inputs.zlib_version }}/usr

- uses: compnerd/gha-setup-vsdevenv@main
with:
host_arch: amd64
components: 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64;Microsoft.VisualStudio.Component.VC.Tools.ARM64'
arch: ${{ matrix.arch }}

- uses: seanmiddleditch/gha-setup-ninja@master
if: inputs.build_os == 'Darwin'

- name: Compute workspace hash
id: workspace_hash
run: |
$stringAsStream = [System.IO.MemoryStream]::new()
$writer = [System.IO.StreamWriter]::new($stringAsStream)
$writer.write("${{ github.workspace }}")
$writer.Flush()
$stringAsStream.Position = 0
$hash = (Get-FileHash -Algorithm SHA256 -InputStream $stringAsStream).Hash
echo "hash=$hash" >> $env:GITHUB_OUTPUT

- name: Setup sccache
uses: hendrikmuhs/ccache-action@2e0e89e8d74340a03f75d58d02aae4c5ee1b15c6
with:
max-size: 100M
key: ${{ steps.workspace_hash.outputs.hash }}-${{ matrix.os }}-${{ matrix.arch }}-curl
variant: sccache

- uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: ${{ inputs.ANDROID_NDK_VERSION }}

- name: Configure curl
run: |
$NDKPATH = "${{ steps.setup-ndk.outputs.ndk-path }}"
Expand Down Expand Up @@ -1218,56 +1173,14 @@ jobs:
name: curl-${{ matrix.os }}-${{ matrix.arch }}-${{ inputs.curl_version }}
path: ${{ github.workspace }}/BuildRoot/Library/curl-${{ inputs.curl_version }}/usr

libxml2:
runs-on: ${{ inputs.default_build_runner }}

strategy:
fail-fast: false
matrix: ${{ fromJSON(inputs.target_matrix) }}

name: ${{ matrix.os }} ${{ matrix.arch }} libxml2

steps:
# Build libxml2.
- uses: actions/checkout@v4
with:
repository: gnome/libxml2
ref: ${{ inputs.libxml2_revision }}
path: ${{ github.workspace }}/SourceCache/libxml2
show-progress: false

- uses: compnerd/gha-setup-vsdevenv@main
with:
host_arch: amd64
components: 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64;Microsoft.VisualStudio.Component.VC.Tools.ARM64'
arch: ${{ matrix.arch }}

- uses: seanmiddleditch/gha-setup-ninja@master
if: inputs.build_os == 'Darwin'

- name: Compute workspace hash
id: workspace_hash
shell: pwsh
run: |
$stringAsStream = [System.IO.MemoryStream]::new()
$writer = [System.IO.StreamWriter]::new($stringAsStream)
$writer.write("${{ github.workspace }}")
$writer.Flush()
$stringAsStream.Position = 0
$hash = (Get-FileHash -Algorithm SHA256 -InputStream $stringAsStream).Hash
echo "hash=$hash" >> $env:GITHUB_OUTPUT

- name: Setup sccache
uses: hendrikmuhs/ccache-action@2e0e89e8d74340a03f75d58d02aae4c5ee1b15c6
with:
max-size: 100M
key: ${{ steps.workspace_hash.outputs.hash }}-${{ matrix.os }}-${{ matrix.arch }}-libxml2
variant: sccache

- uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: ${{ inputs.ANDROID_NDK_VERSION }}

- name: Configure libxml2
run: |
$NDKPATH = "${{ steps.setup-ndk.outputs.ndk-path }}"
Expand Down Expand Up @@ -1755,7 +1668,7 @@ jobs:
sdk:
# TODO: Build this on macOS or make an equivalent Mac-only job
if: inputs.build_os == 'Windows'
needs: [libxml2, curl, zlib, compilers, cmark_gfm, stdlib, macros]
needs: [dependencies, compilers, cmark_gfm, stdlib, macros]
runs-on: ${{ inputs.default_build_runner }}

strategy:
Expand Down