Skip to content

Commit 86e0711

Browse files
authored
[shortfin] Refactor to avoid changing directories (#234)
Instead of changing into the directories, the working directories are now set in the jobs.
1 parent 6d52025 commit 86e0711

File tree

3 files changed

+33
-26
lines changed

3 files changed

+33
-26
lines changed

.github/workflows/ci_linux_x64-libshortfin.yml

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ jobs:
5757
ref: candidate-20240904.1006
5858

5959
- name: Initalize IREE submodules
60+
working-directory: ${{ env.IREE_REPO_DIR }}
6061
run : |
61-
cd ${{ env.IREE_REPO_DIR }}
6262
git submodule update --init --depth 1 -- third_party/benchmark
6363
git submodule update --init --depth 1 -- third_party/cpuinfo/
6464
git submodule update --init --depth 1 -- third_party/flatcc
@@ -72,40 +72,44 @@ jobs:
7272
cache: "pip"
7373
- name: Install Python packages
7474
# TODO: Switch to `pip install -r requirements.txt -e shortfin/`.
75+
working-directory: ${{ env.LIBSHORTFIN_DIR }}
7576
run: |
76-
pip install -r ${{ env.LIBSHORTFIN_DIR }}/requirements-tests.txt
77-
pip install -r ${{ env.LIBSHORTFIN_DIR }}/requirements-iree-compiler.txt
77+
pip install -r requirements-tests.txt
78+
pip install -r requirements-iree-compiler.txt
7879
pip freeze
7980
8081
- name: Build shortfin (full)
82+
working-directory: ${{ env.LIBSHORTFIN_DIR }}
8183
run: |
82-
mkdir ${{ env.LIBSHORTFIN_DIR }}/build
83-
cd ${{ env.LIBSHORTFIN_DIR }}/build
84+
mkdir build
8485
cmake -GNinja \
86+
-S. \
87+
-Bbuild \
8588
-DCMAKE_C_COMPILER=clang-18 \
8689
-DCMAKE_CXX_COMPILER=clang++-18 \
8790
-DCMAKE_LINKER_TYPE=LLD \
8891
-DSHORTFIN_BUNDLE_DEPS=ON \
8992
-DSHORTFIN_IREE_SOURCE_DIR=${{ env.IREE_REPO_DIR }} \
9093
-DSHORTFIN_BUILD_PYTHON_BINDINGS=ON \
9194
..
92-
cmake --build . --target all
93-
pip install -v -e .
95+
cmake --build build --target all
96+
pip install -v -e build/
9497
9598
- name: Test shortfin (full)
99+
working-directory: ${{ env.LIBSHORTFIN_DIR }}
96100
run: |
97-
cd ${{ env.LIBSHORTFIN_DIR }}/build
98-
ctest --timeout 30 --output-on-failure
99-
cd ${{ env.LIBSHORTFIN_DIR }}
101+
ctest --timeout 30 --output-on-failure --test-dir build
100102
pytest -s
101103
102104
- name: Build shortfin (host-only)
105+
working-directory: ${{ env.LIBSHORTFIN_DIR }}
103106
run: |
104-
mkdir ${{ env.LIBSHORTFIN_DIR }}/build-host-only
105-
cd ${{ env.LIBSHORTFIN_DIR }}/build-host-only
107+
mkdir build-host-only
106108
# In this configuration, also build static+dynamic in order to verify
107109
# that path structurally works.
108110
cmake -GNinja \
111+
-S. \
112+
-Bbuild-host-only \
109113
-DCMAKE_C_COMPILER=clang-18 \
110114
-DCMAKE_CXX_COMPILER=clang++-18 \
111115
-DCMAKE_LINKER_TYPE=LLD \
@@ -115,4 +119,4 @@ jobs:
115119
-DSHORTFIN_BUILD_STATIC=ON \
116120
-DSHORTFIN_BUILD_DYNAMIC=ON \
117121
..
118-
cmake --build . --target all
122+
cmake --build build-host-only --target all

.github/workflows/ci_linux_x64_asan-libshortfin.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ jobs:
7171

7272
- name: Install pyenv & Python
7373
if: steps.cache-python-asan.outputs.cache-hit != 'true'
74+
working-directory: ${{ env.PYENV_ROOT }}
7475
run: |
75-
cd ${{ env.PYENV_ROOT }}
7676
src/configure && make -C src
7777
export PATH=${{ env.PYENV_ROOT }}/bin:$PATH && eval "$(pyenv init -)"
7878
CC=clang-18 CXX=clang++-18 LDFLAGS="-lstdc++" PYTHON_CONFIGURE_OPTS="--with-address-sanitizer" pyenv install -v ${{ env.PYTHON_VER }}
@@ -109,8 +109,8 @@ jobs:
109109
ref: candidate-20240904.1006
110110

111111
- name: Initalize IREE submodules
112+
working-directory: ${{ env.IREE_SOURCE_DIR }}
112113
run : |
113-
cd ${{ env.IREE_SOURCE_DIR }}
114114
git submodule update --init --depth 1 -- third_party/benchmark
115115
git submodule update --init --depth 1 -- third_party/cpuinfo/
116116
git submodule update --init --depth 1 -- third_party/flatcc
@@ -138,10 +138,11 @@ jobs:
138138

139139
- name: Install Python dependencies
140140
if: steps.cache-python-deps-restore.outputs.cache-hit != 'true'
141+
working-directory: ${{ env.LIBSHORTFIN_DIR }}
141142
run: |
142143
eval "$(pyenv init -)"
143-
pip install -r ${{ env.LIBSHORTFIN_DIR }}/requirements-tests.txt
144-
pip install -r ${{ env.LIBSHORTFIN_DIR }}/requirements-iree-compiler.txt
144+
pip install -r requirements-tests.txt
145+
pip install -r requirements-iree-compiler.txt
145146
pip freeze
146147
147148
- name: Save Python dependencies cache
@@ -153,9 +154,9 @@ jobs:
153154
key: ${{ steps.cache-python-deps-restore.outputs.cache-primary-key }}
154155

155156
- name: Build shortfin
157+
working-directory: ${{ env.LIBSHORTFIN_DIR }}
156158
run: |
157159
eval "$(pyenv init -)"
158-
cd ${{ env.LIBSHORTFIN_DIR }}
159160
SHORTFIN_IREE_SOURCE_DIR="${{ env.IREE_SOURCE_DIR }}" \
160161
SHORTFIN_ENABLE_ASAN=ON \
161162
SHORTFIN_DEV_MODE=ON \
@@ -167,7 +168,7 @@ jobs:
167168
env:
168169
# TODO(#151): Don't ignore ODR violations
169170
ASAN_OPTIONS: detect_odr_violation=0
171+
working-directory: ${{ env.LIBSHORTFIN_DIR }}
170172
run: |
171173
eval "$(pyenv init -)"
172-
cd ${{ env.LIBSHORTFIN_DIR }}
173174
pytest -s

.github/workflows/ci_linux_x64_nogil-libshortfin.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ jobs:
5656
ref: candidate-20240904.1006
5757

5858
- name: Initalize IREE submodules
59+
working-directory: ${{ env.IREE_REPO_DIR }}
5960
run : |
60-
cd ${{ env.IREE_REPO_DIR }}
6161
git submodule update --init --depth 1 -- third_party/benchmark
6262
git submodule update --init --depth 1 -- third_party/cpuinfo/
6363
git submodule update --init --depth 1 -- third_party/flatcc
@@ -75,10 +75,12 @@ jobs:
7575
pip freeze
7676
7777
- name: Build shortfin (full)
78+
working-directory: ${{ env.LIBSHORTFIN_DIR }}
7879
run: |
79-
mkdir ${{ env.LIBSHORTFIN_DIR }}/build
80-
cd ${{ env.LIBSHORTFIN_DIR }}/build
80+
mkdir build
8181
cmake -GNinja \
82+
-S. \
83+
-Bbuild \
8284
-DCMAKE_BUILD_TYPE=Debug \
8385
-DCMAKE_C_COMPILER=clang-18 \
8486
-DCMAKE_CXX_COMPILER=clang++-18 \
@@ -87,12 +89,12 @@ jobs:
8789
-DSHORTFIN_IREE_SOURCE_DIR=${{ env.IREE_REPO_DIR }} \
8890
-DSHORTFIN_BUILD_PYTHON_BINDINGS=ON \
8991
..
90-
cmake --build . --target all
91-
pip install -v -e .
92+
cmake --build build --target all
93+
pip install -v -e build/
9294
9395
- name: Run shortfin Python tests (full)
96+
working-directory: ${{ env.LIBSHORTFIN_DIR }}
9497
run: |
95-
cd ${{ env.LIBSHORTFIN_DIR }}
9698
pytest -s --ignore=tests/examples/fastapi_test.py
9799
# TODO: Enable further tests and switch to
98-
# pytest -s tests
100+
# pytest -s

0 commit comments

Comments
 (0)