Skip to content

Merge pull request #379 from ds4dm/AntoinePrv-patch-1 #668

Merge pull request #379 from ds4dm/AntoinePrv-patch-1

Merge pull request #379 from ds4dm/AntoinePrv-patch-1 #668

name: "Test and deploy"
on:
push:
branches: ['**']
tags: ["v[0-9]+.[0-9]+.[0-9]+*"]
pull_request:
branches: ['**']
jobs:
# Continuous testing
# ------------------
test-from-src:
runs-on: ubuntu-20.04
strategy:
matrix:
image:
- "ecoleai/ci-linux-src-clang10-py3.7"
- "ecoleai/ci-linux-src-gcc9-py3.7"
container:
image: ${{ matrix.image }}
credentials:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
steps:
- uses: actions/checkout@v2
- name: "Configure, build, and test ecole-lib and ecole-py-ext."
run: ./dev/run.sh --fix-pythonpath configure -- test-lib -- test-py
test-with-conda-py:
strategy:
matrix:
os:
- "ubuntu-20.04"
- "macos-10.15"
python: ["3.7", "3.8", "3.9", "3.10"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: mamba-org/provision-with-micromamba@v11
with:
environment-file: dev/conda.yaml
extra-specs: python=${{ matrix.python }}
- name: "Configure, build, and test ecole-lib and ecole-py-ext."
shell: bash -l {0}
run: ./dev/run.sh --fix-pythonpath configure -D CMAKE_BUILD_TYPE=CondaRelease -- test-lib -- test-py
test-with-conda-shared:
strategy:
matrix:
os:
- "ubuntu-20.04"
- "macos-10.15"
shared-lib: ["ON", "OFF"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: mamba-org/provision-with-micromamba@v11
with: { environment-file: dev/conda.yaml }
- name: "Configure, build, and test ecole-lib and ecole-py-ext."
shell: bash -l {0}
run: |
./dev/run.sh --fix-pythonpath configure -D BUILD_SHARED_LIBS=${{ matrix.shared-lib }} \
-D CMAKE_BUILD_TYPE=CondaRelease -- test-lib -- test-py
# Currenlty only sanitize address without Python
test-with-sanitizer:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: mamba-org/provision-with-micromamba@v11
with: { environment-file: dev/conda.yaml }
- name: "Configure, build, and test ecole-lib with sanitizer."
shell: bash -l {0}
# Using Ctest runner to avoid out of memory
run: ./dev/run.sh --fix-pythonpath configure -D SANITIZE_ADDRESS=ON -D CMAKE_BUILD_TYPE=CondaRelease -- ctest-lib
check-code:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: mamba-org/provision-with-micromamba@v11
with: { environment-file: dev/conda.yaml }
- name: "Run pre-commit."
shell: bash -l {0}
run: ./dev/run.sh --fix-pythonpath configure -D CMAKE_BUILD_TYPE=CondaRelease -- check-code
test-doc:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: mamba-org/provision-with-micromamba@v11
with:
environment-file: dev/conda.yaml
extra-specs: python="3.9"
- name: "Configure and build ecole-py-ext. Build and test documentation."
shell: bash -l {0}
run: ./dev/run.sh --fix-pythonpath configure -D CMAKE_BUILD_TYPE=CondaRelease -- test-doc
test-dist:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: mamba-org/provision-with-micromamba@v11
with: { environment-file: dev/conda.yaml }
- name: "Build and test dist"
shell: bash -l {0}
run: ./dev/run.sh test-dist
test-example-libecole:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: mamba-org/provision-with-micromamba@v11
with: { environment-file: dev/conda.yaml }
- name: "Build and install libecole, test using the library through CMake"
shell: bash -l {0}
run: ./dev/run.sh configure -D ECOLE_BUILD_PY_EXT=OFF -D BUILD_SHARED_LIBS=ON -- test-example-libecole
test-example-configuring:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: mamba-org/provision-with-micromamba@v11
with:
environment-file: dev/conda.yaml
extra-specs: python="3.9"
- name: "Add external example dependencies (except ecole)"
shell: bash -l {0}
run: |
sed -E '/[[:blank:]]ecole([^a-zA-Z0-9-]|$)/d' examples/configuring-bandits/conda-requirements.yaml > env.yaml
micromamba install --file env.yaml
- name: "Build Ecole and test notebook"
shell: bash -l {0}
run: ./dev/run.sh --fix-pythonpath configure -- test-example-configuring
test-example-branching:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: mamba-org/provision-with-micromamba@v11
with:
environment-file: dev/conda.yaml
extra-specs: python="3.9"
- name: "Add external example dependencies (except ecole)"
shell: bash -l {0}
run: |
sed -E '/[[:blank:]]ecole([^a-zA-Z0-9-]|$)/d' examples/branching-imitation/conda-requirements.yaml > env.yaml
micromamba install --file env.yaml
- name: "Build Ecole and test notebook"
shell: bash -l {0}
run: ./dev/run.sh --fix-pythonpath configure -- test-example-branching
# Deploy checkpoint
# -----------------
all-tests:
needs:
- test-from-src
- test-with-conda-py
- test-with-conda-shared
- test-with-sanitizer
- test-doc
- test-dist
- test-example-libecole
- test-example-configuring
- test-example-branching
- check-code
runs-on: ubuntu-20.04
steps:
- name: "All tests were successful."
run: ""
# Continuous deploy
# -----------------
# Does not trigger for Pull Request to to the github.ref matching refs/pull/**
deploy-latest-doc:
if: ${{ github.ref == 'refs/heads/master' }}
needs: all-tests
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with: {fetch-depth: 0}
- uses: mamba-org/provision-with-micromamba@v11
with:
environment-file: dev/conda.yaml
extra-specs: python="3.9"
- name: "Build documentation."
shell: bash -l {0}
run: |
./dev/run.sh --fix-pythonpath --build-doc-dir=local/docs/latest \
configure -D CMAKE_BUILD_TYPE=CondaRelease -- build-doc
- name: "Symlink stable documentation."
run: |
version="$(./dev/run.sh git-version origin/master | grep -E -o '[0-9]+\.[0-9]+')" &&
cd local/docs/ &&
ln -sf "${version:?}" "stable"
- uses: ./.github/actions/push-to-repo
with:
git_email: "[email protected]"
git_user: "BotEcole"
ssh_key: "${{ secrets.BOT_ECOLE_SSH_KEY }}"
repository: "[email protected]:ds4dm/doc.ecole.ai.git"
repository_subdir: "py/en"
local_dir: "local/docs/"
delete_existing: true
# Release deploy
# --------------
# Does not trigger for Pull Request to to the github.ref matching refs/pull/**
test-version:
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
needs: all-tests
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: "Check version file matches the version."
run: ./dev/run.sh test-version "${GITHUB_REF#refs/tags/}"
deploy-version-doc:
needs: test-version
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: mamba-org/provision-with-micromamba@v11
with:
environment-file: dev/conda.yaml
extra-specs: python="3.9"
- name: "Build documentation."
shell: bash -l {0}
run: |
version="$(echo "${GITHUB_REF#refs/tags/v}" | grep -E -o '[0-9]+\.[0-9]+')" &&
./dev/run.sh --fix-pythonpath --build-doc-dir="local/docs/${version}" \
configure -D CMAKE_BUILD_TYPE=CondaRelease -- build-doc
- uses: ./.github/actions/push-to-repo
with:
git_email: "[email protected]"
git_user: "BotEcole"
ssh_key: "${{ secrets.BOT_ECOLE_SSH_KEY }}"
repository: "[email protected]:ds4dm/doc.ecole.ai.git"
repository_subdir: "py/en"
local_dir: "local/docs/"
delete_existing: false
deploy-pypi:
runs-on: ubuntu-20.04
needs: test-version
steps:
- uses: actions/checkout@v2
- uses: mamba-org/provision-with-micromamba@v11
with: { environment-file: dev/conda.yaml }
- name: "Build, test, and deploy sdist"
shell: bash -l {0}
env:
TWINE_USERNAME: "${{ secrets.PYPI_USERNAME }}"
TWINE_PASSWORD: "${{ secrets.PYPI_PASSWORD }}"
run: ./dev/run.sh deploy-sdist