Implement str.replace()
and str.index()
#6180
Workflow file for this run
This file contains 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: LPython CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
env: | |
MACOSX_DEPLOYMENT_TARGET: 12.0 | |
jobs: | |
Build: | |
name: LPython CI (${{ matrix.python-version }}, ${{ matrix.os }}) | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: ["ubuntu-latest", "macos-latest", "windows-2019"] | |
python-version: ["3.10"] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Cache conda | |
uses: actions/cache@v3 | |
env: | |
CACHE_NUMBER: 0 | |
with: | |
path: ~/conda_pkgs_dir | |
key: | |
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('ci/environment.yml') }} | |
- uses: conda-incubator/setup-miniconda@v2 | |
with: | |
auto-update-conda: true | |
environment-file: ci/environment.yml | |
python-version: ${{ matrix.python-version }} | |
use-only-tar-bz2: true | |
- name: Install Windows Conda Packages | |
if: contains(matrix.os, 'windows') | |
shell: bash -e -l {0} | |
run: conda install m2-bison=3.0.4 | |
- name: Install Linux / macOS Conda Packages | |
if: contains(matrix.os, 'ubuntu') || contains(matrix.os, 'macos') | |
shell: bash -e -l {0} | |
run: conda install bison=3.4 | |
- name: Conda info | |
shell: bash -e -l {0} | |
run: | | |
conda info | |
conda list | |
- name: Setup Platform (Linux) | |
if: contains(matrix.os, 'ubuntu') | |
shell: bash -e -l {0} | |
run: | | |
echo "LFORTRAN_CMAKE_GENERATOR=Unix Makefiles" >> $GITHUB_ENV | |
echo "WIN=0" >> $GITHUB_ENV | |
echo "MACOS=0" >> $GITHUB_ENV | |
echo "ENABLE_RUNTIME_STACKTRACE=yes" >> $GITHUB_ENV | |
- name: Setup Platform (macOS) | |
if: contains(matrix.os, 'macos') | |
shell: bash -e -l {0} | |
run: | | |
echo "LFORTRAN_CMAKE_GENERATOR=Unix Makefiles" >> $GITHUB_ENV | |
echo "WIN=0" >> $GITHUB_ENV | |
echo "MACOS=1" >> $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: | | |
xonsh ci/build.xsh | |
- name: Build (Windows) | |
if: contains(matrix.os, 'windows') | |
shell: cmd | |
run: | | |
set CONDA_INSTALL_LOCN=C:\\Miniconda | |
call %CONDA_INSTALL_LOCN%\Scripts\activate.bat | |
call conda activate test | |
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.xsh | |
- name: Test (Linux / macOS) | |
shell: bash -e -l {0} | |
if: contains(matrix.os, 'ubuntu') || contains(matrix.os, 'macos') | |
run: | | |
xonsh ci/test.xsh | |
- name: Test (Windows) | |
if: contains(matrix.os, 'windows') | |
shell: cmd | |
run: | | |
set CONDA_INSTALL_LOCN=C:\\Miniconda | |
call %CONDA_INSTALL_LOCN%\Scripts\activate.bat | |
call conda activate test | |
set LFORTRAN_CMAKE_GENERATOR=Ninja | |
set WIN=1 | |
set MACOS=0 | |
call "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat" | |
xonsh ci\test.xsh | |
build_to_wasm: | |
name: Build LPython to WASM | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: mamba-org/setup-micromamba@v1 | |
with: | |
environment-file: ci/environment.yml | |
create-args: >- | |
python=3.10 | |
bison=3.4 | |
- uses: hendrikmuhs/ccache-action@main | |
with: | |
variant: sccache | |
key: ${{ github.job }}-${{ matrix.os }} | |
- name : Remove existing node | |
shell: bash -l {0} | |
run : | | |
which node | |
node -v | |
sudo rm -rf /usr/local/bin/node /usr/local/bin/npm | |
- name: Install Emscripten from Git | |
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-14.18.2-64bit | |
./emsdk activate node-14.18.2-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 lpython.wasm | |
shell: bash -l {0} | |
run: | | |
set -ex | |
source $HOME/ext/emsdk/emsdk_env.sh # Activate Emscripten | |
which node | |
node -v | |
node --experimental-wasm-bigint src/lpython/tests/test_lpython.js | |
test_pip_pkgs: | |
name: Test PIP Installable Packages | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: mamba-org/setup-micromamba@v1 | |
with: | |
environment-file: ci/environment.yml | |
create-args: >- | |
python=3.10 | |
bison=3.4 | |
- 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 \ | |
-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: PIP show version | |
shell: bash -e -l {0} | |
run: | | |
python -m pip -V | |
- name: PIP install required packages | |
shell: bash -e -l {0} | |
run: | | |
# Package lpynn has lpython_emulation as dependency | |
# Hence, it should by default install lpython_emulation | |
python -m pip install lpython_emulation==0.0.1.9 lpynn==0.0.1.4 numpy==1.24.3 | |
- name: PIP show installed packages | |
shell: bash -e -l {0} | |
run: | | |
python -m pip list | |
- name: Test PIP Packages with Python | |
shell: bash -e -l {0} | |
run: | | |
python integration_tests/test_pip_import_01.py | |
- name: Test PIP Packages with LPython | |
shell: bash -e -l {0} | |
run: | | |
pip_pkg_path=$(python -c "import site; print(site.getsitepackages()[0])") | |
echo $pip_pkg_path | |
./src/bin/lpython integration_tests/test_pip_import_01.py -I $pip_pkg_path | |
debug: | |
name: Check Debug build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: mamba-org/setup-micromamba@v1 | |
with: | |
environment-file: ci/environment.yml | |
create-args: >- | |
python=3.10 | |
bison=3.4 | |
- 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" | |
cmake . -GNinja \ | |
-DCMAKE_BUILD_TYPE=Debug \ | |
-DWITH_LLVM=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 Linux | |
shell: bash -e -l {0} | |
run: | | |
ctest | |
./run_tests.py -s | |
cd integration_tests | |
./run_tests.py -b llvm c | |
./run_tests.py -b llvm c -f | |
release: | |
name: Check Release build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: mamba-org/setup-micromamba@v1 | |
with: | |
environment-file: ci/environment.yml | |
create-args: >- | |
python=3.10 | |
bison=3.4 | |
- 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" | |
cmake . -GNinja \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DCMAKE_CXX_FLAGS_RELEASE="-Wall -Wextra -O3 -funroll-loops -DNDEBUG" \ | |
-DWITH_LLVM=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 Linux | |
shell: bash -e -l {0} | |
run: | | |
ctest --rerun-failed --output-on-failure | |
./run_tests.py -s | |
cd integration_tests | |
./run_tests.py -b llvm c | |
./run_tests.py -b llvm c -f | |
cpython_interop: | |
name: Test CPython Interop (@pythoncall) | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: mamba-org/setup-micromamba@v1 | |
with: | |
environment-file: ci/environment.yml | |
create-args: >- | |
python=3.10 | |
bison=3.4 | |
- 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 \ | |
-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 Linux | |
shell: bash -e -l {0} | |
run: | | |
cd integration_tests | |
./run_tests.py -b cpython c_py llvm_py | |
./run_tests.py -b cpython c_py llvm_py -f | |
sympy: | |
name: Run SymPy tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: mamba-org/setup-micromamba@v1 | |
with: | |
environment-file: ci/environment.yml | |
create-args: >- | |
python=3.10 | |
bison=3.4 | |
symengine=0.11.1 | |
sympy=1.11.1 | |
- uses: hendrikmuhs/ccache-action@main | |
with: | |
key: ${{ github.job }}-${{ matrix.os }} | |
- name: Build | |
shell: bash -e -l {0} | |
run: | | |
./build0.sh | |
cmake . -G"Unix Makefiles" \ | |
-DCMAKE_BUILD_TYPE=Debug \ | |
-DWITH_LLVM=yes \ | |
-DLPYTHON_BUILD_ALL=yes \ | |
-DWITH_STACKTRACE=no \ | |
-DWITH_RUNTIME_STACKTRACE=no \ | |
-DCMAKE_PREFIX_PATH="$CONDA_PREFIX" \ | |
-DCMAKE_INSTALL_PREFIX=`pwd`/inst \ | |
-DCMAKE_C_COMPILER_LAUNCHER=ccache \ | |
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache | |
cmake --build . -j16 --target install | |
- name: Test | |
shell: bash -e -l {0} | |
run: | | |
cd integration_tests | |
./run_tests.py -b c_sym cpython_sym llvm_sym | |
./run_tests.py -b c_sym cpython_sym llvm_sym -f | |
integration_tests_cpython: | |
name: Run Integration tests with Python ${{ matrix.python-version }} | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: mamba-org/setup-micromamba@v1 | |
with: | |
environment-name: lp | |
condarc: | | |
channels: | |
- conda-forge | |
create-args: >- | |
llvmdev=11.1.0 | |
bison=3.4 | |
re2c | |
zlib | |
cmake | |
make | |
python=${{ matrix.python-version }} | |
numpy | |
- uses: hendrikmuhs/ccache-action@main | |
with: | |
key: ${{ github.job }}-${{ matrix.python-version }} | |
- name: Show Python Info | |
shell: bash -e -l {0} | |
run: | | |
which python | |
python -m pip -V | |
python -m pip list | |
python --version | |
- name: Build | |
shell: bash -e -l {0} | |
run: | | |
./build0.sh | |
cmake . -G"Unix Makefiles" \ | |
-DCMAKE_BUILD_TYPE=Debug \ | |
-DWITH_LLVM=yes \ | |
-DLPYTHON_BUILD_ALL=yes \ | |
-DWITH_STACKTRACE=no \ | |
-DWITH_RUNTIME_STACKTRACE=no \ | |
-DCMAKE_PREFIX_PATH="$CONDA_PREFIX" \ | |
-DCMAKE_INSTALL_PREFIX=`pwd`/inst \ | |
-DCMAKE_C_COMPILER_LAUNCHER=ccache \ | |
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache | |
cmake --build . -j16 --target install | |
- name: Test | |
shell: bash -e -l {0} | |
run: | | |
cd integration_tests | |
./run_tests.py -b cpython c_py |