Skip to content

Update test-suite workflow to use the fortran-lang github action to a… #103

Update test-suite workflow to use the fortran-lang github action to a…

Update test-suite workflow to use the fortran-lang github action to a… #103

Workflow file for this run

# workflow to run the FTorch test suite
name: TestSuite
# Controls when the workflow will run
on:
# Triggers the workflow on pushes to the "main" branch and any pull request events
push:
branches: [ "main"]
pull_request:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Workflow run - one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "test-suite"
test-suite:
# The type of runner that the job will run on
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
# - macos-latest
# - windows-latest
toolchain:
- {compiler: gcc, version: 13}
# - {compiler: intel, version: '2023.2'}
- {compiler: intel-classic, version: '2021.10'}
# - {compiler: nvidia-hpc, version: '23.11'}
include:
- os: ubuntu-latest
toolchain: {compiler: gcc, version: 12}
exclude:
- os: macos-latest
toolchain: {compiler: intel, version: '2023.2'}
# - os: macos-latest
# toolchain: {compiler: nvidia-hpc, version: '23.11'}
# - os: windows-latest
# toolchain: {compiler: nvidia-hpc, version: '23.11'}
std: ["f2008", "f2018"]
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout code
uses: actions/checkout@v4
- name: setup-fortran
uses: fortran-lang/setup-fortran@v1
with:
compiler: ${{ matrix.toolchain.compiler }}
version: ${{ matrix.toolchain.version }}
run: |
${{ env.FC }} ... # environment vars FC, CC, and CXX are set
${{ steps.setup-fortran.outputs.fc }} ... # outputs work too
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install PyTorch
run: |
python -m pip install --upgrade pip
python -m venv ftorch
. ftorch/bin/activate
pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
- name: Build FTorch
run: |
. ftorch/bin/activate
VN=$(python -c "import sys; print('.'.join(sys.version.split('.')[:2]))")
export Torch_DIR=${VIRTUAL_ENV}/lib/python${VN}/site-packages
export BUILD_DIR=$(pwd)/src/build
mkdir ${BUILD_DIR}
cd ${BUILD_DIR}
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${BUILD_DIR} -DCMAKE_BUILD_TESTS=TRUE -DCMAKE_Fortran_FLAGS="-std=${{ matrix.std }}"
cmake --build .
cmake --install .
- name: Integration tests
run: |
. ftorch/bin/activate
./run_integration_tests.sh