-
Notifications
You must be signed in to change notification settings - Fork 39
70 lines (58 loc) · 2.38 KB
/
preprocessing.yml
File metadata and controls
70 lines (58 loc) · 2.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# Workflow to run Fortran pre-processor checks on source
name: Preprocessing
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 Fortran changes
pull_request:
paths:
- '.github/workflows/preprocessing.yml'
- 'ftorch_tensor.f*'
- 'ftorch_test_utils.f*'
# Cancel jobs running if new commits are pushed
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
# Write permissions are not required
permissions: {}
# Workflow run - one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "fypp-checks"
fypp-checks:
name: fypp checks
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Terminate the job if it runs for more than 5 minutes
timeout-minutes: 5
steps:
- name: Checkout FTorch repository
with:
persist-credentials: true
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Setup Python
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6
with:
python-version: '3.13' # Use 3.13 as no PyTorch wheels for 3.14 yet.
- name: Install fypp, the Fortran pre-processor
run: pip install --group preproc
- name: Check ftorch_tensor.fypp matches ftorch_tensor.f90
run: |
fypp src/ftorch_tensor.fypp src/temp.f90_temp
if ! diff -q src/ftorch_tensor.f90 src/temp.f90_temp; then
echo "Error: The code in ftorch_tensor.f90 does not match that expected from ftorch_tensor.fypp."
echo "Please re-run fypp on ftorch_tensor.fypp to ensure consistency and re-commit."
exit 1
else
exit 0
fi
- name: Check ftorch_test_utils.fypp matches ftorch_test_utils.f90
run: |
fypp src/ftorch_test_utils.fypp src/temp.f90_temp
if ! diff -q src/ftorch_test_utils.f90 src/temp.f90_temp; then
echo "Error: The code in ftorch_test_utils.f90 does not match that expected from ftorch_test_utils.fypp."
echo "Please re-run fypp on ftorch_test_utils.fypp to ensure consistency and re-commit."
exit 1
else
exit 0
fi