Skip to content

Commit ccc152d

Browse files
committed
Update mac workflow to try and use a conda environment.
1 parent e934187 commit ccc152d

File tree

1 file changed

+31
-15
lines changed

1 file changed

+31
-15
lines changed

.github/workflows/test_suite_macos.yml

+31-15
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Workflow to run the FTorch test suite
1+
# Workflow to run the FTorch test suite on Macos platforms
22
name: TestSuiteMacOS
33

44
# Controls when the workflow will run
@@ -66,6 +66,9 @@ jobs:
6666
toolchain: {compiler: lfortran, version: '0.33.0'}
6767
- os: macos-13
6868
toolchain: {compiler: lfortran, version: '0.33.0'}
69+
defaults:
70+
run:
71+
shell: bash -el {0}
6972

7073
# Steps represent a sequence of tasks that will be executed as part of the job
7174
steps:
@@ -86,38 +89,51 @@ jobs:
8689
env:
8790
FC: ${{ steps.setup-fortran.outputs.fc }}
8891

89-
- name: Install Python
90-
uses: actions/setup-python@v5
92+
# Conda following instructions at https://github.com/conda-incubator/setup-miniconda
93+
- name: Setup Conda environment
94+
uses: conda-incubator/setup-miniconda@v3
95+
continue-on-error: true
9196
with:
92-
python-version: '3.11'
97+
environment-file: conda/environment_mac.yaml
98+
activate-environment: ftorch-mac
99+
miniforge-version: latest
100+
- name: Check arm64
101+
run: |
102+
python -c "import platform; assert platform.machine() == 'arm64', platform.machine()"
103+
104+
- name: Check conda
105+
run: |
106+
conda info
107+
conda list
93108
94-
- name: Install PyTorch
109+
- name: Install pFUnit
95110
run: |
96-
python -m pip install --upgrade pip
97-
python -m venv ftorch
98-
. ftorch/bin/activate
99-
pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
111+
# TODO: Avoid version pinning (needed because version appears in install path)
112+
git clone -b v4.10.0 https://github.com/Goddard-Fortran-Ecosystem/pFUnit.git
113+
mkdir pFUnit/build
114+
cd pFUnit/build
115+
cmake .. -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX
116+
make -j 4 install
100117
101118
- name: Build FTorch
102119
run: |
103-
. ftorch/bin/activate
104120
VN=$(python -c "import sys; print('.'.join(sys.version.split('.')[:2]))")
105-
export Torch_DIR=${VIRTUAL_ENV}/lib/python${VN}/site-packages
106-
export BUILD_DIR=$(pwd)/src/build
121+
export BUILD_DIR=$(pwd)/build
107122
mkdir ${BUILD_DIR}
108123
cd ${BUILD_DIR}
124+
python -c 'import torch;print(torch.utils.cmake_prefix_path)'
109125
cmake .. \
110-
-DPython_EXECUTABLE="$(which python)" \
126+
-DCMAKE_PREFIX_PATH=${CONDA_PREFIX} \
127+
-DTorch_DIR=$(python -c 'import torch;print(torch.utils.cmake_prefix_path)') \
111128
-DCMAKE_BUILD_TYPE=Release \
112129
-DCMAKE_Fortran_COMPILER=${FC} \
113130
-DCMAKE_C_COMPILER=${CC} \
114131
-DCMAKE_CXX_COMPILER=${CXX} \
115-
-DCMAKE_INSTALL_PREFIX=${BUILD_DIR} \
132+
-DCMAKE_INSTALL_PREFIX=${CONDA_PREFIX} \
116133
-DCMAKE_BUILD_TESTS=TRUE
117134
cmake --build .
118135
cmake --install .
119136
120137
- name: Integration tests
121138
run: |
122-
. ftorch/bin/activate
123139
./run_integration_tests.sh -V

0 commit comments

Comments
 (0)