Skip to content

Commit c8e65d3

Browse files
authored
Merge branch 'main' into custom-path-to-config
2 parents 06e8137 + fe1fd6e commit c8e65d3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+5514
-2362
lines changed
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
name: 'Setup Intel oneAPI Environment'
2+
description: 'Sets up Intel oneAPI C++, Fortran compilers and MPI on Windows or Ubuntu runners.'
3+
4+
inputs:
5+
os:
6+
description: 'Operating system of the runner. Must contain "windows" or "ubuntu".'
7+
required: true
8+
type: string
9+
10+
runs:
11+
using: "composite"
12+
steps:
13+
- name: (Windows) Setup VS Build environment
14+
if: contains(inputs.os, 'windows')
15+
uses: seanmiddleditch/gha-setup-vsdevenv@v4
16+
17+
- name: (Windows) Retrieve and Install Intel toolchain
18+
if: contains(inputs.os, 'windows')
19+
shell: pwsh
20+
run: |
21+
$tempDir = "C:\TEMP\intel_install"
22+
New-Item -ItemType Directory -Force -Path $tempDir
23+
cd $tempDir
24+
$installerName = "w_HPCKit_p_2023.0.0.25931_offline.exe" # Consider using inputs.intel_version_windows if added
25+
$installerUrl = "https://registrationcenter-download.intel.com/akdlm/irc_nas/19085/$installerName"
26+
Write-Host "Downloading Intel oneAPI installer..."
27+
curl.exe --output $installerName --url $installerUrl --retry 5 --retry-delay 5 -L # Added -L for potential redirects
28+
Write-Host "Extracting installer..."
29+
Start-Process -FilePath ".\$installerName" -ArgumentList "-s -x -f oneAPI --log extract.log" -Wait -NoNewWindow
30+
Remove-Item ".\$installerName" -Force
31+
Write-Host "Installing oneAPI components..."
32+
# Install C++, Fortran, and MPI development tools silently
33+
Start-Process -FilePath ".\oneAPI\bootstrapper.exe" -ArgumentList "-s --action install --eula=accept --components=""intel.oneapi.win.cpp-compiler:intel.oneapi.win.ifort-compiler:intel.oneapi.win.mpi.devel"" -p=NEED_VS2017_INTEGRATION=0 -p=NEED_VS2019_INTEGRATION=0 -p=NEED_VS2022_INTEGRATION=0 --log-dir=." -Wait -NoNewWindow
34+
Write-Host "Cleaning up extracted files..."
35+
Remove-Item ".\oneAPI" -Force -Recurse
36+
cd ..
37+
Remove-Item $tempDir -Force -Recurse
38+
39+
- name: (Windows) Test that OneAPI is installed
40+
if: contains(inputs.os, 'windows')
41+
shell: pwsh
42+
run: |
43+
$setvarsPath = "C:\Program Files (x86)\Intel\oneAPI\setvars.bat"
44+
$compilerVarsPath = "C:\Program Files (x86)\Intel\oneAPI\compiler\latest\env\vars.bat"
45+
if (-not (Test-Path -Path $setvarsPath -PathType Leaf)) {
46+
Write-Error "Intel oneAPI setvars.bat not found at $setvarsPath"
47+
exit 1
48+
}
49+
if (-not (Test-Path -Path $compilerVarsPath -PathType Leaf)) {
50+
Write-Warning "Intel oneAPI compiler vars.bat not found at $compilerVarsPath. MPI might still work."
51+
# Depending on requirements, you might want to 'exit 1' here too
52+
}
53+
Write-Host "Intel oneAPI installation paths verified."
54+
55+
- name: (Windows) Load OneAPI environment variables
56+
if: contains(inputs.os, 'windows')
57+
shell: cmd
58+
run: |
59+
call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat" > NUL
60+
echo "Setting Intel environment variables..."
61+
echo "PATH=%PATH%" >> %GITHUB_ENV%
62+
echo "INCLUDE=%INCLUDE%" >> %GITHUB_ENV%
63+
echo "LIB=%LIB%" >> %GITHUB_ENV%
64+
REM Add any other specific vars if needed, e.g., for MPI
65+
echo "I_MPI_ROOT=%I_MPI_ROOT%" >> %GITHUB_ENV%
66+
echo "FI_PROVIDER_PATH=%FI_PROVIDER_PATH%" >> %GITHUB_ENV%
67+
echo "MPI_BIN=%MPI_BIN%" >> %GITHUB_ENV%
68+
69+
# --- Ubuntu Intel Setup ---
70+
- name: (Ubuntu) Install prerequisites and Intel GPG key
71+
if: contains(inputs.os, 'ubuntu')
72+
shell: bash
73+
run: |
74+
sudo apt-get update -y -qq
75+
sudo apt-get install -y -qq gpg wget ca-certificates curl gpg-agent software-properties-common
76+
wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null
77+
78+
- name: (Ubuntu) Add Intel oneAPI repository
79+
if: contains(inputs.os, 'ubuntu')
80+
shell: bash
81+
run: |
82+
echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
83+
sudo apt-get update -y -qq
84+
85+
- name: (Ubuntu) Install Intel oneAPI Compilers using fortran-lang action
86+
if: contains(inputs.os, 'ubuntu')
87+
uses: fortran-lang/setup-fortran@v1
88+
with:
89+
compiler: intel
90+
version: 2024.1.0 # Pinned until issue #1090 is resolved
91+
92+
- name: (Ubuntu) Install Intel oneAPI MPI and build dependencies
93+
if: contains(inputs.os, 'ubuntu')
94+
shell: bash
95+
run: |
96+
# Install MPI devel package and common build tools
97+
# The compilers (icc, ifort) should already be installed by setup-fortran action
98+
sudo apt-get install -y -q intel-oneapi-mpi-devel intel-oneapi-mkl ninja-build cmake libcurl4-gnutls-dev
99+
100+
- name: (Ubuntu) Source oneAPI environment and add to GITHUB_ENV
101+
if: contains(inputs.os, 'ubuntu')
102+
shell: bash
103+
run: |
104+
# Source the main setvars script to set up the environment for this step
105+
# Use --force as we might be in a non-interactive shell
106+
source /opt/intel/oneapi/setvars.sh --force > /dev/null 2>&1
107+
echo "Sourced setvars.sh. Adding key variables to GITHUB_ENV..."
108+
# Explicitly add key variables to GITHUB_ENV for subsequent steps
109+
echo "PATH=$PATH" >> $GITHUB_ENV
110+
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" >> $GITHUB_ENV
111+
echo "LIBRARY_PATH=$LIBRARY_PATH" >> $GITHUB_ENV
112+
echo "CPATH=$CPATH" >> $GITHUB_ENV
113+
echo "CMPLR_ROOT=$CMPLR_ROOT" >> $GITHUB_ENV # Example compiler root
114+
echo "MPI_ROOT=$MPI_ROOT" >> $GITHUB_ENV # MPI root (check actual variable name if needed, e.g., I_MPI_ROOT)
115+
echo "I_MPI_ROOT=$I_MPI_ROOT" >> $GITHUB_ENV # Common variable name for Intel MPI root
116+
echo "FI_PROVIDER_PATH=$FI_PROVIDER_PATH" >> $GITHUB_ENV # Often needed for MPI

