Skip to content

Commit 5ada566

Browse files
committed
Attempted reusable workflow
1 parent a6ec9c2 commit 5ada566

File tree

3 files changed

+111
-76
lines changed

3 files changed

+111
-76
lines changed
+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: ReusableTestSuite
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
os:
7+
description: 'Operating system to run the workflow on'
8+
required: true
9+
type: string
10+
shell:
11+
description: 'Shell type to run the workflow on'
12+
required: true
13+
type: string
14+
compiler:
15+
description: 'Compiler to build with'
16+
required: true
17+
type: string
18+
compiler-version:
19+
description: 'Version of the compiler'
20+
required: true
21+
type: string
22+
name:
23+
description: 'Name of the test workflow'
24+
required: true
25+
type: string
26+
install-command:
27+
description: 'Command to install FTorch'
28+
required: true
29+
type: string
30+
build-command:
31+
description: 'Command to build FTorch'
32+
required: true
33+
type: string
34+
test-command:
35+
description: 'Command to run the test suite'
36+
required: true
37+
type: string
38+
39+
# Cancel jobs running if new commits are pushed
40+
concurrency:
41+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
42+
cancel-in-progress: true
43+
44+
jobs:
45+
test-suite:
46+
name: ${{ inputs.name }}
47+
runs-on: ${{ inputs.os }}
48+
timeout-minutes: 15
49+
strategy:
50+
fail-fast: false
51+
matrix:
52+
os: ["${{ inputs.os }}"]
53+
std: ["f2008", "f2018"] # TODO: Don't always test both
54+
toolchain:
55+
- {compiler: "${{ inputs.compiler }}", version: "${{ inputs.compiler-version }}"}
56+
57+
# Steps represent a sequence of tasks that will be executed as part of the job
58+
steps:
59+
- uses: fortran-lang/setup-fortran@v1
60+
id: setup-fortran
61+
with:
62+
compiler: ${{ matrix.toolchain.compiler }}
63+
version: ${{ matrix.toolchain.version }}
64+
65+
# Checks-out your repository under ${GITHUB_WORKSPACE}, so your job can access it
66+
- name: Checkout code
67+
uses: actions/checkout@v4
68+
69+
- name: Install Python
70+
uses: actions/setup-python@v5
71+
with:
72+
python-version: '3.x'
73+
74+
- name: Install PyTorch
75+
shell: ${{ inputs.shell }}
76+
run: |
77+
${{ inputs.install-command }}
78+
79+
- name: Build FTorch
80+
shell: ${{ inputs.shell }}
81+
run: |
82+
${{ inputs.build-command }}
83+
84+
- name: Integration tests
85+
shell: ${{ inputs.shell }}
86+
run: |
87+
${{ inputs.test-command }}
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# Workflow to run the FTorch test suite
2-
name: TestSuite
1+
# Workflow to run the FTorch test suite on latest Ubuntu
2+
name: TestSuiteUbuntu
33

