Skip to content

Merge pull request #8817 from akramhany/EnhResolveCustomOp #2

Merge pull request #8817 from akramhany/EnhResolveCustomOp

Merge pull request #8817 from akramhany/EnhResolveCustomOp #2

name: Exhaustive checks
on:
push:
branches:
- main
tags:
- 'v*'
pull_request:
types:
- labeled
- unlabeled
- synchronize
- opened
- reopened
branches:
- main
# For a PR #7488 against main branch, the `group` will become: CI-{{ 7488 || github.sha }}
# which eventually evaluates to: CI-7488 and 'sha' isn't used.
# NOTE: `||` acts as a logical OR and a default operator both,
# see: https://docs.github.com/en/actions/learn-github-actions/expressions#operators.
# When it isn't a PR against main but instead a commit pushed (or merged) to main, then `group` will
# evaluate to `${{ github.sha }}` but "cancel-in-progress" evaluates to false, so the CI on main
# will run in a new group `${{ github.sha }}`, but no previous CI will be cancelled on main
concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.sha }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
MACOSX_DEPLOYMENT_TARGET: 15.0
jobs:
debug_outOfSource:
name: Check Out-of-Source Debug build
runs-on: ubuntu-latest
if: contains(github.event.pull_request.labels.*.name, 'Tests::Run-Exhaustive') || github.event_name == 'push'
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
path: src
- uses: mamba-org/[email protected]
with:
micromamba-version: '1.5.10-0'
environment-file: src/ci/environment_linux.yml
create-args: >-
python=3.10
- uses: hendrikmuhs/ccache-action@main
with:
variant: sccache
key: ${{ github.job }}-${{ matrix.os }}
- name: Build Linux
shell: bash -e -l {0}
run: |
( cd src && ./build0.sh )
export CXXFLAGS="-Werror"
cmake -S src -B builddir -GNinja \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DWITH_LLVM=yes \
-DWITH_LSP=yes \
-DWITH_KOKKOS=yes \
-DLFORTRAN_BUILD_ALL=yes \
-DWITH_STACKTRACE=no \
-DWITH_RUNTIME_STACKTRACE=yes \
-DCMAKE_PREFIX_PATH="$CONDA_PREFIX" \
-DCMAKE_INSTALL_PREFIX=`pwd`/inst \
-DCMAKE_C_COMPILER_LAUNCHER=sccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache
cmake --build builddir -j16 --target install
- name: Test Linux
shell: bash -e -l {0}
run: ctest --output-on-failure
working-directory: builddir
- name: Test Moved Installation
shell: bash -e -l {0}
run: |
mv inst inst.moved
cp src/examples/expr2.f90 expr2.F90
rm -rf src
inst.moved/bin/lfortran expr2.F90 -o expr2
./expr2
inst.moved/bin/lfortran --backend=c expr2.F90 -o expr2b
./expr2b
inst.moved/bin/lfortran --openmp --backend=cpp expr2.F90 -o expr2c
./expr2c
release:
name: Check Release build
runs-on: ubuntu-latest
if: contains(github.event.pull_request.labels.*.name, 'Tests::Run-Exhaustive') || github.event_name == 'push'
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: mamba-org/[email protected]
with:
micromamba-version: '2.0.4-0'
environment-file: ci/environment_linux.yml
create-args: >-
python=3.10
- uses: hendrikmuhs/ccache-action@main
with:
variant: sccache
key: ${{ github.job }}-${{ matrix.os }}
- name: Build Linux
shell: bash -e -l {0}
run: |
./build0.sh
export CXXFLAGS="-Werror"
export CFLAGS="-Werror"
cmake . -GNinja \
-DCMAKE_BUILD_TYPE=Release \
-DWITH_LLVM=yes \
-DWITH_LSP=yes \
-DLFORTRAN_BUILD_ALL=yes \
-DWITH_STACKTRACE=no \
-DWITH_RUNTIME_STACKTRACE=yes \
-DCMAKE_PREFIX_PATH="$CONDA_PREFIX" \
-DCMAKE_INSTALL_PREFIX=`pwd`/inst \
-DCMAKE_INSTALL_BINDIR=bin/tastic \
-DCMAKE_INSTALL_LIBDIR=oh/my/sweet/lib \
-DCMAKE_INSTALL_INCLUDEDIR=incl/O/Matic \
-DCMAKE_INSTALL_MANDIR=man/O/man \
-DCMAKE_C_COMPILER_LAUNCHER=sccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache
cmake --build . -j16 --target install
- name: Test Linux
shell: bash -e -l {0}
run: |
ctest
./run_tests.py
./run_tests.py -vh
cd integration_tests
./run_tests.py -m
./run_tests.py -b llvm
./run_tests.py -b llvm -f -nf16
- name: Test Installation
shell: bash -e -l {0}
run: |
test -x inst/bin/tastic/lfortran
test -f inst/oh/my/sweet/lib/liblfortran_runtime_static.a
test -f inst/oh/my/sweet/lib/liblfortran_runtime.so
test -f inst/incl/O/Matic/lfortran/impure/lfortran_intrinsics.h
test -f inst/man/O/man/man1/lfortran.1
# Commented out to save CI runners:
# test-pixi:
# name: Pixi Build (${{ matrix.os }})
# runs-on: ${{ matrix.os }}
# strategy:
# fail-fast: false
# matrix:
# os: ["ubuntu-latest"]
# steps:
# - uses: actions/checkout@v5
# with:
# fetch-depth: 0
# - uses: prefix-dev/[email protected]
# with:
# pixi-version: v0.37.0
# cache: true
# - name: LLVM 10
# run: |
# pixi run -e llvm10 build
# pixi run start --version
# pixi run ctest
# pixi run integration_tests
# pixi run clean
# - name: LLVM 11
# run: |
# pixi run -e llvm11 build
# pixi run start --version
# pixi run ctest
# pixi run tests # Only run for LLVM 11
# pixi run integration_tests
# pixi run clean
# - name: LLVM 19
# run: |
# pixi run -e llvm19 build
# pixi run start --version
# pixi run ctest
# pixi run integration_tests
# pixi run clean
test_llvm:
name: Test LLVM ${{ matrix.llvm-version }}
runs-on: ${{ matrix.os }}
if: contains(github.event.pull_request.labels.*.name, 'Tests::Run-Exhaustive') || github.event_name == 'push'
strategy:
fail-fast: false
matrix:
# this is only run on ubuntu intentionally
os: ["ubuntu-latest"]
# Note: The LLVM 11 test is redundant, since it is already tested by
# most other tests (since LLVM 11 is our default version), but we have
# it here as well for consistency, and that way other tests can freely
# switch to other versions as needed. We test all versions here in
# exactly the same manner, to ensure that users can just change the
# `llvmdev` version in their conda environment and everything will just
# work.
llvm-version: ["7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21"]
python-version: ["3.10"]
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: mamba-org/[email protected]
if: contains(matrix.llvm-version, '19')
with:
micromamba-version: '2.0.4-0'
environment-file: ci/environment_linux_llvm.yml
create-args: >-
python=${{ matrix.python-version }}
llvmdev=${{ matrix.llvm-version }}
bison=3.4
openblas=0.3.21
llvm-openmp=14.0.4
make=4.3
nodejs=18.20.4
openmpi=5.0.6
- uses: mamba-org/[email protected]
if: contains(matrix.llvm-version, '10')
with:
micromamba-version: '2.0.4-0'
environment-file: ci/environment_linux_llvm.yml
create-args: >-
python=${{ matrix.python-version }}
llvmdev=${{ matrix.llvm-version }}
bison=3.4
openblas=0.3.21
llvm-openmp=14.0.4
make=4.3
nodejs=18.20.2
openmpi=5.0.6
- uses: mamba-org/[email protected]
if: contains(matrix.llvm-version, '12')
with:
micromamba-version: '2.0.4-0'
environment-file: ci/environment_linux_llvm.yml
create-args: >-
python=${{ matrix.python-version }}
llvmdev=${{ matrix.llvm-version }}
bison=3.4
openblas=0.3.21
llvm-openmp=14.0.4
make=4.3
openmpi=5.0.3
- uses: mamba-org/[email protected]
if: ${{! (contains(matrix.llvm-version, '10') || contains(matrix.llvm-version, '19') || contains(matrix.llvm-version, '12'))}}
with:
micromamba-version: '2.0.4-0'
environment-file: ci/environment_linux_llvm.yml
create-args: >-
python=${{ matrix.python-version }}
llvmdev=${{ matrix.llvm-version }}
bison=3.4
openblas=0.3.21
llvm-openmp=14.0.4
make=4.3
openmpi=5.0.6
- uses: hendrikmuhs/ccache-action@main
with:
variant: sccache
key: ${{ github.job }}-${{ matrix.llvm-version }}
- name: Install libunwind
if: matrix.llvm-version > 11
run: micromamba install -y -n lf libunwind=1.7.2
- name: Setup WASI SDK
if: contains(matrix.llvm-version, '10') || contains(matrix.llvm-version, '19')
shell: bash -e -l {0}
run: |
mkdir -p $HOME/ext
cd $HOME/ext
curl -o wasi-sdk.tar.gz -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-21/wasi-sdk-21.0-linux.tar.gz
tar -xvf wasi-sdk.tar.gz
mv wasi-sdk-21.0 wasi-sdk
export WASI_SDK_PATH=$HOME/ext/wasi-sdk
echo $WASI_SDK_PATH
$WASI_SDK_PATH/bin/clang --version
- name: Install wasmtime
if: contains(matrix.llvm-version, '10') || contains(matrix.llvm-version, '19')
shell: bash -e -l {0}
run: |
cd $HOME
curl -o wasmtime.tar.gz -L https://github.com/bytecodealliance/wasmtime/releases/download/v19.0.2/wasmtime-v19.0.2-x86_64-linux.tar.xz
tar -xvf wasmtime.tar.gz
export PATH=$HOME/wasmtime-v19.0.2-x86_64-linux:$PATH
wasmtime --version
- name: Setup Emscripten SDK
if: contains(matrix.llvm-version, '10') || contains(matrix.llvm-version, '19')
shell: bash -e -l {0}
run: |
mkdir -p $HOME/ext
cd $HOME/ext
curl -o emsdk.tar.gz -L https://github.com/emscripten-core/emsdk/archive/refs/tags/4.0.13.tar.gz
tar -xvf emsdk.tar.gz
mv emsdk-4.0.13 emsdk
export EMSDK_PATH=$HOME/ext/emsdk
echo $EMSDK_PATH
cd $EMSDK_PATH
./emsdk install 3.1.35
./emsdk activate 3.1.35
- name: Build Linux ( WASM )
if: contains(matrix.llvm-version, '10') || contains(matrix.llvm-version, '19')
shell: bash -e -l {0}
run: |
export WASI_SDK_PATH=$HOME/ext/wasi-sdk
export EMSDK_PATH=$HOME/ext/emsdk
./build0.sh
cmake . -GNinja \
-DCMAKE_BUILD_TYPE=Debug \
-DWITH_LLVM=yes \
-DWITH_LSP=yes \
-DWITH_TARGET_WASM=yes \
-DLFORTRAN_BUILD_ALL=yes \
-DWITH_STACKTRACE=no \
-DCMAKE_PREFIX_PATH="$CONDA_PREFIX" \
-DCMAKE_INSTALL_PREFIX=`pwd`/inst \
-DCMAKE_C_COMPILER_LAUNCHER=sccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache
cmake --build . -j16 --target install
- name: Test Linux ( WASM )
if: contains(matrix.llvm-version, '10') || contains(matrix.llvm-version, '19')
shell: bash -e -l {0}
run: |
export WASI_SDK_PATH=$HOME/ext/wasi-sdk
export EMSDK_PATH=$HOME/ext/emsdk
export PATH=$HOME/wasmtime-v19.0.2-x86_64-linux:$PATH
export WASMTIME_NEW_CLI=0
cd integration_tests
./run_tests.py -b llvm_wasm llvm_wasm_emcc
- name: Build Linux
if: ${{! (contains(matrix.llvm-version, '10') || contains(matrix.llvm-version, '19'))}}
shell: bash -e -l {0}
run: |
./build0.sh
cmake . -GNinja \
-DCMAKE_BUILD_TYPE=Debug \
-DWITH_LLVM=yes \
-DWITH_LSP=yes \
-DLFORTRAN_BUILD_ALL=yes \
-DWITH_STACKTRACE=no \
-DCMAKE_PREFIX_PATH="$CONDA_PREFIX" \
-DCMAKE_INSTALL_PREFIX=`pwd`/inst \
-DCMAKE_C_COMPILER_LAUNCHER=sccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache
cmake --build . -j16 --target install
# LLVM 10-19 all work in exactly the same way, so the test is identical
- name: Test Linux LLVM 8-16
if: ${{(contains(matrix.llvm-version, '8') || contains(matrix.llvm-version, '9') || contains(matrix.llvm-version, '10') || contains(matrix.llvm-version, '11') || contains(matrix.llvm-version, '12') || contains(matrix.llvm-version, '13') || contains(matrix.llvm-version, '14') || contains(matrix.llvm-version, '15') || contains(matrix.llvm-version, '16'))}}
shell: bash -e -l {0}
run: |
cd integration_tests
./run_tests.py -b llvm -sc
./run_tests.py -b llvm llvmImplicit
./run_tests.py -b llvm llvmImplicit -f -nf16
./run_tests.py -b llvm_submodule
./run_tests.py -b llvm_submodule -sc
- name: Test Linux LLVM 17-21
if: ${{(contains(matrix.llvm-version, '17') || contains(matrix.llvm-version, '18') || contains(matrix.llvm-version, '19') || contains(matrix.llvm-version, '20') || contains(matrix.llvm-version, '21'))}}
shell: bash -e -l {0}
run: |
ctest --output-on-failure
cd integration_tests
./run_tests.py -b llvm -sc
./run_tests.py -b llvm llvmImplicit
./run_tests.py -b llvm llvmImplicit -f
./run_tests.py -b llvm_submodule
./run_tests.py -b llvm_submodule -sc
- name: Check SciPy Build and Test Run - Test SciPy
shell: bash -e -x -l {0}
if: contains(matrix.os, 'ubuntu') && contains(matrix.llvm-version, '11')
run: |
git clone https://github.com/scipy/scipy.git
cd scipy
git checkout 527f2ddcda98ebf4dae37abc38c85082218fcd6a
find . -name "*.f" > files.txt
files=$(<files.txt)
for file in $files; do
../src/bin/lfortran --fixed-form fmt --no-color $file > $file.f90
gfortran -fallow-argument-mismatch -ffree-line-length-none -c $file.f90 -o $file.o
#if [[ "$file" == *"minpack"* ]]; then
# if [[ "$file" != *"dpmpar.f"* ]]; then
# ../src/bin/lfortran --show-asr --no-indent --no-color --fixed-form --implicit-typing --implicit-interface $file > $file.asr
# fi
#fi
done
cd ..
rm -rf scipy/
git clone https://github.com/pranavchiku/scipy.git
cd scipy
git checkout -t origin/scipy1
git checkout a70f11a305edd024cb9a0e5048257eb0f51e29e1
find . -name "*.f" > files.txt
files=$(<files.txt)
for file in $files; do
../src/bin/lfortran --fixed-form --implicit-typing --implicit-interface --implicit-argument-casting --show-asr --no-color $file > $file.f90
done
cd ..
rm -rf scipy/
- name: Check SciPy Build and Test Run - Build SciPy
shell: bash -e -x -l {0}
if: contains(matrix.os, 'ubuntu') && contains(matrix.llvm-version, '11')
run: |
git clone https://github.com/scipy/scipy
cd scipy
git remote add ondrej https://github.com/certik/scipy
git fetch ondrej
git checkout -t ondrej/merge_special_minpack_minpack2_fitpack_integrate_02
git checkout de851b31c795d41ce9e1fdead3dac7afff173156
micromamba env create -f environment.yml
micromamba activate scipy-dev
git submodule update --init
mkdir lfortran-build/
cd lfortran-build/
LIBRARY_PATH="`pwd`/../../src/runtime/"
FC=$(pwd)/../../src/bin/lfortran cmake \
-DCMAKE_Fortran_FLAGS=--verbose \
-DLFORTRAN_RUNTIME_LIBRARY_PATH=$LIBRARY_PATH \
..
make install
cp ${{ github.workspace }}/src/runtime/liblfortran_runtime.* $CONDA_PREFIX/lib
cd ../
python dev.py build
- name: Check SciPy Build and Test Run - Test SciPy Special (Specfun, Amos, Mach and Cdflib)
shell: bash -e -x -l {0}
if: contains(matrix.os, 'ubuntu') && contains(matrix.llvm-version, '11')
run: |
cd scipy/
micromamba activate scipy-dev
python dev.py test -t scipy.special -v
- name: Check SciPy Build and Test Run - Test SciPy Minpack & Minpack2
shell: bash -e -x -l {0}
if: contains(matrix.os, 'ubuntu') && contains(matrix.llvm-version, '11')
run: |
cd scipy/
micromamba activate scipy-dev
python dev.py test -t scipy.optimize -v
- name: Check SciPy Build and Test Run - Test SciPy Fitpack
shell: bash -e -x -l {0}
if: contains(matrix.os, 'ubuntu') && contains(matrix.llvm-version, '11')
run: |
cd scipy/
micromamba activate scipy-dev
python dev.py test -t scipy.interpolate -v
- name: Check SciPy Build and Test Run - Test SciPy Mach & Quadpack (Integrate)
shell: bash -e -x -l {0}
if: contains(matrix.os, 'ubuntu') && contains(matrix.llvm-version, '11')
run: |
cd scipy/
micromamba activate scipy-dev
python dev.py test -t scipy.integrate -v
- name: Test third party codes
shell: bash -e -x -l {0}
if: ${{! (matrix.llvm-version == '7') }}
run: |
export PATH="$(pwd)/src/bin:$PATH"
RUNNER_OS="${{matrix.os}}" FC=lfortran ci/test_third_party_codes.sh
upload_tarball:
name: Upload Tarball
runs-on: ubuntu-latest
if: contains(github.event.pull_request.labels.*.name, 'Tests::Run-Exhaustive') || github.event_name == 'push'
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: mamba-org/[email protected]
with:
micromamba-version: '2.0.4-0'
environment-file: ci/environment_linux.yml
create-args: >-
python=3.10
- name: Upload Tarball
shell: bash -e -l {0}
run: |
./build0.sh
lfortran_version=$(<version)
pandoc --standalone --to man doc/man/lfortran.md -o doc/man/lfortran.1
ci/create_source_tarball.sh $lfortran_version
ci/upload_tarball.sh
env:
SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }}
- name: Upload Tarball to Release
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
shell: bash -e -l {0}
run: |
ci/upload_tarball_to_release.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
test_without_llvm:
name: Test without LLVM Backend
runs-on: ubuntu-latest
if: contains(github.event.pull_request.labels.*.name, 'Tests::Run-Exhaustive') || github.event_name == 'push'
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: mamba-org/[email protected]
with:
micromamba-version: '2.0.4-0'
environment-file: ci/environment_linux.yml
create-args: >-
python=3.10
- name: Test
shell: bash -e -l {0}
run: |
shell ci/test_without_llvm_backend.sh
test_mlir:
name: Test MLIR backend
runs-on: ubuntu-latest
if: contains(github.event.pull_request.labels.*.name, 'Tests::Run-Exhaustive') || github.event_name == 'push'
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: mamba-org/[email protected]
with:
micromamba-version: '2.0.4-0'
environment-file: ci/environment_linux_llvm.yml
create-args: >-
python=3.10
mlir=19.1.6
llvm=19.1.6
llvm-openmp=19.1.6
libunwind=1.7.2
- uses: hendrikmuhs/ccache-action@main
with:
variant: sccache
key: ${{ github.job }}-${{ matrix.os }}
- name: Build Linux
shell: bash -e -l {0}
run: |
./build0.sh
cmake . -GNinja \
-DCMAKE_BUILD_TYPE=Debug \
-DWITH_LLVM=yes \
-DWITH_LSP=yes \
-DWITH_MLIR=yes \
-DLFORTRAN_BUILD_ALL=yes \
-DWITH_STACKTRACE=no \
-DCMAKE_PREFIX_PATH="$CONDA_PREFIX" \
-DCMAKE_INSTALL_PREFIX=`pwd`/inst \
-DCMAKE_C_COMPILER_LAUNCHER=sccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache
cmake --build . -j16 --target install
- name: Test Linux
shell: bash -e -l {0}
run: |
cd integration_tests
./run_tests.py -b mlir mlir_omp mlir_llvm_omp -j1
upload_docs:
name: Documentation
runs-on: ubuntu-latest
if: contains(github.event.pull_request.labels.*.name, 'Tests::Run-Exhaustive') || github.event_name == 'push'
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: mamba-org/[email protected]
with:
micromamba-version: '2.0.4-0'
environment-file: ci/environment_docs_linux.yml
- uses: hendrikmuhs/ccache-action@main
with:
variant: sccache
key: ${{ github.job }}-${{ matrix.os }}
- name: Build Kernel
shell: bash -e -l {0}
run: |
./build0.sh
export CXXFLAGS="-Werror"
cmake . -GNinja \
-DCMAKE_BUILD_TYPE=Debug \
-DWITH_LLVM=yes \
-DWITH_LSP=yes \
-DWITH_XEUS=yes \
-DCMAKE_PREFIX_PATH=$CONDA_PREFIX \
-DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX \
-DCMAKE_C_COMPILER_LAUNCHER=sccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache
ninja install
ctest --output-on-failure
jupyter kernelspec list --json
- name: Build Docs
shell: bash -e -l {0}
working-directory: doc
run: |
$(command -v python) build.py
- name: Upload Docs
shell: bash -e -l {0}
working-directory: doc
run: |
../ci/upload_docs.sh
env:
SSH_PRIVATE_KEY_DOCS: ${{ secrets.SSH_PRIVATE_KEY_DOCS }}
build-and-push-image:
runs-on: ubuntu-latest
if: contains(github.event.pull_request.labels.*.name, 'Tests::Run-Exhaustive') || github.event_name == 'push'
permissions:
contents: read
packages: write
env:
REGISTRY: ghcr.io
USER: lfortran
PROJECT: lfortran
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Log in to the Container registry
if: ${{ github.event_name == 'push' }}
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ env.USER }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
push: ${{ github.event_name == 'push' }}
tags: ${{ env.REGISTRY }}/${{ env.USER }}/${{ env.PROJECT }}:latest