.github/workflows/CI.yml

Lines changed: 83 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -21,70 +21,76 @@ jobs:
2121
strategy:
2222
fail-fast: false
2323
matrix:
24-
os: [ubuntu-latest, macos-11, windows-latest]
25-
gcc_v: [10,11,12,13] # Version of GFortran we want to use.
24+
os: [ubuntu-latest, macos-13, windows-latest]
25+
toolchain:
26+
- {compiler: gcc, version: 10}
27+
- {compiler: gcc, version: 11}
28+
- {compiler: gcc, version: 12}
29+
- {compiler: gcc, version: 13}
30+
- {compiler: gcc, version: 14}
31+
- {compiler: intel, version: 2025.1}
32+
exclude:
33+
- os: macos-13 # No Intel on MacOS anymore since 2024
34+
toolchain: {compiler: intel, version: '2025.1'}
35+
- os: windows-latest # Doesn't pass build and tests yet
36+
toolchain: {compiler: intel, version: '2025.1'}
37+
- os: windows-latest # gcc 14 not available on Windows yet
38+
toolchain: {compiler: gcc, version: 14}
2639
include:
27-
- os: ubuntu-latest
28-
os-arch: linux-x86_64
29-
release-flags: --flag '--static -g -fbacktrace -O3'
30-
31-
- os: macos-11
32-
os-arch: macos-x86_64
33-
release-flags: --flag '-g -fbacktrace -O3'
34-
35-
- os: windows-latest
36-
os-arch: windows-x86_64
37-
release-flags: --flag '--static -g -fbacktrace -O3'
38-
exe: .exe
39-
40-
env:
41-
FC: gfortran
42-
GCC_V: ${{ matrix.gcc_v }}
40+
- os: ubuntu-latest
41+
os-arch: linux-x86_64
42+
release-flags: --flag '--static -g -fbacktrace -O3'
43+
- os: macos-13
44+
os-arch: macos-x86_64
45+
release-flags: --flag '-g -fbacktrace -O3'
46+
- os: windows-latest
47+
os-arch: windows-x86_64
48+
release-flags: --flag '--static -g -fbacktrace -O3'
49+
exe: .exe
4350