44
# Controls when the workflow will run
55
on:
@@ -26,42 +26,21 @@ on:
2626
# Allows you to run this workflow manually from the Actions tab
2727
workflow_dispatch:
2828

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
3529
jobs:
36-
# This workflow contains a single job called "test-suite"
37-
test-suite:
38-
# The type of runner that the job will run on
39-
runs-on: ubuntu-latest
40-
strategy:
41-
fail-fast: false
42-
matrix:
43-
std: ["f2008", "f2018"]
44-
45-
# Steps represent a sequence of tasks that will be executed as part of the job
46-
steps:
47-
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
48-
- name: Checkout code
49-
uses: actions/checkout@v4
50-
51-
- name: Install Python
52-
uses: actions/setup-python@v5
53-
with:
54-
python-version: '3.x'
55-
56-
- name: Install PyTorch
57-
run: |
30+
test-suite-ubuntu:
31+
uses: Cambridge-ICCS/FTorch/.github/workflows/reusable_test_suite.yml@201_reusable-workflow
32+
with:
33+
os: ubuntu-latest
34+
shell: bash
35+
compiler: gfortran
36+
compiler-version: 11.4.0
37+
name: TestSuiteUbuntu
38+
install-command: |
5839
python -m pip install --upgrade pip
5940
python -m venv ftorch
6041
. ftorch/bin/activate
6142
pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
62-
63-
- name: Build FTorch
64-
run: |
43+
build-command: |
6544
. ftorch/bin/activate
6645
VN=$(python -c "import sys; print('.'.join(sys.version.split('.')[:2]))")
6746
export Torch_DIR=${VIRTUAL_ENV}/lib/python${VN}/site-packages
@@ -71,8 +50,6 @@ jobs:
7150
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${BUILD_DIR} -DCMAKE_BUILD_TESTS=TRUE -DCMAKE_Fortran_FLAGS="-std=${{ matrix.std }}"
7251
cmake --build .
7352
cmake --install .
74-
75-
- name: Integration tests
76-
run: |
53+
test-command: |
7754
. ftorch/bin/activate
7855
./run_integration_tests.sh -V

.github/workflows/test_suite_windows.yml

+11-40
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 Windows
22
name: TestSuiteWindows
33

44
# Controls when the workflow will run
@@ -23,9 +23,6 @@ on:
2323
- '**requirements.txt'
2424
- '**data/*'
2525

26-
# Allows you to run this workflow manually from the Actions tab
27-
workflow_dispatch:
28-
2926
# Cancel jobs running if new commits are pushed
3027
concurrency:
3128
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
@@ -35,47 +32,21 @@ concurrency:
3532
jobs:
3633
# This workflow contains a single job called "test-suite-windows"
3734
test-suite-windows:
38-
# The type of runner that the job will run on
39-
runs-on: windows-latest
40-
strategy:
41-
fail-fast: false
42-
matrix:
43-
toolchain:
44-
- {compiler: intel, version: '2023.2'}
45-
46-
steps:
47-
# configure windows VM with intel compilers
48-
- uses: fortran-lang/setup-fortran@v1
49-
id: setup-fortran
50-
with:
51-
compiler: ${{ matrix.toolchain.compiler }}
52-
version: ${{ matrix.toolchain.version }}
53-
54-
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
55-
- name: Checkout code
56-
uses: actions/checkout@v4
57-
58-
- name: Install Python
59-
uses: actions/setup-python@v5
60-
with:
61-
python-version: '3.x'
62-
63-
- name: Install PyTorch
64-
shell: cmd
65-
run: |
35+
uses: Cambridge-ICCS/FTorch/.github/workflows/reusable_test_suite.yml@201_reusable-workflow
36+
with:
37+
os: windows-latest
38+
shell: cmd
39+
compiler: intel
40+
compiler-version: 2023.2
41+
name: TestSuiteUbuntu
42+
install-command: |
6643
pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
67-
68-
- name: Build FTorch
69-
shell: cmd
70-
run: |
44+
build-command: |
7145
cd src
7246
cmake -Bbuild -G "NMake Makefiles" -DCMAKE_Fortran_FLAGS="/fpscomp:logicals" -DCMAKE_PREFIX_PATH="C:\hostedtoolcache\windows\Python\3.12.7\x64\Lib\site-packages" -DCMAKE_BUILD_TYPE=Release -DCMAKE_Fortran_COMPILER=ifx -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icx -DCMAKE_BUILD_TESTS=TRUE
7347
cmake --build build
7448
cmake --install build
75-
76-
- name: Integration tests
77-
shell: cmd
78-
run: |
49+
test-command: |
7950
cd src
8051
set PATH=C:\hostedtoolcache\windows\Python\3.12.7\x64\Lib\site-packages;%PATH%
8152
set PATH=C:\Program Files (x86)\FTorch\bin;%PATH%

0 commit comments

Comments
 (0)