GitHub CI #1128
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: GitHub CI | |
on: | |
# Trigger the workflow on push or pull request, | |
# but only for the main branch | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
# nightly tests at 8:00 UTC | |
schedule: | |
- cron: '0 8 * * *' | |
workflow_dispatch: | |
types: run-test | |
defaults: | |
run: | |
shell: bash -l {0} | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
python-version: [3.8, 3.9, '3.10', '3.11'] | |
include: | |
- os: macos-latest | |
python-version: 3.8 | |
- os: windows-latest | |
python-version: 3.8 | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: conda-incubator/setup-miniconda@v2 | |
with: | |
activate-environment: test_env | |
environment-file: environment.yml | |
python-version: ${{ matrix.python-version }} | |
auto-activate-base: false | |
- name: Conda Env | |
run: | | |
conda info | |
conda list | |
- name: Install CBC | |
run: | | |
if [ ${{ matrix.os }} = windows-latest ] | |
then | |
# download CBC from idaes-ext | |
echo "...downloading solvers" | |
SOLVER_DIR="${GITHUB_WORKSPACE}/cache/solvers" | |
mkdir -p "$SOLVER_DIR" | |
echo "$SOLVER_DIR" >> $GITHUB_PATH | |
DOWNLOAD_DIR="${GITHUB_WORKSPACE}/cache/download" | |
mkdir -p "$DOWNLOAD_DIR" | |
SOLVER_TAR=${DOWNLOAD_DIR}/solvers.tar.gz | |
URL=https://github.com/IDAES/idaes-ext | |
RELEASE=$(curl --max-time 150 --retry 8 \ | |
-L -s -H 'Accept: application/json' ${URL}/releases/latest) | |
VER=$(echo $RELEASE | sed -e 's/.*"tag_name":"\([^"]*\)".*/\1/') | |
URL=${URL}/releases/download/$VER | |
if test "${{matrix.os}}" == ubuntu-20.04; then | |
curl --max-time 150 --retry 8 \ | |
-L $URL/idaes-solvers-ubuntu2004-x86_64.tar.gz \ | |
> $SOLVER_TAR | |
else | |
curl --max-time 150 --retry 8 \ | |
-L $URL/idaes-solvers-windows-x86_64.tar.gz \ | |
$URL/idaes-lib-windows-x86_64.tar.gz > $SOLVER_TAR | |
fi | |
cd $SOLVER_DIR | |
tar -xzi < $SOLVER_TAR | |
echo "" | |
echo "$SOLVER_DIR" | |
ls -l $SOLVER_DIR | |
else | |
conda install coincbc==2.10.5 | |
fi | |
- name: Install EGRET | |
# don't install if this is a tag | |
# use the version specified in setup.py | |
if: ${{!startsWith(github.ref, 'refs/tags')}} | |
run: | | |
pip install git+https://github.com/grid-parity-exchange/Egret.git | |
- name: Install Prescient | |
run: | | |
python setup.py develop | |
- name: Run Prescient Simulator Tests | |
run: | | |
pytest -v prescient/simulator/tests/test_simulator.py |