4451
steps:
4552
- name: Checkout code
4653
uses: actions/checkout@v4
4754

48-
- name: Install GFortran macOS
49-
if: contains(matrix.os, 'macos')
50-
run: |
51-
ln -s /usr/local/bin/gfortran-${GCC_V} /usr/local/bin/gfortran
52-
which gfortran-${GCC_V}
53-
which gfortran
54-
# Backport gfortran shared libraries to version 9 folder. This is necessary because all macOS releases of fpm
55-
# have these paths hardcoded in the executable (no PIC?). As the gcc ABIs have not changed from 9 to 10, we
56-
# can just create symbolic links for now. This can be removed when an updated fpm release is built with gcc-10
57-
mkdir /usr/local/opt/gcc@9
58-
mkdir /usr/local/opt/gcc@9/lib
59-
mkdir /usr/local/opt/gcc@9/lib/gcc
60-
mkdir /usr/local/opt/gcc@9/lib/gcc/9
61-
mkdir /usr/local/lib/gcc/9
62-
ln -fs /usr/local/opt/gcc@${GCC_V}/lib/gcc/${GCC_V}/libquadmath.0.dylib /usr/local/opt/gcc@9/lib/gcc/9/libquadmath.0.dylib
63-
ln -fs /usr/local/opt/gcc@${GCC_V}/lib/gcc/${GCC_V}/libgfortran.5.dylib /usr/local/opt/gcc@9/lib/gcc/9/libgfortran.5.dylib
64-
ln -fs /usr/local/lib/gcc/${GCC_V}/libgcc_s.1.dylib /usr/local/lib/gcc/9/libgcc_s.1.dylib
65-
66-
- name: Install GFortran Linux
67-
if: contains(matrix.os, 'ubuntu')
68-
run: |
69-
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_V} 100 \
70-
--slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${GCC_V} \
71-
--slave /usr/bin/gcov gcov /usr/bin/gcov-${GCC_V}
72-
73-
- name: Install GFortran Windows
74-
if: contains(matrix.os, 'windows')
75-
run: |
76-
Invoke-WebRequest -Uri $Env:GCC_DOWNLOAD -OutFile mingw-w64.zip
77-
Expand-Archive mingw-w64.zip
78-
echo "$pwd\mingw-w64\mingw64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
79-
env:
80-
GCC_DOWNLOAD: "https://github.com/brechtsanders/winlibs_mingw/releases/download/10.4.0-10.0.0-msvcrt-r1/winlibs-x86_64-posix-seh-gcc-10.4.0-mingw-w64msvcrt-10.0.0-r1.zip"
55+
- name: Setup Fortran compiler
56+
uses: fortran-lang/[email protected]
57+
id: setup-fortran
58+
with:
59+
compiler: ${{ matrix.toolchain.compiler }}
60+
version: ${{ matrix.toolchain.version }}
8161

8262
# Phase 1: Bootstrap fpm with existing version
8363
- name: Install fpm
84-
uses: fortran-lang/setup-fpm@v5
64+
uses: fortran-lang/setup-fpm@v7
8565
with:
8666
fpm-version: 'v0.8.0'
8767

