Skip to content

Merge pull request #1755 from Smit-create/i-1681 #1

Merge pull request #1755 from Smit-create/i-1681

Merge pull request #1755 from Smit-create/i-1681 #1

Workflow file for this run

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 -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 -l {0}
run: conda install bison=3.4
- name: Conda info
shell: bash -l {0}
run: |
conda info
conda list
- name: Setup Platform (Linux)
if: contains(matrix.os, 'ubuntu')
shell: bash -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 -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 -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 -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@v2
with:
fetch-depth: 0
- uses: mamba-org/provision-with-micromamba@main
with:
environment-file: ci/environment.yml
extra-specs: |
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
./build0.sh
./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 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/provision-with-micromamba@v15
with:
environment-file: ci/environment.yml
extra-specs: |
bison=3.4
- uses: hendrikmuhs/ccache-action@main
with:
variant: sccache
key: ${{ github.job }}-${{ matrix.os }}
- name: Setup Platform (Linux)
shell: bash -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: Build Linux
shell: bash -l {0}
run: |
xonsh ci/build.xsh
- name: PIP show version
shell: bash -l {0}
run: |
python -m pip -V
- name: PIP install required packages
shell: bash -l {0}
run: |
python -m pip install lpynn numpy
- name: PIP show installed packages
shell: bash -l {0}
run: |
python -m pip list
- name: Test PIP Packages with Python
shell: bash -l {0}
run: |
export PYTHONPATH=./src/runtime/lpython
python integration_tests/test_pip_import_01.py
- name: Test PIP Packages with LPython
shell: bash -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