Skip to content

Commit

Permalink
Setup initial workflow for building on Windows. (#73)
Browse files Browse the repository at this point in the history
Progress on #36.

This adds a new workflow, triggered as part of ci.yml, that configures
and builds a subset of the project.

Future changes will:

* Switch to a more powerful self-hosted runner instead of using standard
GitHub-hosted runners (we have some runners but they need some
configuration to be able to run the `repo` tool without `SSL:
CERTIFICATE_VERIFY_FAILED` errors)
* Build more subprojects (this will patches or upstream changes to each
subproject to improve portability)
  • Loading branch information
ScottTodd authored Feb 13, 2025
1 parent 509ec09 commit ed4a1e5
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 2 deletions.
78 changes: 78 additions & 0 deletions .github/workflows/build_windows_packages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Build Windows Packages

on:
workflow_dispatch:
inputs:
package_version:
type: string
default: ADHOCBUILD

workflow_call:
inputs:
package_version:
type: string
default: ADHOCBUILD

jobs:
build_windows_packages:
name: Build Windows Packages
runs-on: windows-2022 # TODO(#36): move to cluster of CPU builders like `azure-windows-scale-nod-ai`
defaults:
run:
shell: bash
strategy:
fail-fast: true
steps:
- name: Enabling git symlinks
run: git config --global core.symlinks true
- name: "Checking out repository"
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: "3.12"

- name: Install ninja
run: choco install ninja --yes

- name: Fetch sources
run: |
git config --global user.email "[email protected]"
git config --global user.name "Nobody"
python ./build_tools/fetch_sources.py --depth 1
# TODO(scotttodd): Get symlinks working on CI runners instead of this
- name: Replace symlinks with copies
run: ./build_tools/patch_symlinks_for_windows_ci.sh

- name: Configure MSVC
uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0

# TODO: We shouldn't be using a cache on actual release branches, but it
# really helps for iteration time.
- name: Setup ccache
uses: hendrikmuhs/ccache-action@53911442209d5c18de8a31615e0923161e435875 # v1.2.16
with:
key: windows-build-packages-v1

- name: Configure Projects
run: |
# Generate a new build id.
package_version="${{ inputs.package_version }}"
echo "Building package ${package_version}"
# Build.
cmake -B build -GNinja . \
-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DTHEROCK_AMDGPU_FAMILIES=gfx110X-dgpu \
-DTHEROCK_PACKAGE_VERSION="${package_version}" \
-DTHEROCK_ENABLE_CORE=OFF \
-DTHEROCK_ENABLE_COMM_LIBS=OFF \
-DTHEROCK_ENABLE_MATH_LIBS=OFF \
-DTHEROCK_ENABLE_ML_LIBS=OFF
- name: Build Projects
run: cmake --build build

- name: Report
if: ${{ !cancelled() }}
run: |
ls -lh build
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ jobs:
name: Build Linux Packages
uses: ./.github/workflows/build_linux_packages.yml

build_windows_packages:
name: Build Windows Packages
uses: ./.github/workflows/build_windows_packages.yml

# build_python_packages:
# name: Build Python Packages
# uses: ./.github/workflows/build_python_packages.yml
25 changes: 25 additions & 0 deletions build_tools/patch_symlinks_for_windows_ci.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash
# Replaces symlinks for source folders with direct copies of files.
# This helps set up files for Windows CI runners that do not have symlinks
# fully configured. This should usually *NOT* be run on development machines
# since it makes destructive changes.

this_dir="$(cd $(dirname $0) && pwd)"
root_dir="$(cd $this_dir/.. && pwd)"

cd ${root_dir}

# Remove the original symlinks.
rm base/half
rm base/rocm-cmake
rm base/rocm-core

# Delete .git folders which are symlinks too. CI doesn't need them.
rm -rf sources/half/.git
rm -rf sources/rocm-cmake/.git
rm -rf sources/rocm-core/.git

# Copy from sources/ to where the symlinks were.
cp -r sources/half base
cp -r sources/rocm-cmake base
cp -r sources/rocm-core base
3 changes: 1 addition & 2 deletions docs/development/windows_support.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,5 +135,4 @@ Ensure that MSVC is used by looking for lines like these in the logs:
cmake --build build
```

At the moment this should build some dependencies like eigen and boost, as well
as some projects in [`base/`](../../base/).
At the moment this should build some projects in [`base/`](../../base/).

0 comments on commit ed4a1e5

Please sign in to comment.