68+
# Backport gfortran shared libraries to version 10 folder. This is necessary because the macOS release of fpm
69+
# 0.10.0 used for bootstrapping has these paths hardcoded in the executable.
70+
- name: MacOS patch libgfortran
71+
if: contains(matrix.os, 'macos') && !contains(matrix.toolchain.version, '10')
72+
run: |
73+
which gfortran-${{ matrix.toolchain.version }}
74+
which gfortran
75+
mkdir /usr/local/opt/gcc@10
76+
mkdir /usr/local/opt/gcc@10/lib
77+
mkdir /usr/local/opt/gcc@10/lib/gcc
78+
mkdir /usr/local/opt/gcc@10/lib/gcc/10
79+
mkdir /usr/local/lib/gcc/10
80+
ln -fs /usr/local/opt/gcc@${{ matrix.toolchain.version }}/lib/gcc/${{ matrix.toolchain.version }}/libquadmath.0.dylib /usr/local/opt/gcc@10/lib/gcc/10/libquadmath.0.dylib
81+
ln -fs /usr/local/opt/gcc@${{ matrix.toolchain.version }}/lib/gcc/${{ matrix.toolchain.version }}/libgfortran.5.dylib /usr/local/opt/gcc@10/lib/gcc/10/libgfortran.5.dylib
82+
ln -fs /usr/local/lib/gcc/${{ matrix.toolchain.version }}/libgcc_s.1.dylib /usr/local/lib/gcc/10/libgcc_s.1.dylib
83+
84+
# gcc and g++ will point to clang/clang++: use versioned alias for fpm
85+
- name: MacOS patch C and C++ compilers
86+
if: contains(matrix.os, 'macos')
87+
run: |
88+
echo "CC=gcc-${{ matrix.toolchain.version }}" >> $GITHUB_ENV
89+
echo "FPM_CC=gcc-${{ matrix.toolchain.version }}" >> $GITHUB_ENV
90+
echo "CXX=g++-${{ matrix.toolchain.version }}" >> $GITHUB_ENV
91+
echo "FPM_CXX=g++-${{ matrix.toolchain.version }}" >> $GITHUB_ENV
92+
echo "FPM_LDFLAGS=-lstdc++" >> $GITHUB_ENV
93+
8894
- name: Remove fpm from path
8995
shell: bash
9096
run: |
@@ -94,7 +100,7 @@ jobs:
94100
- name: Build Fortran fpm (bootstrap)
95101
shell: bash
96102
run: |
97-
${{ env.BOOTSTRAP }} build
103+
${{ env.BOOTSTRAP }} build
98104
99105
- name: Run Fortran fpm (bootstrap)
100106
shell: bash
@@ -139,11 +145,6 @@ jobs:
139145
env:
140146
REGEX: '[0-9]\{1,4\}\.[0-9]\{1,4\}\.[0-9]\{1,4\}'
141147

142-
- name: Build example packages
143-
shell: bash
144-
run: |
145-
ci/run_tests.sh "${{ env.FPM }}"
146-
147148
- name: Build Fortran fpm
148149
shell: bash
149150
run: |
@@ -173,15 +174,15 @@ jobs:
173174
rm -v ${{ env.FPM }}
174175
echo "FPM_RELEASE=${{ env.EXE }}" >> $GITHUB_ENV
175176
env:
176-
EXE: fpm-${{ env.VERSION }}-${{ matrix.os-arch }}${{ matrix.exe }}
177+
EXE: fpm-${{ env.VERSION }}-${{ matrix.os-arch }}-gcc-${{ matrix.toolchain.version }}${{ matrix.exe }}
177178

178179
- name: Run release version
179180
shell: bash
180181
run: |
181182
ci/run_tests.sh "$PWD/${{ env.FPM_RELEASE }}"
182183
183184
- name: Upload artifact
184-
uses: actions/upload-artifact@v2
185+
uses: actions/upload-artifact@v4
185186
with:
186187
name: ${{ env.FPM_RELEASE }}
187188
path: ${{ env.FPM_RELEASE }}
@@ -192,14 +193,19 @@ jobs:
192193
runs-on: windows-latest
193194
needs:
194195
- build
195-
196+
strategy:
197+
fail-fast: false
198+
matrix:
199+
gcc_v: [11,12,13]
200+
196201
steps:
197202
- uses: actions/checkout@v4
198203

