Skip to content

Commit

Permalink
Merge zlib, curl and libxml2 into a single job
Browse files Browse the repository at this point in the history
These 3 jobs are all configured the same way and do not need to be
separate jobs each spinning a new build bot instance.

Fixes #825
  • Loading branch information
Steelskin committed Sep 6, 2024
1 parent fa5a84d commit 46999bc
Showing 1 changed file with 15 additions and 102 deletions.
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:
target_libs:
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 }} Target libs

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 }}-target-libs
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: [target_libs, compilers, cmark_gfm, stdlib, macros]
runs-on: ${{ inputs.default_build_runner }}

strategy:
Expand Down

0 comments on commit 46999bc

Please sign in to comment.