Skip to content

Commit 8ee57ee

Browse files
committed
Add macos test suite
1 parent 232d601 commit 8ee57ee

File tree

1 file changed

+123
-0
lines changed

1 file changed

+123
-0
lines changed
+123
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
# Workflow to run the FTorch test suite
2+
name: TestSuiteMacOS
3+
4+
# Controls when the workflow will run
5+
on:
6+
# Triggers the workflow on pushes to the "main" branch, i.e., PR merges
7+
push:
8+
branches: [ "main" ]
9+
10+
# Triggers the workflow on pushes to open pull requests with code changes
11+
pull_request:
12+
paths:
13+
- '.github/workflows/test_suite_macos.yml'
14+
- '**.c'
15+
- '**.cpp'
16+
- '**.fypp'
17+
- '**.f90'
18+
- '**.F90'
19+
- '**.pf'
20+
- '**.py'
21+
- '**.sh'
22+
- '**CMakeLists.txt'
23+
- '**requirements.txt'
24+
- '**data/*'
25+
26+
# Allows you to run this workflow manually from the Actions tab
27+
workflow_dispatch:
28+
29+
# Cancel jobs running if new commits are pushed
30+
concurrency:
31+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
32+
cancel-in-progress: true
33+
34+
# Workflow run - one or more jobs that can run sequentially or in parallel
35+
jobs:
36+
# This workflow contains a single job called "test-suite-macos"
37+
test-suite-macos:
38+
# The type of runner that the job will run on
39+
runs-on: ${{ matrix.os }}
40+
strategy:
41+
fail-fast: false
42+
matrix:
43+
include:
44+
# Newest possible gcc on macos-latest (arm64)
45+
- os: macos-latest
46+
toolchain: {compiler: gcc, version: 13}
47+
# Oldest possible gcc on macos-latest (arm64)
48+
- os: macos-latest
49+
toolchain: {compiler: gcc, version: 11}
50+
# Newest possible gcc on macos (x86)
51+
- os: macos-15
52+
toolchain: {compiler: gcc, version: 13}
53+
- os: macos-13
54+
toolchain: {compiler: gcc, version: 13}
55+
# Newest possible intel-classic on macos
56+
- os: macos-15
57+
toolchain: {compiler: intel-classic, version: '2021.10'}
58+
- os: macos-14
59+
toolchain: {compiler: intel-classic, version: '2021.10'}
60+
- os: macos-13
61+
toolchain: {compiler: intel-classic, version: '2021.10'}
62+
# Newest possible lfortran on macos
63+
- os: macos-15
64+
toolchain: {compiler: lfortran, version: '0.33.0'}
65+
- os: macos-14
66+
toolchain: {compiler: lfortran, version: '0.33.0'}
67+
- os: macos-13
68+
toolchain: {compiler: lfortran, version: '0.33.0'}
69+
70+
# Steps represent a sequence of tasks that will be executed as part of the job
71+
steps:
72+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
73+
- name: Checkout code
74+
with:
75+
persist-credentials: false
76+
uses: actions/checkout@v4
77+
78+
- name: setup-fortran
79+
uses: fortran-lang/setup-fortran@v1
80+
with:
81+
compiler: ${{ matrix.toolchain.compiler }}
82+
version: ${{ matrix.toolchain.version }}
83+
84+
- name: check-compilers-env
85+
run: ${FC}
86+
env:
87+
FC: ${{ steps.setup-fortran.outputs.fc }}
88+
89+
- name: Install Python
90+
uses: actions/setup-python@v5
91+
with:
92+
python-version: '3.x'
93+
94+
- name: Install PyTorch
95+
run: |
96+
python -m pip install --upgrade pip
97+
python -m venv ftorch
98+
source ftorch/bin/activate
99+
pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
100+
101+
- name: Build FTorch
102+
run: |
103+
source ftorch/bin/activate
104+
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
107+
mkdir ${BUILD_DIR}
108+
cd ${BUILD_DIR}
109+
cmake .. \
110+
-DPython_EXECUTABLE="$(which python)" \
111+
-DCMAKE_BUILD_TYPE=Release \
112+
-DCMAKE_Fortran_COMPILER=${FC} \
113+
-DCMAKE_C_COMPILER=${CC} \
114+
-DCMAKE_CXX_COMPILER=${CXX} \
115+
-DCMAKE_INSTALL_PREFIX=${BUILD_DIR} \
116+
-DCMAKE_BUILD_TESTS=TRUE \
117+
cmake --build .
118+
cmake --install .
119+
120+
- name: Integration tests
121+
run: |
122+
source ftorch/bin/activate
123+
./run_integration_tests.sh -V

0 commit comments

Comments
 (0)