199204
- name: Download Artifacts
200-
uses: actions/download-artifact@v2
205+
uses: actions/download-artifact@v4
201206
with:
202-
path: ${{ github.workspace }} # This will download all files
207+
path: ${{ github.workspace }}
208+
pattern: fpm-*-windows-*-gcc-${{ matrix.gcc_v }}.exe
203209

204210
- name: Get version (normal)
205211
if: github.event_name != 'release'
@@ -229,7 +235,7 @@ jobs:
229235
- name: Fetch Windows executable
230236
shell: msys2 {0}
231237
run: |
232-
cp fpm-*/fpm*.exe ./ci/fpm.exe
238+
cp fpm-*/fpm-*-windows-*-gcc-${{ matrix.gcc_v }}.exe ./ci/fpm.exe
233239
234240
- name: Fetch Git for Windows
235241
shell: msys2 {0}
@@ -254,13 +260,13 @@ jobs:
254260
run: |
255261
cd ./ci
256262
makensis fpm-installer.nsi
257-
move fpm-installer.exe fpm-installer-${{ env.VERSION }}.exe
263+
move fpm-installer.exe fpm-installer-${{ env.VERSION }}-gcc-${{ matrix.gcc_v }}.exe
258264
259265
- name: Upload artifact
260-
uses: actions/upload-artifact@v2
266+
uses: actions/upload-artifact@v4
261267
with:
262-
name: fpm-installer
263-
path: ci/fpm-installer-${{ env.VERSION }}.exe
268+
name: fpm-installer-gcc-${{ matrix.gcc_v }}
269+
path: ci/fpm-installer-${{ env.VERSION }}-gcc-${{ matrix.gcc_v }}.exe
264270

265271
upload-artifacts:
266272
if: ${{ github.event_name == 'release' && contains(github.ref, 'v') || github.event_name == 'push' }}
@@ -281,27 +287,27 @@ jobs:
281287
if: ${{ github.event_name == 'push' }}
282288

283289
- name: Download Artifacts
284-
uses: actions/download-artifact@v2
290+
uses: actions/download-artifact@v4
285291
with:
286-
path: ${{ github.workspace }} # This will download all files
292+
path: fpm-cd-artifacts
293+
pattern: 'fpm-*-gcc-12*'
294+
merge-multiple: true
287295

288296
- name: Normalize file names for continuous delivery
289297
if: ${{ github.event_name == 'push' }}
290298
run: |
291-
for output in fpm-*/fpm*; do
292-
pushd $(dirname "$output")
299+
cd fpm-cd-artifacts
300+
for output in fpm-*; do
293301
mv -v $(basename $output) $(basename $output | sed -E '${{ env.replace }}')
294-
popd
295302
done
296303
env:
297304
replace: 's/-([0-9]+\.[0-9]+\.[0-9]+-[0-9]+-g)?[0-9a-f]+//'
298305

299306
- name: Create SHA256 checksums
300307
run: |
301-
for output in fpm-*/fpm*; do
302-
pushd $(dirname "$output")
308+
cd fpm-cd-artifacts
309+
for output in fpm-*; do
303310
sha256sum $(basename "$output") | tee $(basename "$output").sha256
304-
popd
305311
done
306312
307313
- name: Move/Create continuous tag
@@ -315,7 +321,7 @@ jobs:
315321
if: ${{ github.event_name == 'release' || steps.deploy-on-push.outputs.result != 0 }}
316322
with:
317323
repo_token: ${{ secrets.GITHUB_TOKEN }}
318-
file: fpm-*/fpm*
324+
file: fpm-cd-artifacts/*
319325
file_glob: true
320326
tag: ${{ github.event_name == 'release' && github.ref || 'current'}}
321327
overwrite: true

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
run: pip install ford
1515
- name: Build Documentation
1616
run: ford docs.md
17-
- uses: JamesIves/github-pages-deploy-action@3.7.1
17+
- uses: JamesIves/github-pages-deploy-action@v4.7.3
1818
if: github.event_name == 'push' && github.repository == 'fortran-lang/fpm' && ( startsWith( github.ref, 'refs/tags/' ) || github.ref == 'refs/heads/main' )
1919
with:
2020
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)