Skip to content

[Mac build] Build cmark-gfm on Mac #816

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

Merged
merged 2 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions .github/workflows/build-toolchain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ jobs:
swift_atomics_revision: ${{ steps.context.outputs.swift_atomics_revision }}
swift_certificates_revision: ${{ steps.context.outputs.swift_certificates_revision }}
swift_cmark_revision: ${{ steps.context.outputs.swift_cmark_revision }}
swift_cmark_version: ${{ steps.context.outputs.swift_cmark_version }}
swift_collections_revision: ${{ steps.context.outputs.swift_collections_revision }}
swift_corelibs_foundation_revision: ${{ steps.context.outputs.swift_corelibs_foundation_revision }}
swift_corelibs_libdispatch_revision: ${{ steps.context.outputs.swift_corelibs_libdispatch_revision }}
Expand Down Expand Up @@ -217,6 +218,7 @@ jobs:
fi

echo swift_toolchain_sqlite_version=3.46.0 >> ${GITHUB_OUTPUT}
echo swift_cmark_version=0.29.0.gfm.13 >> ${GITHUB_OUTPUT}

# FIXME(z2oh): Remove /D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR when GitHub runner image updates to 20240610.1.
# see: https://github.com/actions/runner-images/issues/10004
Expand Down Expand Up @@ -343,6 +345,7 @@ jobs:
swift_atomics_revision: ${{ needs.context.outputs.swift_atomics_revision }}
swift_certificates_revision: ${{ needs.context.outputs.swift_certificates_revision }}
swift_cmark_revision: ${{ needs.context.outputs.swift_cmark_revision }}
swift_cmark_version: ${{ needs.context.outputs.swift_cmark_version }}
swift_collections_revision: ${{ needs.context.outputs.swift_collections_revision }}
swift_corelibs_foundation_revision: ${{ needs.context.outputs.swift_corelibs_foundation_revision }}
swift_corelibs_libdispatch_revision: ${{ needs.context.outputs.swift_corelibs_libdispatch_revision }}
Expand Down Expand Up @@ -407,6 +410,7 @@ jobs:
swift_atomics_revision: ${{ needs.context.outputs.swift_atomics_revision }}
swift_certificates_revision: ${{ needs.context.outputs.swift_certificates_revision }}
swift_cmark_revision: ${{ needs.context.outputs.swift_cmark_revision }}
swift_cmark_version: ${{ needs.context.outputs.swift_cmark_version }}
swift_collections_revision: ${{ needs.context.outputs.swift_collections_revision }}
swift_corelibs_foundation_revision: ${{ needs.context.outputs.swift_corelibs_foundation_revision }}
swift_corelibs_libdispatch_revision: ${{ needs.context.outputs.swift_corelibs_libdispatch_revision }}
Expand Down
109 changes: 57 additions & 52 deletions .github/workflows/swift-toolchain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ on:
required: true
type: string

swift_cmark_version:
required: true
type: string

swift_collections_revision:
required: true
type: string
Expand Down Expand Up @@ -222,6 +226,10 @@ on:
env:
SCCACHE_DIRECT: on

defaults:
run:
shell: pwsh

jobs:
sqlite:
runs-on: ${{ inputs.default_build_runner }}
Expand All @@ -232,10 +240,6 @@ jobs:

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

defaults:
run:
shell: pwsh

steps:
- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -304,16 +308,13 @@ jobs:
path: ${{ github.workspace }}/BuildRoot/Library/sqlite-${{ inputs.swift_toolchain_sqlite_version }}/usr

cmark_gfm:
# TODO: Build this on macOS or make an equivalent Mac-only job
if: inputs.build_os == 'Windows'
runs-on: ${{ inputs.default_build_runner }}

strategy:
fail-fast: false
matrix:
arch: ['amd64', 'arm64']
matrix: ${{ fromJSON(inputs.host_matrix) }}

name: Windows ${{ matrix.arch }} CMark GFM
name: ${{ matrix.os }} ${{ matrix.arch }} CMark GFM

steps:
- uses: actions/checkout@v4
Expand All @@ -325,13 +326,15 @@ jobs:

