Skip to content

Commit

Permalink
[shortfin] Merge Windows and Linux workflows
Browse files Browse the repository at this point in the history
Merges the Windows and Linux workflows by implementing a matrix
strategy. In addition, this adds compiling the shortfin code with GCC to
the CI and makes the pip cache more explicit as it is now defined which
requirements file to include in the hash.
  • Loading branch information
marbre committed Nov 25, 2024
1 parent eacbd9b commit 8496e1b
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 115 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ on:
workflow_dispatch:
pull_request:
paths:
- '.github/workflows/ci_linux_x64-libshortfin.yml'
- '.github/workflows/ci-libshortfin.yml'
- 'shortfin/**'
push:
branches:
- main
paths:
- '.github/workflows/ci_linux_x64-libshortfin.yml'
- '.github/workflows/ci-libshortfin.yml'
- 'shortfin/**'

permissions:
Expand All @@ -36,17 +36,45 @@ env:

jobs:
build-and-test:
name: Build and test
runs-on: ubuntu-24.04
name: "Build and test :: ${{ matrix.name }} :: ${{ matrix.python-version }}"
runs-on: ${{ matrix.runs-on }}
strategy:
fail-fast: false
matrix:
name: ["Ubuntu 24.04 (Clang)", "Ubuntu 24.04 (GCC)", "Windows (MSVC)"]
python-version: ["3.10", "3.11", "3.12"]
include:
- name: Ubuntu 24.04 (Clang)
runs-on: ubuntu-24.04
cmake-options:
-DCMAKE_C_COMPILER=clang-18 -DCMAKE_CXX_COMPILER=clang++-18 -DCMAKE_LINKER_TYPE=LLD
additional-packages: clang lld
- name: Ubuntu 24.04 (GCC)
runs-on: ubuntu-24.04
- name: Windows (MSVC)
runs-on: windows-2022
exclude:
# Only test Python 3.12 with GCC
- name: Ubuntu 24.04 (GCC)
python-version: "3.10"
- name: Ubuntu 24.04 (GCC)
python-version: "3.11"
# TODO: Include additional Python versions for Windows after build got fixed
- name: Windows (MSVC)
python-version: "3.10"
- name: Windows (MSVC)
python-version: "3.11"

steps:
- name: Install dependencies
- name: (Linux) Install dependencies
if: "runner.os == 'Linux'"
run: |
sudo apt update
sudo apt install clang lld cmake ninja-build
sudo apt install cmake ninja-build ${{matrix.additional-packages}}
- name: (Windows) Configure MSVC
if: "runner.os == 'Windows'"
uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0

- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
Expand All @@ -70,13 +98,15 @@ jobs:
git submodule update --init --depth 1 -- third_party/googletest
git submodule update --init --depth 1 -- third_party/hip-build-deps/
- name: Setup Python ${{ matrix.python-version }}
- name: "Setup Python ${{ matrix.python-version }}"
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
cache-dependency-path: |
'shortfin/requirements-tests.txt'
'shortfin/requirements-iree-compiler.txt'
- name: Install Python packages
# TODO: Switch to `pip install -r requirements.txt -e shortfin/`.
working-directory: ${{ env.LIBSHORTFIN_DIR }}
run: |
pip install -r requirements-tests.txt
Expand All @@ -85,17 +115,16 @@ jobs:
- name: Build shortfin (full)
working-directory: ${{ env.LIBSHORTFIN_DIR }}
shell: bash
run: |
mkdir build
cmake -GNinja \
-S. \
-Bbuild \
-DCMAKE_C_COMPILER=clang-18 \
-DCMAKE_CXX_COMPILER=clang++-18 \
-DCMAKE_LINKER_TYPE=LLD \
-DSHORTFIN_BUNDLE_DEPS=ON \
-DSHORTFIN_IREE_SOURCE_DIR="${{ env.IREE_REPO_DIR }}" \
-DSHORTFIN_BUILD_PYTHON_BINDINGS=ON
-DSHORTFIN_BUILD_PYTHON_BINDINGS=ON \
${{matrix.cmake-options}}
cmake --build build --target all
pip install -v -e build/
Expand All @@ -105,7 +134,9 @@ jobs:
ctest --timeout 30 --output-on-failure --test-dir build
pytest -s
- name: Build shortfin (host-only)
- name: "Build shortfin (host-only) :: ${{ matrix.name }} :: ${{ matrix.python-version }}"
# TODO: Enable on Windows after build got fixed
if: "runner.os == 'Linux'"
working-directory: ${{ env.LIBSHORTFIN_DIR }}
run: |
mkdir build-host-only
Expand All @@ -114,12 +145,10 @@ jobs:
cmake -GNinja \
-S. \
-Bbuild-host-only \
-DCMAKE_C_COMPILER=clang-18 \
-DCMAKE_CXX_COMPILER=clang++-18 \
-DCMAKE_LINKER_TYPE=LLD \
-DSHORTFIN_IREE_SOURCE_DIR="${{ env.IREE_REPO_DIR }}" \
-DSHORTFIN_BUILD_PYTHON_BINDINGS=ON \
-DSHORTFIN_HAVE_AMDGPU=OFF \
-DSHORTFIN_BUILD_STATIC=ON \
-DSHORTFIN_BUILD_DYNAMIC=ON
-DSHORTFIN_BUILD_DYNAMIC=ON \
${{matrix.cmake-options}}
cmake --build build-host-only --target all
98 changes: 0 additions & 98 deletions .github/workflows/ci_windows_x64-libshortfin.yml

This file was deleted.

0 comments on commit 8496e1b

Please sign in to comment.