[markleader]: push to fix/python-legacy-div #196
Workflow file for this run
This file contains hidden or 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
| name: Basic Build | |
| run-name: "[${{ github.actor }}]: ${{ github.event_name }} to ${{ github.ref_name }}" | |
| on: | |
| push: | |
| pull_request: | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| name: Build (${{ matrix.label }}) | |
| runs-on: ${{ matrix.runs_on }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - label: linux-x86_64-gfortran | |
| runs_on: ubuntu-22.04 | |
| compiler: gcc | |
| fc: gfortran | |
| - label: linux-aarch64-gfortran | |
| runs_on: ubuntu-22.04-arm | |
| compiler: gcc | |
| fc: gfortran | |
| - label: macos-x86_64-gfortran | |
| runs_on: macos-15-intel | |
| compiler: gcc | |
| fc: gfortran-14 | |
| - label: macos-arm64-gfortran | |
| runs_on: macos-14 | |
| compiler: gcc | |
| fc: gfortran-14 | |
| - label: windows-amd64-ifx | |
| runs_on: windows-2022 | |
| compiler: intel | |
| version: "2025.2" | |
| fc: ifx | |
| - label: windows-amd64-ifort | |
| runs_on: windows-2022 | |
| compiler: intel-classic | |
| version: "2021.10" | |
| fc: ifort | |
| - label: windows-amd64-gfortran | |
| runs_on: windows-2022 | |
| compiler: gcc | |
| fc: gfortran | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| - name: Check out CEA | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Set up GNU Fortran compiler (Linux) | |
| if: runner.os == 'Linux' && matrix.compiler == 'gcc' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y gcc g++ gfortran | |
| - name: Set up Fortran compiler (macOS) | |
| if: runner.os == 'macOS' && matrix.compiler == 'gcc' | |
| run: | | |
| brew update | |
| brew install gcc@14 | |
| - name: Set up Intel oneAPI compiler (Windows) | |
| if: runner.os == 'Windows' && (matrix.compiler == 'intel' || matrix.compiler == 'intel-classic') | |
| uses: fortran-lang/setup-fortran@v1 | |
| with: | |
| compiler: ${{ matrix.compiler }} | |
| version: ${{ matrix.version }} | |
| - name: Resolve Intel compiler path | |
| if: runner.os == 'Windows' && (matrix.compiler == 'intel' || matrix.compiler == 'intel-classic') | |
| shell: pwsh | |
| run: | | |
| $compiler = "${{ matrix.fc }}" | |
| $resolved = $null | |
| $cmd = Get-Command $compiler -ErrorAction SilentlyContinue | |
| if ($cmd) { | |
| $resolved = $cmd.Source | |
| } else { | |
| $candidates = Get-ChildItem -Path "C:\Program Files (x86)\Intel\oneAPI\compiler" -Filter "$compiler.exe" -Recurse -ErrorAction SilentlyContinue | Sort-Object FullName -Descending | |
| if ($candidates.Count -gt 0) { | |
| $resolved = $candidates[0].FullName | |
| } | |
| } | |
| if (-not $resolved) { | |
| Write-Error "Unable to find $compiler.exe in PATH or oneAPI install path." | |
| exit 1 | |
| } | |
| "FC=$resolved" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| [System.IO.Path]::GetDirectoryName($resolved) | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
| - name: Set up MSYS2 (Windows gfortran) | |
| if: runner.os == 'Windows' && matrix.compiler == 'gcc' | |
| uses: msys2/setup-msys2@v2 | |
| with: | |
| update: true | |
| install: >- | |
| mingw-w64-ucrt-x86_64-gcc-fortran | |
| mingw-w64-ucrt-x86_64-cmake | |
| mingw-w64-ucrt-x86_64-ninja | |
| - name: Export MinGW gfortran path | |
| if: runner.os == 'Windows' && matrix.compiler == 'gcc' | |
| run: | | |
| echo "C:/msys64/ucrt64/bin" >> "$GITHUB_PATH" | |
| - name: Remove MinGW/MSYS paths for Intel Windows builds | |
| if: runner.os == 'Windows' && (matrix.compiler == 'intel' || matrix.compiler == 'intel-classic') | |
| shell: pwsh | |
| run: | | |
| $parts = $env:PATH -split ';' | |
| $clean = $parts | Where-Object { $_ -and ($_ -notmatch 'mingw') -and ($_ -notmatch 'msys') -and ($_ -notmatch 'strawberry') } | |
| "PATH=$($clean -join ';')" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| - name: Install build tools | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install ninja setuptools numpy cython | |
| - name: Record toolchain info | |
| run: | | |
| git --version | |
| cmake --version | |
| ninja --version | |
| if command -v gfortran &> /dev/null; then gfortran --version; fi | |
| if [ -n "${FC}" ]; then | |
| FC_BASENAME="$(basename "${FC}")" | |
| case "${FC_BASENAME}" in | |
| ifort|ifort.exe|ifx|ifx.exe) | |
| "${FC}" /help > /dev/null || true | |
| ;; | |
| *) | |
| "${FC}" --version || true | |
| ;; | |
| esac | |
| fi | |
| - name: Configure (Non-Intel Windows) | |
| if: runner.os != 'Windows' || matrix.compiler == 'gcc' | |
| run: | | |
| FC_COMPILER="${FC:-${{ matrix.fc }}}" | |
| cmake -S . -B build -G Ninja \ | |
| -DCMAKE_Fortran_COMPILER="${FC_COMPILER}" \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DCEA_BUILD_TESTING=OFF \ | |
| -DCEA_ENABLE_BIND_C=ON \ | |
| -DCEA_ENABLE_BIND_CXX=OFF \ | |
| -DCEA_ENABLE_BIND_PYTHON=OFF \ | |
| -DCEA_ENABLE_BIND_MATLAB=OFF \ | |
| -DCEA_ENABLE_BIND_EXCEL=OFF | |
| - name: Configure (Windows Intel) | |
| if: runner.os == 'Windows' && (matrix.compiler == 'intel' || matrix.compiler == 'intel-classic') | |
| shell: cmd | |
| run: | | |
| call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat" intel64 >nul | |
| cmake -S . -B build -G Ninja ^ | |
| -DCMAKE_Fortran_COMPILER="%FC%" ^ | |
| -DCMAKE_BUILD_TYPE=Release ^ | |
| -DCEA_BUILD_TESTING=OFF ^ | |
| -DCEA_ENABLE_BIND_C=ON ^ | |
| -DCEA_ENABLE_BIND_CXX=OFF ^ | |
| -DCEA_ENABLE_BIND_PYTHON=OFF ^ | |
| -DCEA_ENABLE_BIND_MATLAB=OFF ^ | |
| -DCEA_ENABLE_BIND_EXCEL=OFF | |
| - name: Build (Non-Intel Windows) | |
| if: runner.os != 'Windows' || matrix.compiler == 'gcc' | |
| run: | | |
| cmake --build build | |
| - name: Build (Windows Intel) | |
| if: runner.os == 'Windows' && (matrix.compiler == 'intel' || matrix.compiler == 'intel-classic') | |
| shell: cmd | |
| run: | | |
| call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat" intel64 >nul | |
| cmake --build build | |
| - name: Run smoke test (Unix) | |
| if: runner.os != 'Windows' | |
| run: | | |
| ./build/source/cea -h | |
| - name: Run smoke test (Windows) | |
| if: runner.os == 'Windows' && matrix.compiler == 'gcc' | |
| run: | | |
| ./build/source/cea.exe -h | |
| - name: Run smoke test (Windows Intel) | |
| if: runner.os == 'Windows' && (matrix.compiler == 'intel' || matrix.compiler == 'intel-classic') | |
| shell: cmd | |
| run: | | |
| call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat" intel64 >nul | |
| .\build\source\cea.exe -h | |
| - name: Verify C ABI library output (Unix) | |
| if: runner.os != 'Windows' | |
| run: | | |
| ls -la build/source/bind/c | |
| ls -la build/source/bind/c/libcea_bindc.* || ls -la build/source/bind/c/cea_bindc.* | |
| - name: Verify C ABI library output (Windows) | |
| if: runner.os == 'Windows' | |
| run: | | |
| ls -la build/source/bind/c | |
| ls -la build/source/bind/c/*cea_bindc* | |
| - name: Upload CLI executable artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: cea-cli-${{ matrix.label }} | |
| if-no-files-found: error | |
| path: | | |
| build/source/cea | |
| build/source/cea.exe | |
| build/thermo.lib | |
| build/trans.lib | |
| - name: Upload C ABI library artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: cea-bindc-${{ matrix.label }} | |
| if-no-files-found: error | |
| path: | | |
| source/bind/c/cea.h | |
| source/bind/c/cea_enum.h | |
| build/source/bind/c/libcea_bindc.so | |
| build/source/bind/c/libcea_bindc.dylib | |
| build/source/bind/c/cea_bindc.dll | |
| build/source/bind/c/cea_bindc.lib | |
| build/source/bind/c/libcea_bindc.dll.a | |
| pfunit-tests: | |
| name: pFUnit (ubuntu-22.04 / gcc 11) | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Check out CEA | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Set up Fortran compiler | |
| uses: fortran-lang/setup-fortran@v1 | |
| with: | |
| compiler: gcc | |
| version: "11" | |
| - name: Install build tools | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install ninja setuptools numpy cython | |
| - name: Build CEA + GFE (pFUnit) | |
| run: | | |
| scripts/develop.sh -G Ninja | |
| - name: Rebuild data libraries (compiler-native) | |
| run: | | |
| pushd data | |
| ../build-dev/source/cea --compile-thermo thermo.inp | |
| ../build-dev/source/cea --compile-trans trans.inp | |
| popd | |
| - name: Run pFUnit tests | |
| env: | |
| GFORTRAN_ERROR_BACKTRACE: "1" | |
| GFORTRAN_UNBUFFERED_ALL: "1" | |
| run: | | |
| ulimit -c unlimited | |
| ctest --output-on-failure --test-dir build-dev -V | |
| python-tests: | |
| name: Python (ubuntu-22.04 / gcc 11) | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Check out CEA | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Set up Fortran compiler | |
| uses: fortran-lang/setup-fortran@v1 | |
| with: | |
| compiler: gcc | |
| version: "11" | |
| - name: Install build tools | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install ninja pytest setuptools numpy cython | |
| - name: Install CEA (editable) | |
| run: | | |
| python -m pip install -e . | |
| - name: Import extension (no init) | |
| env: | |
| CEA_SKIP_INIT: "1" | |
| run: | | |
| python - <<'PY' | |
| import cea | |
| import cea.lib.libcea | |
| print("cea import ok") | |
| PY | |
| - name: Run pytest | |
| env: | |
| CEA_DATA_DIR: ${{ github.workspace }}/data | |
| run: | | |
| pytest source/bind/python/tests | |
| release-artifacts: | |
| name: Release CLI + C ABI Artifacts | |
| needs: build | |
| runs-on: ubuntu-22.04 | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Download build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: release-dist | |
| merge-multiple: false | |
| - name: Prepare release assets (unique names) | |
| run: | | |
| mkdir -p release-assets | |
| while IFS= read -r -d '' file; do | |
| rel="${file#release-dist/}" | |
| artifact="${rel%%/*}" | |
| subpath="${rel#*/}" | |
| asset_name="${artifact}__${subpath//\//__}" | |
| cp "${file}" "release-assets/${asset_name}" | |
| done < <(find release-dist -type f -print0) | |
| - name: Generate SHA256 checksums | |
| run: | | |
| cd release-assets | |
| find . -maxdepth 1 -type f -print0 | sort -z | xargs -0 sha256sum > SHA256SUMS.txt | |
| cat SHA256SUMS.txt | |
| - name: Publish GitHub release assets | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: release-assets/* | |
| generate_release_notes: true | |
| bindc: | |
| name: Build (${{ matrix.os }} / ${{ matrix.toolchain.ccompiler }} / ${{matrix.toolchain.fcompiler}}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-22.04, macos-latest, windows-latest] | |
| toolchain: | |
| - ccompiler: gcc | |
| cversion: "11" | |
| fcompiler: gcc | |
| fversion: "11" | |
| include: | |
| - os: ubuntu-24.04 | |
| toolchain: | |
| ccompiler: gcc | |
| cversion: "13" | |
| fcompiler: gcc | |
| fversion: "13" | |
| - os: ubuntu-22.04 | |
| toolchain: | |
| ccompiler: intel | |
| cversion: "2023.1" | |
| fcompiler: intel | |
| fversion: "2023.1" | |
| - os: ubuntu-22.04 | |
| toolchain: | |
| ccompiler: intel-classic | |
| cversion: "2021.9" | |
| fcompiler: intel-classic | |
| fversion: "2021.9" | |
| - os: windows-latest | |
| toolchain: | |
| ccompiler: msvc | |
| cversion: latest | |
| fcompiler: intel | |
| fversion: "2025.2" | |
| - os: windows-latest | |
| toolchain: | |
| ccompiler: intel | |
| cversion: "2025.2" | |
| fcompiler: intel | |
| fversion: "2025.2" | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| - name: Check out CEA | |
| uses: actions/checkout@v6 | |
| - name: Check out GFE | |
| if: ${{ runner.os != 'Windows' }} | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: Goddard-Fortran-Ecosystem/GFE | |
| path: extern/gfe | |
| submodules: true | |
| - name: Set up Fortran compiler | |
| if: ${{ runner.os != 'Windows' || matrix.toolchain.fcompiler != 'gcc' }} | |
| uses: fortran-lang/setup-fortran@v1 | |
| with: | |
| compiler: ${{ matrix.toolchain.fcompiler }} | |
| version: ${{ matrix.toolchain.fversion }} | |
| - name: Set up Fortran compiler (Windows, gfortran) | |
| if: ${{ runner.os == 'Windows' && matrix.toolchain.fcompiler == 'gcc' }} | |
| run: | | |
| # Use pre-installed MinGW on Windows runners to avoid Chocolatey issues | |
| # GitHub Actions windows-latest runners include MinGW in C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin | |
| $mingwPath = "C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin" | |
| if (Test-Path $mingwPath) { | |
| echo "$mingwPath" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
| echo "FC=$mingwPath\gfortran.exe" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| } else { | |
| # Fallback: search for gfortran in common locations | |
| $gfortran = Get-Command gfortran -ErrorAction SilentlyContinue | |
| if ($gfortran) { | |
| echo "FC=$($gfortran.Source)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| } else { | |
| Write-Error "gfortran not found on Windows runner" | |
| exit 1 | |
| } | |
| } | |
| shell: pwsh | |
| - name: Set up C Compiler | |
| if: ${{matrix.toolchain.ccompiler == 'msvc'}} | |
| uses: ilammy/msvc-dev-cmd@v1 | |
| - name: Install build tools | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install ninja setuptools numpy cython | |
| - name: Record toolchain info | |
| run: | | |
| git --version | |
| cmake --version | |
| ninja --version | |
| if command -v gfortran &> /dev/null; then gfortran --version; fi | |
| if [ -n "${FC}" ]; then "${FC}" --version; fi | |
| - name: Configure and Build GFE | |
| if: ${{ runner.os != 'Windows' }} | |
| run: | | |
| cmake -S extern/gfe -B build/extern/gfe -GNinja \ | |
| -DCMAKE_INSTALL_PREFIX=build/install \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DSKIP_MPI=YES \ | |
| -DSKIP_OPENMP=YES \ | |
| -DSKIP_FHAMCREST=YES \ | |
| -DSKIP_ESMF=YES \ | |
| -DSKIP_ROBUST=YES | |
| cmake --build build/extern/gfe --target install | |
| - name: Configure (linux) | |
| if: ${{runner.os != 'Windows' || matrix.toolchain.ccompiler != 'msvc'}} | |
| run: | | |
| cmake -S . -B build -G Ninja \ | |
| -DCMAKE_PREFIX_PATH=build/install \ | |
| -DCMAKE_BUILD_TYPE=Debug \ | |
| -DCEA_BUILD_TESTING=ON \ | |
| -DCEA_ENABLE_BIND_C=ON \ | |
| -DCEA_ENABLE_BIND_CXX=OFF \ | |
| -DCEA_ENABLE_BIND_PYTHON=OFF \ | |
| -DCEA_ENABLE_BIND_MATLAB=OFF \ | |
| -DCEA_ENABLE_BIND_EXCEL=OFF \ | |
| -DCMAKE_Fortran_FLAGS="-ffree-line-length-none" | |
| - name: Configure (msvc) | |
| if: ${{runner.os == 'Windows' && matrix.toolchain.ccompiler == 'msvc'}} | |
| run: | | |
| cmake -S . -B build -G Ninja \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DCEA_BUILD_TESTING=ON \ | |
| -DCEA_ENABLE_BIND_C=ON \ | |
| -DCEA_ENABLE_BIND_CXX=OFF \ | |
| -DCEA_ENABLE_BIND_PYTHON=OFF \ | |
| -DCEA_ENABLE_BIND_MATLAB=OFF \ | |
| -DCEA_ENABLE_BIND_EXCEL=OFF \ | |
| -DCMAKE_C_COMPILER=cl \ | |
| -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON | |
| - name: Build | |
| run: | | |
| cmake --build build | |
| - name: Run smoke test (Unix) | |
| if: runner.os != 'Windows' | |
| run: | | |
| ./build/source/cea -h | |
| - name: Run smoke test (Windows) | |
| if: runner.os == 'Windows' | |
| run: | | |
| ./build/source/cea.exe -h | |
| - name: Run ctest | |
| run: ctest --test-dir build --output-on-failure |