Skip to content

Commit

Permalink
Makefile changes
Browse files Browse the repository at this point in the history
Signed-off-by: Govind Kamat <govkamat@amazon.com>
  • Loading branch information
gkamat committed Aug 27, 2024
1 parent 630a8c0 commit bea3c90
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 95 deletions.
26 changes: 7 additions & 19 deletions .ci/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@ pyenv_init() {
PATH=$HOME/.pyenv/shims:$PATH:$HOME/.pyenv/bin
}

function build {
function setup_logging {
export THESPLOG_FILE="${THESPLOG_FILE:-${BENCHMARK_HOME}/.benchmark/logs/actor-system-internal.log}"
# this value is in bytes, the default is 50kB. We increase it to 200kiB.
export THESPLOG_FILE_MAXSIZE=${THESPLOG_FILE_MAXSIZE:-204800}
# adjust the default log level from WARNING
export THESPLOG_THRESHOLD="INFO"
}

function build {
setup_logging

pyenv_init
export TERM=dumb
Expand All @@ -22,33 +26,17 @@ function build {
}

function build_it {
export THESPLOG_FILE="${THESPLOG_FILE:-${BENCHMARK_HOME}/.benchmark/logs/actor-system-internal.log}"
# this value is in bytes, the default is 50kB. We increase it to 200kiB.
export THESPLOG_FILE_MAXSIZE=${THESPLOG_FILE_MAXSIZE:-204800}
# adjust the default log level from WARNING
export THESPLOG_THRESHOLD="INFO"
setup_logging

pyenv_init
export TERM=dumb
export LC_ALL=en_US.UTF-8
export BENCHMARK_HOME="$GITHUB_WORKSPACE"

python3_version=`python3 --version`
echo "Python3 version is ... $python3_version"

./pyinst
make xinst
make prereq
docker pull ubuntu/squid:latest

# make it38, it39, etc.
set -x
echo ================== $1

PATH=$HOME/.pyenv/versions/3.9.10/bin:$PATH
echo $PATH
opensearch-benchmark --version
ls -l $HOME/.pyenv/shims

make "it${1//./}"
}

Expand Down
41 changes: 10 additions & 31 deletions .github/workflows/manual-integ.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
name: Integ Actions
name: Run Integration Tests
on: [workflow_dispatch, pull_request]
jobs:
Integration-Tests:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v4

- uses: KengoTODA/actions-setup-docker-compose@v1
with:
version: '1.29.2'

# - name: Enforce docker-compose v1
# run: |
# echo "GitHub starts to switch runners to include docker-compose v2"
Expand All @@ -18,44 +20,21 @@ jobs:
# sudo pip install docker-compose==1.29.2
# docker --version
# docker-compose --version

- name: Check out repository code
uses: actions/checkout@v2
- name: Clone pyenv

- name: Install pyenv
run: git clone https://github.com/pyenv/pyenv.git ~/.pyenv
- name: Clone pyenv-virtualenv
run: git clone https://github.com/pyenv/pyenv-virtualenv.git ~/.pyenv/plugins/pyenv-virtualenv
- name: Install JDK 8
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '8'
- run: echo "JAVA8_HOME=$JAVA_HOME" >> $GITHUB_ENV
- name: Install JDK 11
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11'
- run: echo "JAVA11_HOME=$JAVA_HOME" >> $GITHUB_ENV
- name: Install JDK 15
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '15'
- run: echo "JAVA15_HOME=$JAVA_HOME" >> $GITHUB_ENV
- name: Install JDK 16
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '16'
- run: echo "JAVA16_HOME=$JAVA_HOME" >> $GITHUB_ENV

- name: Install JDK 17
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '17'
- run: echo "JAVA17_HOME=$JAVA_HOME" >> $GITHUB_ENV
- name: Run the CI build_it script
# run: bash .ci/build.sh build_it ${{ matrix.python-version }}
run: bash .ci/build.sh build_it 3.9

- name: Run the CI build script
run: bash .ci/build.sh build_it ${{ matrix.python-version }}
env:
BENCHMARK_HOME: env.GITHUB_WORKSPACE
60 changes: 15 additions & 45 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,13 @@
# under the License.

SHELL = /bin/bash
PY_BIN = python3
PY_PREFIX = python
# https://github.com/pypa/pip/issues/5599
PIP_WRAPPER = $(PY_BIN) -m pip
export PY38 = $(shell jq -r '.python_versions.PY38' .ci/variables.json)
export PY38_BIN = $(PY_PREFIX)$(shell cut -d '.' -f 1,2 <<< $(PY38))
export PY39 = $(shell jq -r '.python_versions.PY39' .ci/variables.json)
export PY39_BIN = $(PY_PREFIX)$(shell cut -d '.' -f 1,2 <<< $(PY39))
export PY310 = $(shell jq -r '.python_versions.PY310' .ci/variables.json)
export PY310_BIN = $(PY_PREFIX)$(shell cut -d '.' -f 1,2 <<< $(PY310))
export PY311 = $(shell jq -r '.python_versions.PY311' .ci/variables.json)
export PY311_BIN = $(PY_PREFIX)$(shell cut -d '.' -f 1,2 <<< $(PY311))
export VERSIONS = $(shell jq -r '.python_versions | .[]' .ci/variables.json | sed '$d')

PIP = pip3
VERSIONS = $(shell jq -r '.python_versions | .[]' .ci/variables.json | sed '$$d')
PYENV_ERROR = "\033[0;31mIMPORTANT\033[0m: Please install pyenv.\n"
PYENV_PREREQ_HELP = "\033[0;31mIMPORTANT\033[0m: If you haven't already, please add \033[0;31meval \"\$$(pyenv init -)\"\033[0m to your bash profile and restart your terminal before proceeding any further.\n"


prereq:
pyenv install --skip-existing $(PY38)
pyenv install --skip-existing $(PY39)
pyenv install --skip-existing $(PY310)
pyenv install --skip-existing $(PY311)
@which pyenv > /dev/null || { printf $(PYENV_ERROR); exit 1; }
@for i in $(VERSIONS); do pyenv install --skip-existing $$i; done
pyenv local $(VERSIONS)

check-java:
Expand All @@ -51,33 +35,25 @@ check-java:
fi

install-deps:
$(PIP_WRAPPER) install --upgrade pip setuptools wheel
$(PIP) install --upgrade pip setuptools wheel

install-user: install-deps
PIP_ONLY_BINARY=h5py $(PIP_WRAPPER) install -e .
pyenv rehash
PIP_ONLY_BINARY=h5py $(PIP) install -e .

install-devel: install-deps
PIP_ONLY_BINARY=h5py $(PIP_WRAPPER) install -e .[develop]
pyenv rehash
PIP_ONLY_BINARY=h5py $(PIP) install -e .[develop]

wheel:
$(PIP_WRAPPER) install --upgrade pip setuptools wheel
$(PIP_WRAPPER) wheel .
$(PIP) install --upgrade pip setuptools wheel
$(PIP) wheel .

install: wheel
PIP_ONLY_BINARY=h5py $(PIP_WRAPPER) install opensearch_benchmark*.whl
pyenv rehash
PIP_ONLY_BINARY=h5py $(PIP) install opensearch_benchmark*.whl
rm *.whl

clean: nondocs-clean docs-clean

nondocs-clean:
clean:
rm -rf .benchmarks .eggs .tox .benchmark_it .cache build dist osbenchmark.egg-info logs junit-py*.xml *.whl NOTICE.txt

docs-clean:
# cd docs && $(MAKE) clean

# Avoid conflicts between .pyc/pycache related files created by local Python interpreters and other interpreters in Docker
python-caches-clean:
-@find . -name "__pycache__" -prune -exec rm -rf -- \{\} \;
Expand All @@ -92,23 +68,17 @@ tox-env-clean:
lint:
@find osbenchmark benchmarks scripts tests it -name "*.py" -exec pylint -j0 -rn --load-plugins pylint_quotes --rcfile=$(CURDIR)/.pylintrc \{\} +

docs:
@cd docs && $(MAKE) html

serve-docs:
@cd docs && $(MAKE) serve

test:
pytest tests/

precommit: lint

it: check-java python-caches-clean tox-env-clean
@which tox || $(PIP_WRAPPER) install tox && pyenv rehash
@which tox || $(PIP) install tox
tox

it38 it39 it310 it311: check-java python-caches-clean tox-env-clean
@which tox || $(PIP_WRAPPER) install tox && pyenv rehash
@which tox || $(PIP) install tox
tox -e $(@:it%=py%)

benchmark:
Expand All @@ -122,7 +92,7 @@ release-checks:
./release-checks.sh $(release_version) $(next_version)

# usage: e.g. make release release_version=0.9.2 next_version=0.9.3
release: release-checks clean docs it
release: release-checks clean it
./release.sh $(release_version) $(next_version)

.PHONY: install clean nondocs-clean docs-clean python-caches-clean tox-env-clean docs serve-docs test it it38 benchmark coverage release release-checks prereq
.PHONY: install clean python-caches-clean tox-env-clean test it it38 benchmark coverage release release-checks prereq

0 comments on commit bea3c90

Please sign in to comment.