- uses: compnerd/gha-setup-vsdevenv@main
with:
host_arch: amd64
host_arch: ${{ inputs.build_arch }}
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)
Expand All @@ -345,34 +348,36 @@ jobs:
uses: hendrikmuhs/ccache-action@2e0e89e8d74340a03f75d58d02aae4c5ee1b15c6
with:
max-size: 1M
key: ${{ steps.workspace_hash.outputs.hash }}-windows-${{ matrix.arch }}-cmark-gfm
key: ${{ steps.workspace_hash.outputs.hash }}-${{ matrix.os }}-${{ matrix.arch }}-cmark-gfm
variant: sccache

- name: Configure cmark-gfm
run: >
cmake -B ${{ github.workspace }}/BinaryCache/cmark-gfm-0.29.0.gfm.13 `
cmake -B ${{ github.workspace }}/BinaryCache/cmark-gfm-${{ inputs.swift_cmark_version }} `
-D BUILD_SHARED_LIBS=YES `
-D BUILD_TESTING=NO `
-D CMAKE_BUILD_TYPE=Release `
-D CMAKE_C_COMPILER=cl `
-D CMAKE_C_COMPILER=${{ matrix.cc }} `
-D CMAKE_C_COMPILER_LAUNCHER=sccache `
-D CMAKE_C_COMPILER_FLAGS="${{ inputs.WINDOWS_CMAKE_C_FLAGS }}" `
-D CMAKE_CXX_COMPILER=cl `
-D CMAKE_C_COMPILER_FLAGS="${{ matrix.cflags }}" `
-D CMAKE_CXX_COMPILER=${{ matrix.cxx }} `
-D CMAKE_CXX_COMPILER_LAUNCHER=sccache `
-D CMAKE_CXX_FLAGS="${{ inputs.WINDOWS_CMAKE_CXX_FLAGS }}" `
-D CMAKE_CXX_FLAGS="${{ matrix.cxxflags }}" `
-D CMAKE_MT=mt `
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/cmark-gfm-0.29.0.gfm.13/usr `
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr `
-D CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=YES `
-D CMAKE_SYSTEM_NAME=${{ matrix.os }} `
-D CMAKE_SYSTEM_PROCESSOR=${{ matrix.arch }} `
-S ${{ github.workspace }}/SourceCache/cmark-gfm `
-G Ninja
- name: Build cmark-gfm
run: cmake --build ${{ github.workspace }}/BinaryCache/cmark-gfm-0.29.0.gfm.13
run: cmake --build ${{ github.workspace }}/BinaryCache/cmark-gfm-${{ inputs.swift_cmark_version }}
- name: Install cmark-gfm
run: cmake --build ${{ github.workspace }}/BinaryCache/cmark-gfm-0.29.0.gfm.13 --target install
run: cmake --build ${{ github.workspace }}/BinaryCache/cmark-gfm-${{ inputs.swift_cmark_version }} --target install
- uses: actions/upload-artifact@v4
with:
name: cmark-gfm-${{ matrix.arch }}-0.29.0.gfm.13
path: ${{ github.workspace }}/BuildRoot/Library/cmark-gfm-0.29.0.gfm.13/usr
name: cmark-gfm-${{ matrix.os }}-${{ matrix.arch }}-${{ inputs.swift_cmark_version }}
path: ${{ github.workspace }}/BuildRoot/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr

build_tools:
# TODO: Build this on macOS or make an equivalent Mac-only job
Expand All @@ -385,8 +390,8 @@ jobs:
steps:
- uses: actions/download-artifact@v4
with:
name: cmark-gfm-amd64-0.29.0.gfm.13
path: ${{ github.workspace }}/BuildRoot/Library/cmark-gfm-0.29.0.gfm.13/usr
name: cmark-gfm-Windows-amd64-${{ inputs.swift_cmark_version }}
path: ${{ github.workspace }}/BuildRoot/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr

- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -433,7 +438,7 @@ jobs:
-D CMAKE_CXX_COMPILER_LAUNCHER=sccache `
-D CMAKE_CXX_FLAGS="${{ inputs.WINDOWS_CMAKE_CXX_FLAGS }}" `
-D CMAKE_MT=mt `
-D cmark-gfm_DIR=${{ github.workspace }}/BuildRoot/Library/cmark-gfm-0.29.0.gfm.13/usr/lib/cmake `
-D cmark-gfm_DIR=${{ github.workspace }}/BuildRoot/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr/lib/cmake `
-G Ninja `
-S ${{ github.workspace }}/SourceCache/llvm-project/llvm `
-D LLVM_ENABLE_ASSERTIONS=NO `
Expand Down Expand Up @@ -523,8 +528,8 @@ jobs:
path: ${{ github.workspace }}/BinaryCache/0/bin
- uses: actions/download-artifact@v4
with:
name: cmark-gfm-${{ matrix.arch }}-0.29.0.gfm.13
path: ${{ github.workspace }}/BuildRoot/Library/cmark-gfm-0.29.0.gfm.13/usr
name: cmark-gfm-Windows-${{ matrix.arch }}-${{ inputs.swift_cmark_version }}
path: ${{ github.workspace }}/BuildRoot/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr

- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -685,7 +690,7 @@ jobs:
-D SWIFT_PATH_TO_SWIFT_SDK="${SDKROOT}" `
-D CLANG_VENDOR=compnerd.org `
-D CLANG_VENDOR_UTI=org.compnerd.dt `
-D cmark-gfm_DIR=${{ github.workspace }}/BuildRoot/Library/cmark-gfm-0.29.0.gfm.13/usr/lib/cmake `
-D cmark-gfm_DIR=${{ github.workspace }}/BuildRoot/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr/lib/cmake `
-D PACKAGE_VENDOR=compnerd.org `
-D SWIFT_VENDOR=compnerd.org `
-D LLVM_PARALLEL_LINK_JOBS=2 `
Expand Down Expand Up @@ -1380,11 +1385,11 @@ jobs:
path: ${{ github.workspace }}/BuildRoot/Library
- uses: actions/download-artifact@v4
with:
name: cmark-gfm-amd64-0.29.0.gfm.13
path: ${{ github.workspace }}/BuildRoot/Library/cmark-gfm-0.29.0.gfm.13/usr
name: cmark-gfm-Windows-amd64-${{ inputs.swift_cmark_version }}
path: ${{ github.workspace }}/BuildRoot/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr

- name: cmark-gfm Setup
run: Copy-Item ${{ github.workspace }}/BuildRoot/Library/cmark-gfm-0.29.0.gfm.13/usr/bin/*.dll ${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/
run: Copy-Item ${{ github.workspace }}/BuildRoot/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr/bin/*.dll ${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/

- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -1596,11 +1601,11 @@ jobs:
path: ${{ github.workspace }}/BinaryCache/swift/stdlib
- uses: actions/download-artifact@v4
with:
name: cmark-gfm-amd64-0.29.0.gfm.13
path: ${{ github.workspace }}/BinaryCache/Library/cmark-gfm-0.29.0.gfm.13/usr
name: cmark-gfm-Windows-amd64-${{ inputs.swift_cmark_version }}
path: ${{ github.workspace }}/BinaryCache/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr

- name: cmark-gfm Setup
run: Copy-Item ${{ github.workspace }}/BinaryCache/Library/cmark-gfm-0.29.0.gfm.13/usr/bin/*.dll ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/
run: Copy-Item ${{ github.workspace }}/BinaryCache/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr/bin/*.dll ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/

- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -1847,11 +1852,11 @@ jobs:
path: ${{ github.workspace }}/BinaryCache/Library
- uses: actions/download-artifact@v4
with:
name: cmark-gfm-amd64-0.29.0.gfm.13
path: ${{ github.workspace }}/BinaryCache/Library/cmark-gfm-0.29.0.gfm.13/usr
name: cmark-gfm-Windows-amd64-${{ inputs.swift_cmark_version }}
path: ${{ github.workspace }}/BinaryCache/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr

- name: cmark-gfm Setup
run: Copy-Item ${{ github.workspace }}/BinaryCache/Library/cmark-gfm-0.29.0.gfm.13/usr/bin/*.dll ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/
run: Copy-Item ${{ github.workspace }}/BinaryCache/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr/bin/*.dll ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/

- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -2255,17 +2260,17 @@ jobs:
path: ${{ github.workspace }}/BinaryCache/swift-syntax
- uses: actions/download-artifact@v4
with:
name: cmark-gfm-amd64-0.29.0.gfm.13
path: ${{ github.workspace }}/BinaryCache/Library/cmark-gfm-0.29.0.gfm.13/usr
name: cmark-gfm-Windows-amd64-${{ inputs.swift_cmark_version }}
path: ${{ github.workspace }}/BinaryCache/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr

- name: cmark-gfm Setup
run: Copy-Item ${{ github.workspace }}/BinaryCache/Library/cmark-gfm-0.29.0.gfm.13/usr/bin/*.dll ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/
run: Copy-Item ${{ github.workspace }}/BinaryCache/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr/bin/*.dll ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/

- uses: actions/download-artifact@v4
if: matrix.arch == 'arm64'
with:
name: cmark-gfm-arm64-0.29.0.gfm.13
path: ${{ github.workspace }}/BinaryCache/Library/cmark-gfm-0.29.0.gfm.13/usr
name: cmark-gfm-Windows-arm64-${{ inputs.swift_cmark_version }}
path: ${{ github.workspace }}/BinaryCache/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr

- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -2773,7 +2778,7 @@ jobs:
-G Ninja `
-S ${{ github.workspace }}/SourceCache/swift-markdown `
-D ArgumentParser_DIR=${{ github.workspace }}/BinaryCache/swift-argument-parser/cmake/modules `
-D cmark-gfm_DIR=${{ github.workspace }}/BinaryCache/Library/cmark-gfm-0.29.0.gfm.13/usr/lib/cmake
-D cmark-gfm_DIR=${{ github.workspace }}/BinaryCache/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr/lib/cmake
- name: Build Markdown
run: cmake --build ${{ github.workspace }}/BinaryCache/swift-markdown

Expand All @@ -2800,7 +2805,7 @@ jobs:
-G Ninja `
-S ${{ github.workspace }}/SourceCache/swift-format `
-D ArgumentParser_DIR=${{ github.workspace }}/BinaryCache/swift-argument-parser/cmake/modules `
-D cmark-gfm_DIR=${{ github.workspace }}/BinaryCache/Library/cmark-gfm-0.29.0.gfm.13/usr/lib/cmake `
-D cmark-gfm_DIR=${{ github.workspace }}/BinaryCache/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr/lib/cmake `
-D SwiftMarkdown_DIR=${{ github.workspace }}/BinaryCache/swift-markdown/cmake/modules `
-D SwiftSyntax_DIR=${{ github.workspace }}/BinaryCache/swift-syntax/cmake/modules
- name: Build swift-format
Expand Down Expand Up @@ -2968,17 +2973,17 @@ jobs:
path: ${{ github.workspace }}/BuildRoot/Library/Developer/Platforms/Windows.platform
- uses: actions/download-artifact@v4
with:
name: cmark-gfm-amd64-0.29.0.gfm.13
path: ${{ github.workspace }}/BuildRoot/Library/cmark-gfm-0.29.0.gfm.13/usr
name: cmark-gfm-Windows-amd64-${{ inputs.swift_cmark_version }}
path: ${{ github.workspace }}/BuildRoot/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr

- name: cmark-gfm Setup
run: Copy-Item ${{ github.workspace }}/BuildRoot/Library/cmark-gfm-0.29.0.gfm.13/usr/bin/*.dll ${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/
run: Copy-Item ${{ github.workspace }}/BuildRoot/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr/bin/*.dll ${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/

- uses: actions/download-artifact@v4
if: matrix.arch == 'arm64'
with:
name: cmark-gfm-arm64-0.29.0.gfm.13
path: ${{ github.workspace }}/BuildRoot/Library/cmark-gfm-0.29.0.gfm.13/usr
name: cmark-gfm-Windows-arm64-${{ inputs.swift_cmark_version }}
path: ${{ github.workspace }}/BuildRoot/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr

- name: Update environment variables
run: |
Expand Down Expand Up @@ -3119,11 +3124,11 @@ jobs:
- name: Download cmark-gfm
uses: actions/download-artifact@v4
with:
name: cmark-gfm-${{ matrix.arch }}-0.29.0.gfm.13
path: ${{ github.workspace }}/BuildRoot/Library/cmark-gfm-0.29.0.gfm.13/usr
name: cmark-gfm-Windows-${{ matrix.arch }}-${{ inputs.swift_cmark_version }}
path: ${{ github.workspace }}/BuildRoot/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr

- name: cmark-gfm Setup
run: Copy-Item ${{ github.workspace }}/BuildRoot/Library/cmark-gfm-0.29.0.gfm.13/usr/bin/*.dll ${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/
run: Copy-Item ${{ github.workspace }}/BuildRoot/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr/bin/*.dll ${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/

- uses: actions/checkout@v4
with:
Expand Down