Linting for shell and GitHub Actions (#206) #95
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Workflow to run the FTorch test suite | |
name: TestSuiteWindows | |
# Controls when the workflow will run | |
on: | |
# Triggers the workflow on pushes to the "main" branch, i.e., PR merges | |
push: | |
branches: [ "main" ] | |
# Triggers the workflow on pushes to open pull requests with code changes | |
pull_request: | |
paths: | |
- '.github/workflows/test_suite_windows.yml' | |
- '**.bat' | |
- '**.c' | |
- '**.cpp' | |
- '**.fypp' | |
- '**.f90' | |
- '**.F90' | |
- '**.pf' | |
- '**.py' | |
- '**CMakeLists.txt' | |
- '**requirements.txt' | |
- '**data/*' | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# Cancel jobs running if new commits are pushed | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
# Workflow run - one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "test-suite-windows" | |
test-suite-windows: | |
# The type of runner that the job will run on | |
runs-on: windows-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
toolchain: | |
- {compiler: intel, version: '2023.2'} | |
steps: | |
# configure windows VM with intel compilers | |
- uses: fortran-lang/setup-fortran@v1 | |
id: setup-fortran | |
with: | |
compiler: ${{ matrix.toolchain.compiler }} | |
version: ${{ matrix.toolchain.version }} | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- name: Checkout code | |
with: | |
persist-credentials: false | |
uses: actions/checkout@v4 | |
- name: Install Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install PyTorch | |
shell: cmd | |
run: | | |
pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu | |
- name: Build FTorch | |
shell: cmd | |
run: | | |
cd src | |
rem find torch location | |
for /f "tokens=2*" %%i in ('pip show torch ^| findstr /R "^Location"') do set torch_path=%%i | |
cmake ^ | |
-Bbuild ^ | |
-G "NMake Makefiles" ^ | |
-DCMAKE_Fortran_FLAGS="/fpscomp:logicals" ^ | |
-DCMAKE_PREFIX_PATH=%torch_path% ^ | |
-DCMAKE_BUILD_TYPE=Release ^ | |
-DCMAKE_Fortran_COMPILER=ifx ^ | |
-DCMAKE_C_COMPILER=icx ^ | |
-DCMAKE_CXX_COMPILER=icx ^ | |
-DCMAKE_BUILD_TESTS=TRUE | |
cmake --build build | |
cmake --install build | |
- name: Integration tests | |
shell: cmd | |
run: | | |
for /f "tokens=2*" %%i in ('pip show torch ^| findstr /R "^Location"') do set torch_path=%%i | |
set PATH=C:\Program Files (x86)\FTorch\bin;%PATH% | |
set PATH=%torch_path%\torch\lib;%PATH% | |
run_integration_tests.bat |