build #3683
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: build | |
on: | |
schedule: | |
- cron: '44 4 * * *' | |
pull_request: | |
branches: | |
- master | |
- develop | |
release: | |
types: | |
[published] | |
workflow_dispatch: | |
jobs: | |
pre-commit: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v3 | |
with: | |
python-version: 3.11 | |
- run: pip install pre-commit | |
- run: pre-commit --version | |
- run: pre-commit install | |
- run: pre-commit run --all-files | |
pretest: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
toxenv: [pylint, doc8, docs] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: 3.9 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install tox tox-gh-actions | |
- name: Run pre-tests with Tox | |
run: tox -e ${{ matrix.toxenv }} | |
test-dashboard-build: | |
needs: pretest | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 16 | |
- name: Compile Dashboard | |
run: | | |
cd dashboard/src | |
yarn | |
yarn build | |
rm -rf ../build | |
mv build .. | |
cd ../../ | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: 3.9 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -e .[test] | |
- name: Get gecko driver | |
run: | | |
wget https://github.com/mozilla/geckodriver/releases/download/v0.31.0/geckodriver-v0.31.0-linux64.tar.gz | |
tar -xvf geckodriver-v0.31.0-linux64.tar.gz | |
- name: Create gunicorn_tmp_dir to match orion_config.yaml | |
run: mkdir -p gunicorn_tmp_dir | |
- name: Launch backend | |
run: orion serve -c .github/workflows/orion/orion_config.yaml & | |
- name: Launch frontend | |
run: orion frontend & | |
- name: Install Firefox | |
uses: browser-actions/setup-firefox@latest | |
- name: Test frontend | |
run: PATH=$PATH:$(pwd) pytest tests/functional/serving/test_frontend.py | |
test: | |
needs: [pre-commit, pretest] | |
runs-on: ${{ matrix.platform }} | |
strategy: | |
max-parallel: 4 | |
matrix: | |
platform: [ubuntu-latest] | |
python-version: [3.8, 3.9, '3.10'] | |
env: | |
PLATFORM: ${{ matrix.platform }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install tox tox-gh-actions | |
- name: Test with tox (and all extra dependencies) | |
run: tox -e py-all -- --color=no | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
file: ./coverage.xml | |
flags: unittests | |
env_vars: PLATFORM,PYTHON | |
name: codecov-umbrella | |
fail_ci_if_error: false | |
test-long-algos: | |
needs: [pre-commit, pretest] | |
runs-on: ${{ matrix.platform }} | |
continue-on-error: true | |
strategy: | |
matrix: | |
platform: [ubuntu-latest] | |
python-version: [3.8, 3.9] | |
algo: [nevergrad, hebo, ax] | |
env: | |
PLATFORM: ${{ matrix.platform }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install tox tox-gh-actions | |
- name: Test long algorithms with tox | |
run: tox -e algo -- tests/unittests/algo/long/${{ matrix.algo }} --color=no | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
file: ./coverage.xml | |
flags: unittests | |
env_vars: PLATFORM,PYTHON | |
name: codecov-umbrella | |
fail_ci_if_error: false | |
test_no_extras: | |
needs: [pre-commit, pretest] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: 3.9 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install tox tox-gh-actions | |
- name: Test with tox | |
run: tox -e py -- --color=no | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
file: ./coverage.xml | |
flags: unittests | |
env_vars: PLATFORM,PYTHON | |
name: codecov-umbrella | |
fail_ci_if_error: false | |
mongodb: | |
needs: [pre-commit, pretest] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: 3.9 | |
- name: Setup MongoDB | |
uses: supercharge/[email protected] | |
with: | |
mongodb-version: 6.0 | |
- name: Install MongoShell | |
run: | | |
wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add - | |
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list | |
sudo apt-get update | |
sudo apt-get install -y mongodb-org | |
- name: Configure MongoDB | |
run: | | |
mongosh orion_test --eval 'db.createUser({user:"user",pwd:"pass",roles:["readWrite"]});' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install tox tox-gh-actions | |
- name: Test with tox | |
run: tox -e mongodb -- --color=no | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
file: ./coverage.xml | |
flags: backward | |
env_vars: PLATFORM,PYTHON | |
name: codecov-umbrella | |
fail_ci_if_error: false | |
backward-compatibility: | |
needs: [pre-commit, pretest] | |
runs-on: ubuntu-latest | |
strategy: | |
max-parallel: 2 | |
matrix: | |
orion_db_type: [mongodb, pickleddb] | |
env: | |
ORION_DB_TYPE: ${{ matrix.orion_db_type }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: 3.9 | |
- name: Setup MongoDB | |
uses: supercharge/[email protected] | |
with: | |
mongodb-version: 6.0 | |
- name: Install MongoShell | |
run: | | |
wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add - | |
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list | |
sudo apt-get update | |
sudo apt-get install -y mongodb-org | |
- name: Configure MongoDB | |
run: | | |
mongosh orion_test --eval 'db.createUser({user:"user",pwd:"pass",roles:["readWrite"]});' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install tox tox-gh-actions | |
- name: Test with tox | |
run: tox -e backward-compatibility -- --color=no | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
file: ./coverage.xml | |
flags: backward | |
env_vars: PLATFORM,PYTHON | |
name: codecov-umbrella | |
fail_ci_if_error: false | |
pypi: | |
needs: [test, backward-compatibility, test-long-algos, mongodb, test_no_extras] # , test-dashboard-build] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: 3.9 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install tox tox-gh-actions | |
- name: Test packaging | |
run: tox -e packaging | |
- name: Build | |
run: tox -e build | |
- name: Test dashboard build deployment on normal install | |
run: | | |
# Get package path | |
export ORION_PACKAGE=$( realpath `find dist/ -type f` ) | |
echo Package path: ${ORION_PACKAGE} | |
# Move to another folder (to prevent any confusion at installation with repo folder) | |
cd ~ | |
echo Normal install | |
pip install ${ORION_PACKAGE} | |
# Get prefix | |
export ORION_PREFIX=$( python -c "import sys; print(sys.prefix);" ) | |
echo Check if dashboard build is installed | |
if ( [ -d "${ORION_PREFIX}/orion-dashboard" ] ); then true; else false; fi | |
if ( [ -f "${ORION_PREFIX}/orion-dashboard/build/index.html" ] ); then true; else false; fi | |
if ( ls ${ORION_PREFIX}/orion-dashboard/build/static/js/main.*.js ); then true; else false; fi | |
echo Check if frontend script can find dashboard build | |
python -c "from orion.core.cli.frontend import get_dashboard_build_path; get_dashboard_build_path();" | |
echo Check if frontend script can find dashboard build on sys.prefix/local | |
mkdir -p ${ORION_PREFIX}/local/ | |
mv ${ORION_PREFIX}/orion-dashboard ${ORION_PREFIX}/local/orion-dashboard | |
if ( [ -d "${ORION_PREFIX}/orion-dashboard" ] ); then false; else true; fi | |
if ( [ -d "${ORION_PREFIX}/local/orion-dashboard" ] ); then true; else false; fi | |
python -c "from orion.core.cli.frontend import get_dashboard_build_path; get_dashboard_build_path();" | |
echo Move build back to initial installation | |
mv ${ORION_PREFIX}/local/orion-dashboard ${ORION_PREFIX}/orion-dashboard | |
if ( [ -d "${ORION_PREFIX}/orion-dashboard" ] ); then true; else false; fi | |
if ( [ -d "${ORION_PREFIX}/local/orion-dashboard" ] ); then false; else true; fi | |
echo Clean-up | |
pip uninstall -y orion | |
echo Check if dashboard build is correctly removed | |
# NB: It seems orion-dashboard build is not deleted, | |
# but it should be empty after uninstall | |
if ( [ -f "${ORION_PREFIX}/orion-dashboard/build/index.html" ] ); then false; fi | |
if ( ls ${ORION_PREFIX}/orion-dashboard/build/static/js/main.*.js ); then false; fi | |
echo End | |
cd - | |
- name: Test dashboard build deployment on user install | |
run: | | |
# Get package path | |
export ORION_PACKAGE=$( realpath `find dist/ -type f` ) | |
echo Package path: ${ORION_PACKAGE} | |
# Move to another folder (to prevent any confusion at installation with repo folder) | |
cd ~ | |
echo User install | |
pip install --user ${ORION_PACKAGE} | |
# Get prefix | |
export ORION_PREFIX=$( python -c "import site; print(site.USER_BASE);" ) | |
echo Check if dashboard build is installed | |
if ( [ -d "${ORION_PREFIX}/orion-dashboard" ] ); then true; else false; fi | |
if ( [ -f "${ORION_PREFIX}/orion-dashboard/build/index.html" ] ); then true; else false; fi | |
if ( ls ${ORION_PREFIX}/orion-dashboard/build/static/js/main.*.js ); then true; else false; fi | |
echo Check if frontend script can find dashboard build | |
python -c "from orion.core.cli.frontend import get_dashboard_build_path; get_dashboard_build_path();" | |
echo Clean-up | |
pip uninstall -y orion | |
echo Check if dashboard build is correctly removed | |
# NB: In user install case, it seems folder orion-dashboard itself is not deleted, | |
# but it should be empty after uninstall | |
if ( [ -f "${ORION_PREFIX}/orion-dashboard/build/index.html" ] ); then false; fi | |
if ( ls ${ORION_PREFIX}/orion-dashboard/build/static/js/main.*.js ); then false; fi | |
echo End | |
cd - | |
- name: Publish distribution 📦 to Test PyPI | |
if: startsWith(github.ref, 'refs/tags') | |
uses: pypa/gh-action-pypi-publish@master | |
with: | |
user: __token__ | |
password: ${{ secrets.test_pypi_password }} | |
repository_url: https://test.pypi.org/legacy/ | |
- name: Publish distribution 📦 to PyPI | |
if: startsWith(github.ref, 'refs/tags') | |
uses: pypa/gh-action-pypi-publish@master | |
with: | |
user: __token__ | |
password: ${{ secrets.pypi_password }} | |
conda: | |
needs: [test, backward-compatibility, test-long-algos] #, test-dashboard-build] | |
runs-on: ubuntu-latest | |
env: | |
ANACONDA_TOKEN: ${{ secrets.anaconda_token }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: 3.9 | |
- name: Build conda | |
run: ./conda/ci_build.sh | |
- name: Publish distribution 📦 to Conda | |
if: startsWith(github.ref, 'refs/tags') | |
run: ./conda/upload.sh |