Skip to content

CI

CI #2969

Workflow file for this run

---
name: CI
on:
push:
branches:
- development
- stable
pull_request:
schedule:
- cron: 0 0 * * 0 # weekly
jobs:
build-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install build dependencies
uses: ./.github/actions/install-build-dependencies
- name: Build Python wheel
run: make bdist_wheel bdist_wheel-linux-rename
env:
CC: clang
CXX: clang++
BAZEL_OPTS: --batch
BAZEL_FETCH_OPTS: --config=ci
BAZEL_BUILD_OPTS: --config=ci
- name: Upload Python wheel
uses: actions/upload-artifact@v3
with:
name: linux-wheel
path: dist/*.whl
if-no-files-found: error
retention-days: 7
build-linux-cmake:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install build dependencies
uses: ./.github/actions/install-cmake-build-dependencies
- name: Download LLVM 10.0.0 release
run: |
if [ "$(uname)" = "Darwin" ]; then
wget --quiet https://github.com/llvm/llvm-project/releases/download/llvmorg-10.0.0/clang+llvm-10.0.0-x86_64-apple-darwin.tar.xz -O ~/llvm.tar.xz
else
wget --quiet https://github.com/llvm/llvm-project/releases/download/llvmorg-10.0.0/clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz -O ~/llvm.tar.xz
fi
mkdir ~/llvm && tar xf ~/llvm.tar.xz --strip-components 1 -C ~/llvm
rm ~/llvm.tar.xz
echo "Unpacked, testing for expected file:"
test -d ~/llvm/lib/cmake/llvm
- name: CMake Build
run: |
cmake \
-GNinja \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DCOMPILER_GYM_LLVM_PROVIDER=external \
-DLLVM_DIR=$HOME/llvm/lib/cmake/llvm \
-DPython3_FIND_UNVERSIONED_NAMES=FIRST \
-DCOMPILER_GYM_BUILD_TESTS=ON \
-DCOMPILER_GYM_BUILD_EXAMPLES=ON \
-S . \
-B ~/cmake_build
cmake --build ~/cmake_build
shell: bash
- name: Upload Python wheel
uses: actions/upload-artifact@v3
with:
name: linux-wheel-cmake
path: ~/cmake_build/py_pkg/dist/*.whl
if-no-files-found: error
retention-days: 7
- name: Upload compute_programl binary
uses: actions/upload-artifact@v3
with:
name: linux-compute-programl-cmake
path: compiler_gym/third_party/programl/compute_programl
if-no-files-found: error
retention-days: 7
- name: Upload loop_unroller binary
uses: actions/upload-artifact@v3
with:
name: linux-loop-unroller-cmake
path: examples/example_unrolling_service/loop_unroller/loop_unroller
if-no-files-found: error
retention-days: 7
- name: Upload opt_loops binary
uses: actions/upload-artifact@v3
with:
name: linux-opt-loops-cmake
path: examples/loop_optimizations_service/opt_loops/opt_loops
if-no-files-found: error
retention-days: 7
build-mlir-env-linux-cmake:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install build dependencies
uses: ./.github/actions/install-cmake-build-dependencies
- name: Download LLVM 14.0.0 release
run: |
if [ "$(uname)" = "Darwin" ]; then
wget --quiet https://github.com/llvm/llvm-project/releases/download/llvmorg-14.0.0/clang+llvm-14.0.0-x86_64-apple-darwin.tar.xz -O ~/llvm.tar.xz
else
wget --quiet https://github.com/llvm/llvm-project/releases/download/llvmorg-14.0.0/clang+llvm-14.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz -O ~/llvm.tar.xz
fi
mkdir ~/llvm && tar xf ~/llvm.tar.xz --strip-components 1 -C ~/llvm
rm ~/llvm.tar.xz
echo "Unpacked, testing for expected file:"
test -d ~/llvm/lib/cmake/llvm
- name: CMake Build
run: |
cmake \
-GNinja \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DCOMPILER_GYM_LLVM_PROVIDER=external \
-DLLVM_DIR=$HOME/llvm/lib/cmake/llvm \
-DMLIR_DIR=$HOME/llvm/lib/cmake/mlir \
-DClang_DIR=$HOME/llvm/lib/cmake/clang \
-DPython3_FIND_UNVERSIONED_NAMES=FIRST \
-DCOMPILER_GYM_ENABLE_MLIR_ENV=ON \
-DCOMPILER_GYM_ENABLE_LLVM_ENV=OFF \
-DCOMPILER_GYM_BUILD_TESTS=ON \
-DCOMPILER_GYM_BUILD_EXAMPLES=ON \
-S . \
-B ~/cmake_build
cmake --build ~/cmake_build
shell: bash
- name: Upload Python wheel
uses: actions/upload-artifact@v3
with:
name: mlir-env-linux-wheel-cmake
path: ~/cmake_build/py_pkg/dist/*.whl
if-no-files-found: error
retention-days: 7
build-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install build dependencies
uses: ./.github/actions/install-build-dependencies
- name: Build Python wheel
run: make bdist_wheel
env:
BAZEL_OPTS: --batch
BAZEL_FETCH_OPTS: --config=ci
BAZEL_BUILD_OPTS: --config=ci
- name: Upload Python wheel
uses: actions/upload-artifact@v3
with:
name: macos-wheel
path: dist/*.whl
if-no-files-found: error
retention-days: 7
test-linux:
needs: build-linux
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python: [3.7, 3.8, 3.9, '3.10']
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Download Python wheel
uses: actions/download-artifact@v3
with:
name: linux-wheel
- name: Install wheel
run: python -m pip install *.whl
- name: Install runtime dependencies
uses: ./.github/actions/install-runtime-dependencies
- name: Install test dependencies
run: python -m pip install -r tests/requirements.txt
- name: Run the test suite
run: |
make test-cov \
PYTEST_ARGS="--ignore tests/llvm --ignore tests/gcc --ignore tests/loop_tool"
- name: Upload coverage report to Codecov
uses: codecov/codecov-action@v2
test-linux-cmake:
needs: build-linux-cmake
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python: ['3.10']
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Download Python wheel
uses: actions/download-artifact@v3
with:
name: linux-wheel-cmake
- name: Install wheel
run: python -m pip install *.whl
- name: Install runtime dependencies
uses: ./.github/actions/install-runtime-dependencies
- name: Install test dependencies
run: python -m pip install -r tests/requirements.txt
- name: Download compute_programl
uses: actions/download-artifact@v3
with:
name: linux-compute-programl-cmake
- name: Download loop_unroller
uses: actions/download-artifact@v3
with:
name: linux-loop-unroller-cmake
- name: Download opt_loops
uses: actions/download-artifact@v3
with:
name: linux-opt-loops-cmake
- name: Move examples and utility binaries
run: |
chmod +x compute_programl
chmod +x loop_unroller
chmod +x opt_loops
mv compute_programl ./compiler_gym/third_party/programl/compute_programl
mv loop_unroller ./examples/example_unrolling_service/loop_unroller/loop_unroller
mv opt_loops ./examples/loop_optimizations_service/opt_loops/opt_loops
test ./compiler_gym/third_party/programl/compute_programl
test ./examples/example_unrolling_service/loop_unroller/loop_unroller
test ./examples/loop_optimizations_service/opt_loops/opt_loops
shell: bash
- name: Run the test suite
run: make test CI=1 PYTEST_ARGS="--ignore tests/mlir"
test-mlir-env-linux-cmake:
needs: build-mlir-env-linux-cmake
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python: [3.7, 3.8, 3.9, '3.10']
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Download Python wheel
uses: actions/download-artifact@v3
with:
name: mlir-env-linux-wheel-cmake
- name: Install wheel
run: python -m pip install *.whl
- name: Install runtime dependencies
uses: ./.github/actions/install-mlir-env-runtime-dependencies
- name: Install test dependencies
run: python -m pip install -r tests/requirements.txt
- name: Run the test suite
run: make test-cov CI=1 TEST_TARGET="tests/mlir"
test-macos:
needs: build-macos
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
python: [3.8, 3.9, '3.10']
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Download Python wheel
uses: actions/download-artifact@v3
with:
name: macos-wheel
- name: Install wheel
run: python -m pip install *.whl
- name: Install runtime dependencies
uses: ./.github/actions/install-runtime-dependencies
- name: Install test dependencies
run: python -m pip install -r tests/requirements.txt
- name: Run the test suite
run: |
make test-cov \
CI=1 \
PYTEST_ARGS="--ignore tests/llvm --ignore tests/gcc --ignore tests/loop_tool"
- name: Upload coverage report to Codecov
uses: codecov/codecov-action@v2
test-llvm-env-linux:
needs: build-linux
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python: [3.7, 3.8, 3.9, '3.10']
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Download Python wheel
uses: actions/download-artifact@v3
with:
name: linux-wheel
- name: Install wheel
run: python -m pip install *.whl
- name: Install runtime dependencies
uses: ./.github/actions/install-runtime-dependencies
- name: Install test dependencies
run: python -m pip install -r tests/requirements.txt
- name: Run the test suite
run: make test-cov CI=1 TEST_TARGET="tests/llvm"
- name: Upload coverage report to Codecov
uses: codecov/codecov-action@v2
test-llvm-env-macos:
needs: build-macos
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
python: ['3.10']
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Download Python wheel
uses: actions/download-artifact@v3
with:
name: macos-wheel
- name: Install wheel
run: python -m pip install *.whl
- name: Install runtime dependencies
uses: ./.github/actions/install-runtime-dependencies
- name: Install test dependencies
run: python -m pip install -r tests/requirements.txt
- name: Run the test suite
run: make test-cov CI=1 TEST_TARGET="tests/llvm"
- name: Upload coverage report to Codecov
uses: codecov/codecov-action@v2
test-gcc-env-linux:
needs: build-linux
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python: ['3.10']
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Download Python wheel
uses: actions/download-artifact@v3
with:
name: linux-wheel
- name: Install wheel
run: python -m pip install *.whl
- name: Install runtime dependencies
uses: ./.github/actions/install-runtime-dependencies
- name: Install test dependencies
run: python -m pip install -r tests/requirements.txt
- name: Run the test suite
run: make test-cov CI=1 TEST_TARGET="tests/gcc"
- name: Upload coverage report to Codecov
uses: codecov/codecov-action@v2
test-gcc-env-linux-no-docker:
needs: build-linux
runs-on: ubuntu-latest
steps:
- name: Stop docker
run: |
docker ps -q | xargs --no-run-if-empty sudo docker kill
sudo systemctl stop docker
sudo apt-get remove -y docker docker-engine docker.io containerd runc
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- uses: actions/checkout@v3
- name: Download Python wheel
uses: actions/download-artifact@v3
with:
name: linux-wheel
- name: Install wheel
run: python -m pip install *.whl
- name: Install runtime dependencies
uses: ./.github/actions/install-runtime-dependencies
- name: Install test dependencies
run: python -m pip install -r tests/requirements.txt
- name: Run the test suite
run: make test-cov CI=1 TEST_TARGET="tests/gcc"
- name: Upload coverage report to Codecov
uses: codecov/codecov-action@v2
test-gcc-env-macos:
needs: build-macos
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Download Python wheel
uses: actions/download-artifact@v3
with:
name: macos-wheel
- name: Install wheel
run: python -m pip install *.whl
- name: Install runtime dependencies
uses: ./.github/actions/install-runtime-dependencies
- name: Install test dependencies
run: python -m pip install -r tests/requirements.txt
- name: Run the test suite
run: make test-cov CI=1 TEST_TARGET="tests/gcc"
- name: Upload coverage report to Codecov
uses: codecov/codecov-action@v2
test-loop_tool-env-linux:
needs: build-linux
runs-on: ubuntu-latest
steps:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- uses: actions/checkout@v3
- name: Download Python wheel
uses: actions/download-artifact@v3
with:
name: linux-wheel
- name: Install wheel
run: python -m pip install *.whl
- name: Install runtime dependencies
uses: ./.github/actions/install-runtime-dependencies
- name: Install test dependencies
run: python -m pip install -r tests/requirements.txt
- name: Run the test suite
run: make test-cov CI=1 TEST_TARGET="tests/loop_tool"
- name: Upload coverage report to Codecov
uses: codecov/codecov-action@v2
test-loop_tool-env-macos:
needs: build-macos
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Download Python wheel
uses: actions/download-artifact@v3
with:
name: macos-wheel
- name: Install wheel
run: python -m pip install *.whl
- name: Install runtime dependencies
uses: ./.github/actions/install-runtime-dependencies
- name: Install test dependencies
run: python -m pip install -r tests/requirements.txt
- name: Run the test suite
run: make test-cov CI=1 TEST_TARGET="tests/loop_tool"
- name: Upload coverage report to Codecov
uses: codecov/codecov-action@v2
test-examples-linux:
needs: build-linux
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python: [3.7, 3.8, 3.9, '3.10']
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Download Python wheel
uses: actions/download-artifact@v3
with:
name: linux-wheel
- name: Install wheel
run: python -m pip install *.whl
- name: Install runtime dependencies
uses: ./.github/actions/install-runtime-dependencies
- name: Install test dependencies
run: make -C examples install
- name: Run the test suite
run: make -C examples test PYTEST_ARGS="--ignore example_unrolling_service --ignore loop_optimizations_service"
- name: Upload coverage report to Codecov
uses: codecov/codecov-action@v2
test-examples-macos:
needs: build-macos
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
python: ['3.10']
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Download Python wheel
uses: actions/download-artifact@v3
with:
name: macos-wheel
- name: Install wheel
run: python -m pip install *.whl
- name: Install runtime dependencies
uses: ./.github/actions/install-runtime-dependencies
- name: Install test dependencies
run: make -C examples install
- name: Run the test suite
run: make -C examples test PYTEST_ARGS="--ignore example_unrolling_service --ignore loop_optimizations_service"
- name: Upload coverage report to Codecov
uses: codecov/codecov-action@v2
build-asan-llvm-service:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install build dependencies
uses: ./.github/actions/install-build-dependencies
- name: Build address sanitized LLVM compiler service
run: |
make bazel-build BAZEL_BUILD_OPTS=--config=asan BUILD_TARGET=//compiler_gym/envs/llvm/service:compiler_gym-llvm-service
tar -C bazel-bin/compiler_gym/envs/llvm/service -cjvf compiler_gym-llvm-service.tar.bz2 compiler_gym-llvm-service
env:
CC: clang
CXX: clang++
BAZEL_OPTS: --batch
BAZEL_FETCH_OPTS: --config=ci
BAZEL_BUILD_OPTS: --config=ci
- name: Upload address sanitized LLVM compiler service
uses: actions/upload-artifact@v3
with:
name: compiler_gym-llvm-service-linux-asan-build
path: compiler_gym-llvm-service.tar.bz2
if-no-files-found: error
retention-days: 7
test-llvm-env-asan-linux:
runs-on: ubuntu-latest
needs: [build-linux, build-asan-llvm-service]
steps:
- uses: actions/checkout@v3
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Download Python wheel
uses: actions/download-artifact@v3
with:
name: linux-wheel
- name: Download address sanitized LLVM compiler service
uses: actions/download-artifact@v3
with:
name: compiler_gym-llvm-service-linux-asan-build
- name: Repack wheel
run: |
tar xjvf compiler_gym-llvm-service.tar.bz2
rm compiler_gym-llvm-service.tar.bz2
chmod +x compiler_gym-llvm-service
python -m pip install -U wheel
wheel unpack *.whl
rm *.whl
chmod +x compiler_gym-*/compiler_gym-*.data/purelib/compiler_gym/third_party/csmith/csmith/bin/csmith
chmod +x compiler_gym-*/compiler_gym-*.data/purelib/compiler_gym/envs/llvm/service/compute_observation
chmod +x compiler_gym-*/compiler_gym-*.data/purelib/compiler_gym/envs/llvm/service/llvm-extract-one
mv compiler_gym-llvm-service compiler_gym-*/compiler_gym-*.data/purelib/compiler_gym/envs/llvm/service/compiler_gym-llvm-service
wheel pack compiler_gym-*
- name: Install wheel
run: python -m pip install *.whl
- name: Install runtime dependencies
uses: ./.github/actions/install-runtime-dependencies
- name: Install test dependencies
run: python -m pip install -r tests/requirements.txt
- name: Test
run: make test CI=1 TEST_TARGET=tests/llvm
env:
ASAN_OPTIONS: detect_leaks=1
CC: clang
CXX: clang++
www-build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
node: [17]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: npm
cache-dependency-path: www/frontends/compiler_gym/package-lock.json
- name: Build web frontend
run: make www-build