Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add caching to CI test pipeline #361

Merged
merged 12 commits into from Apr 15, 2022
13 changes: 12 additions & 1 deletion .github/workflows/lint-and-test.yml
Expand Up @@ -34,9 +34,20 @@ jobs:
run: |
git fetch --prune --unshallow
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- run: ci/SETUP.sh
- uses: actions/cache@v2
id: cache
with:
path: ${{ env.pythonLocation }}
key: ${{ runner.os }}-pip-${{ env.pythonLocation }}-${{ hashFiles('**/requirements/**.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- run: |
ci/setup-postgres.sh
sudo apt-get -y install coinor-cbc
- name: Install FlexMeasures & dependencies for tests
if: steps.cache.outputs.cache-hit != 'true'
run: |
make install-pip-tools
make install-for-test
pip install coveralls
- name: Run all tests except those marked to be skipped by GitHub
Expand Down
3 changes: 3 additions & 0 deletions ci/Readme.md
@@ -1 +1,4 @@
# Continuous integration

Here are some useful script for CI.

5 changes: 5 additions & 0 deletions ci/install-cbc.sh → ci/install-cbc-from-source.sh
@@ -1,5 +1,10 @@
#!/bin/bash

######################################################################
# This script installs the Cbc solver from source
# (for cases where you can't install the coinor-cbc package)
######################################################################

# Install to this dir
SOFTWARE_DIR=/home/seita/software
if [ "$1" != "" ]; then
Expand Down
9 changes: 3 additions & 6 deletions ci/SETUP.sh → ci/setup-postgres.sh
@@ -1,19 +1,16 @@
#!/bin/bash

######################################################################
# This script sets up a new FlexMeasures instance in a CI environment
# This script sets up a new Postgres instance in a CI environment
######################################################################


# Install dependencies
apt-get update
sudo apt-get -y install postgresql-client coinor-cbc
make install-deps

sudo apt-get update
sudo apt-get -y install postgresql-client

# Wait for the DB service to be up.

# Hack until this feature is ready: https://bitbucket.org/site/master/issues/15244/build-execution-should-wait-until-all
statusFile=/tmp/postgres-status
while [[ true ]]; do
telnet $PGHOST $PGPORT &> ${statusFile}
Expand Down
2 changes: 1 addition & 1 deletion documentation/tut/installation.rst
Expand Up @@ -235,7 +235,7 @@ Installing Cbc can be done on Unix via:

(also available in different popular package managers).

We provide a script for installing from source (without requiring ``sudo`` rights) in :ref:`continuous_integration`.
We provide a script for installing from source (without requiring ``sudo`` rights) in the `ci` folder.

More information (e.g. for installing on Windows) on `the Cbc website <https://projects.coin-or.org/Cbc>`_.

Expand Down