Skip to content

Merge pull request #7361 from xaerru/fix-deepcopy #19

Merge pull request #7361 from xaerru/fix-deepcopy

Merge pull request #7361 from xaerru/fix-deepcopy #19

Workflow file for this run

name: CI
on:
push:
branches:
- main
tags:
- 'v*'
pull_request:
branches:
- main
env:
MACOSX_DEPLOYMENT_TARGET: 14.0
jobs:
Check_for_Added_Binary_Files:
name: Check for Added Binary Files
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check for Added Binary Files
run: python3 check_binary_file_in_git_history.py
Build:
name: LFortran CI (${{ matrix.python-version }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["windows-2019", "macos-latest", "ubuntu-latest"]
python-version: ["3.10"]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: mamba-org/[email protected]
with:
micromamba-version: '2.0.4-0'
environment-file: ci/environment.yml
create-args: >-
python=${{ matrix.python-version }}
- name: Install Windows Packages
if: contains(matrix.os, 'windows')
shell: bash -e -l {0}
run: micromamba install m2-bison=3.0.4 m2-filesystem cmake=3.21.1
- name: Install Linux / macOS Packages
if: contains(matrix.os, 'ubuntu') || contains(matrix.os, 'macos')
shell: bash -e -l {0}
run: micromamba install bison=3.4
- uses: hendrikmuhs/ccache-action@main
with:
key: ${{ github.job }}-${{ matrix.os }}
- name: Setup Platform
shell: bash -e -l {0}
run: |
echo "LFORTRAN_CMAKE_GENERATOR=Ninja" >> $GITHUB_ENV
echo "CMAKE_C_COMPILER_LAUNCHER=ccache" >> $GITHUB_ENV
echo "CMAKE_CXX_COMPILER_LAUNCHER=ccache" >> $GITHUB_ENV
echo "ENABLE_RUNTIME_STACKTRACE=yes" >> $GITHUB_ENV
- name: Build (Linux / macOS)
shell: bash -e -l {0}
if: contains(matrix.os, 'ubuntu') || contains(matrix.os, 'macos')
run: |
export CXXFLAGS="-Werror"
export CFLAGS="-Werror"
xonsh ci/build_tmp.xsh
- name: Build (Windows)
if: contains(matrix.os, 'windows')
shell: cmd
run: |
set MAMBA_INSTALL_LOCN=C:\\Users\runneradmin\micromamba
call %MAMBA_INSTALL_LOCN%\Scripts\activate.bat
call micromamba activate lf
set LFORTRAN_CMAKE_GENERATOR=Ninja
set WIN=1
set MACOS=0
set ENABLE_RUNTIME_STACKTRACE=no
call "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat"
xonsh ci\build_tmp.xsh
- name: Test (Linux / macOS)
shell: bash -e -l {0}
if: contains(matrix.os, 'ubuntu') || contains(matrix.os, 'macos')
run: |
case "$OSTYPE" in darwin*) export MACOS=1;; *) export MACOS=0;; esac
export LFORTRAN_TEST_ENV_VAR='STATUS OK!'
shell ci/test.sh
- name: Test LFortran's Command Line Interface (Linux / macOS)
shell: bash -e -l {0}
if: contains(matrix.os, 'ubuntu') || contains(matrix.os, 'macos')
run: |
./test_lfortran_cmdline
- name: Test with specific Fortran standard
shell: bash -e -l {0}
if: contains(matrix.os, 'ubuntu') || contains(matrix.os, 'macos')
run: |
cd ./integration_tests
./run_tests.py -b llvm --std=f23
./run_tests.py -b llvm -f --std=f23 -nf16
- name: Test (Windows)
if: contains(matrix.os, 'windows')
shell: cmd
run: |
set MAMBA_INSTALL_LOCN=C:\\Users\runneradmin\micromamba
call %MAMBA_INSTALL_LOCN%\Scripts\activate.bat
call micromamba activate lf
set LFORTRAN_CMAKE_GENERATOR=Ninja
set WIN=1
set MACOS=0
set ENABLE_RUNTIME_STACKTRACE=no
call "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat"
shell ci\test.sh
scipy:
name: Check SciPy Build and Test Run
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
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
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
- name: Test SciPy
shell: bash -e -x -l {0}
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: Build SciPy
shell: bash -e -x -l {0}
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_01
git checkout 503037097dad5a7d33c1445e8778a9cdf1f9ef11
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: Test SciPy Special (Specfun, Amos, Mach and Cdflib)
shell: bash -e -x -l {0}
run: |
cd scipy/
micromamba activate scipy-dev
python dev.py test -t scipy.special -v
- name: Test SciPy Minpack & Minpack2
shell: bash -e -x -l {0}
run: |
cd scipy/
micromamba activate scipy-dev
python dev.py test -t scipy.optimize -v
- name: Test SciPy Fitpack
shell: bash -e -x -l {0}
run: |
cd scipy/
micromamba activate scipy-dev
python dev.py test -t scipy.interpolate -v
- name: Test SciPy Mach & Quadpack (Integrate)
shell: bash -e -x -l {0}
run: |
cd scipy/
micromamba activate scipy-dev
python dev.py test -t scipy.integrate -v
build_to_wasm_and_upload:
name: Build LFortran to WASM and Upload
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v4
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 : Remove existing node
shell: bash -e -l {0}
run : |
which node
node -v
sudo rm -rf /usr/local/bin/node /usr/local/bin/npm
- name: Install Emscripten from Git
# TODO: This fails with "-e" for some reason:
shell: bash -l {0}
run: |
mkdir $HOME/ext
cd $HOME/ext
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
./emsdk install 3.1.35
./emsdk activate 3.1.35
./emsdk install node-18.20.3-64bit
./emsdk activate node-18.20.3-64bit
- name: Show Emscripten and Node Info
shell: bash -l {0}
run: |
set -ex
# Activate PATH and other environment variables in the current terminal
source $HOME/ext/emsdk/emsdk_env.sh
emcc -v
em++ -v
which node
node -v
- name: Build to WASM
shell: bash -l {0}
run: |
set -ex
source $HOME/ext/emsdk/emsdk_env.sh # Activate Emscripten
./build_to_wasm.sh
- name: Test built lfortran.wasm
shell: bash -l {0}
run: |
set -ex
source $HOME/ext/emsdk/emsdk_env.sh # Activate Emscripten
which node
node -v
node src/lfortran/tests/test_lfortran.js
- name: Upload to wasm_builds
shell: bash -l {0}
run: |
ci/upload_lfortran_wasm.sh
env:
SSH_PRIVATE_KEY_WASM_BUILDS: ${{ secrets.SSH_PRIVATE_KEY_WASM_BUILDS }}
debug_outOfSource:
name: Check Out-of-Source Debug build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
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
steps:
- uses: actions/checkout@v4
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
third_party_code_compile:
name: Check Third Party Code Compilation - OS (${{ matrix.os }}), LLVM (${{ matrix.llvm-version }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["macos-latest", "ubuntu-latest"]
llvm-version: ["11", "19"]
python-version: ["3.10"]
steps:
- uses: actions/checkout@v4
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=${{ 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.os }}
- name: Install libunwind
if: contains(matrix.os, 'ubuntu') && (matrix.llvm-version != 11)
run: micromamba install -y -n lf libunwind=1.7.2
- name: Build Linux
shell: bash -e -l {0}
if: contains(matrix.os, 'ubuntu')
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
- name: Build MacOS
shell: bash -e -l {0}
if: contains(matrix.os, 'macos')
run: |
./build0.sh
./build1.sh
- name: Test third party codes
shell: bash -e -x -l {0}
run: |
export PATH="$(pwd)/src/bin:$PATH"
RUNNER_OS="${{matrix.os}}" FC="$(pwd)/src/bin/lfortran" ci/test_third_party_codes.sh
# The below projects are tested with a higher CMake version, so replace the current installed version
- name: Override cmake version to 3.31.2
if: contains(matrix.os, 'ubuntu')
run: micromamba install -y -n lf cmake=3.31.2
- name: Test Examples/Project 1
shell: bash -e -l {0}
if: contains(matrix.os, 'ubuntu')
run: |
cd ./examples/project1
FC=../../src/bin/lfortran cmake .
cmake --build . -v
./project1
- name: Test Examples/Project 2
shell: bash -e -l {0}
if: contains(matrix.os, 'ubuntu')
run: |
cd ./examples/project2
FC=../../src/bin/lfortran cmake .
cmake --build . -v
./doconcurrent
- name: Test Examples/Project 3
shell: bash -e -l {0}
if: contains(matrix.os, 'ubuntu')
run: |
cd ./examples/project3
FC=../../src/bin/lfortran cmake .
cmake --build . -v
./project3
- name: Test Lapack
shell: bash -e -l {0}
run: |
export PATH="$(pwd)/src/bin:$PATH"
git clone https://github.com/gxyd/lapack.git
cd lapack
git fetch origin lf_07
git checkout lf_07
git checkout 9d9e48987ca109d46b92d515b59cb591fab9859a
cd build
micromamba create -f environment_unix.yml
micromamba activate lapack
./build_lf.sh
# 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@v4
# 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 }}
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: ["10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20"]
python-version: ["3.10"]
steps:
- uses: actions/checkout@v4
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: |
cd $HOME
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
export WASI_SDK_PATH=$HOME/wasi-sdk-21.0
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: |
cd $HOME
curl -o emsdk.tar.gz -L https://github.com/emscripten-core/emsdk/archive/refs/tags/3.1.59.tar.gz
tar -xvf emsdk.tar.gz
export EMSDK_PATH=$HOME/emsdk-3.1.59
echo $EMSDK_PATH
cd $EMSDK_PATH
./emsdk install latest
./emsdk activate latest
- 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/wasi-sdk-21.0
export EMSDK_PATH=$HOME/emsdk-3.1.59
./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/wasi-sdk-21.0
export EMSDK_PATH=$HOME/emsdk-3.1.59
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 10-16
if: ${{(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
- name: Test Linux LLVM 17-20
if: ${{(contains(matrix.llvm-version, '17') || contains(matrix.llvm-version, '18') || contains(matrix.llvm-version, '19') || contains(matrix.llvm-version, '20'))}}
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
- name: Test third party codes
shell: bash -e -x -l {0}
run: |
export PATH="$(pwd)/src/bin:$PATH"
RUNNER_OS="${{matrix.os}}" FC=lfortran ci/test_third_party_codes.sh
lfortran_debug_build_backends_tarball_cpp_build_wasm_gfortran:
name: Test GFortran, Debug Build, Fortran, OpenMP, C/C++ backend, Upload Tarball, CPP Build, WASM
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: mamba-org/[email protected]
with:
micromamba-version: '2.0.4-0'
environment-file: ci/environment_linux.yml
create-args: >-
llvm-openmp
nodejs=18.20.4
python=3.10
- uses: hendrikmuhs/ccache-action@main
with:
variant: sccache
key: ${{ github.job }}-${{ matrix.os }}
- name: Test integration_tests with GFortran
shell: bash -e -l {0}
run: |
cd integration_tests
./run_tests.py -b gfortran
- name: Build Linux
shell: bash -e -l {0}
run: |
./build0.sh
export CXXFLAGS="-Werror"
export CFLAGS="-Werror"
cmake . -GNinja \
-DCMAKE_BUILD_TYPE=Debug \
-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_C_COMPILER_LAUNCHER=sccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache
cmake --build . -j16 --target install
- name: Test Debug Build 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 OpenMP
shell: bash -e -l {0}
run: |
cd integration_tests
./run_tests.py -b llvm_omp
- name: Test Fortran Backend
shell: bash -e -l {0}
run: |
cd integration_tests
./run_tests.py -b fortran -j1
./run_tests.py -b fortran -f -j1
- name: Test C/C++ Backend
shell: bash -e -l {0}
run: |
mkdir build-kokkos
cd build-kokkos
wget https://github.com/kokkos/kokkos/archive/3.1.01.tar.gz
tar xaf 3.1.01.tar.gz
cd kokkos-3.1.01
mkdir build
cd build
export LFORTRAN_KOKKOS_DIR=$HOME/ext/kokkos
cmake -DCMAKE_INSTALL_PREFIX=$LFORTRAN_KOKKOS_DIR -DKokkos_ENABLE_OPENMP=On -DKokkos_ARCH_HSW=On ..
make
make install
cd ../../..
cd integration_tests
./run_tests.py -b cpp c c_nopragma
./run_tests.py -b cpp c c_nopragma -f
- name: Test CPP
shell: bash -e -l {0}
run: |
xonsh ci/test_cpp_version.xsh
- name: Show Node Info
shell: bash -e -l {0}
run: |
set -ex
which node
node --version
- name: Test WASM backend
shell: bash -e -l {0}
run: |
cd integration_tests
./run_tests.py -b wasm
./run_tests.py -b wasm -f
upload_tarball:
name: Upload Tarball
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
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
steps:
- uses: actions/checkout@v4
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: |
xonsh ci/test_without_llvm_backend.xsh
test_mlir:
name: Test MLIR backend
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
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
steps:
- uses: actions/checkout@v4
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
permissions:
contents: read
packages: write
env:
REGISTRY: ghcr.io
USER: lfortran
PROJECT: lfortran
steps:
- uses: actions/checkout@v4
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