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

Enable CI on Github #3571

Merged
merged 2 commits into from
Dec 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 3 additions & 36 deletions .ci/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,7 @@ pipeline {
}
}
environment {
// I define some environment variables that are used
// internally by the travis scripts that I call
TEST_TYPE="tests"
// To mock what TRAVIS WOULD USE
TRAVIS_BUILD_DIR="."
WORKSPACE_PATH="."
COMPUTER_SETUP_TYPE="jenkins"
// The following two variables allow to run selectively tests only for one backend
RUN_ALSO_DJANGO="true"
Expand Down Expand Up @@ -70,10 +66,6 @@ pipeline {
// Debug: check that I can connect without password
sh 'echo "SELECT datname FROM pg_database" | psql -h localhost -U postgres -w'

// We skip the creation of a docker image
// to ssh into, as it is done in travis. Here, in Jenkins,
// we instead ssh to localhost to investigate.

// Add the line to the .bashrc, but before it stops when non-interactive
// So it can find the location of 'verdi'
sh "sed -i '/interactively/iexport PATH=\${PATH}:~/.local/bin' ~/.bashrc"
Expand Down Expand Up @@ -109,57 +101,32 @@ pipeline {
// they might get at the point of writing the config.json at the
// same time and one of the two would crash
AIIDA_PATH="/tmp/aiida-django-folder"
// To collect coverage info for each backend in a different file
// and avoiding potential problems
COVERAGE_FILE=".coverage.django"
}
when {
// This allows to selectively run only one backend
environment name: 'RUN_ALSO_DJANGO', value: 'true'
}
steps {
sh '.ci/setup_profiles.sh'
sh '.ci/before_script.sh'
sh '.ci/test_script.sh'
sh '.ci/setup.sh'
sh '.ci/test_rpn.sh'
}
}
stage('Test-SQLAlchemy') {
environment {
AIIDA_TEST_BACKEND="sqlalchemy"
AIIDA_PATH="/tmp/aiida-sqla-folder"
COVERAGE_FILE=".coverage.sqlalchemy"
}
when {
// This allows to selectively run only one backend
environment name: 'RUN_ALSO_SQLALCHEMY', value: 'true'
}
steps {
sh '.ci/setup_profiles.sh'
sh '.ci/before_script.sh'
sh '.ci/test_script.sh'
sh '.ci/setup.sh'
sh '.ci/test_rpn.sh'
}
}
}
}
stage('Final') {
steps {
// create the final coverage info, summed over the various backends
sh '.ci/create_coverage_info.sh'
}
// post {
// always {
// // note: junit does not like the XML output, it says
// // 'None of the test reports contained any result'
// // (maybe because it's coverage and not testing?)
// // For now I'm not doing it as it's ~3 MB every time
// // NOTE MOREOVER that one should run 'zip -r html.zip html' in the
// // coverage folder, first
// archiveArtifacts artifacts: '.ci/coverage/html.zip', fingerprint: true
// }
// }
}
}
post {
always {
Expand Down
2 changes: 0 additions & 2 deletions .ci/README

This file was deleted.

24 changes: 0 additions & 24 deletions .ci/before_install.sh

This file was deleted.

68 changes: 0 additions & 68 deletions .ci/before_script.sh

This file was deleted.

2 changes: 0 additions & 2 deletions .ci/coverage/.gitignore

This file was deleted.

20 changes: 0 additions & 20 deletions .ci/create_coverage_info.sh

This file was deleted.

19 changes: 0 additions & 19 deletions .ci/install_conda.sh

This file was deleted.

16 changes: 0 additions & 16 deletions .ci/prep_ssh.sh

This file was deleted.

34 changes: 34 additions & 0 deletions .ci/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env bash
set -ev

# The following is needed on jenkins, for some reason bashrc is not reloaded automatically
if [ -e ~/.bashrc ] ; then source ~/.bashrc ; fi

# Add the .ci and the polish folder to the python path such that defined workchains can be found by the daemon
export PYTHONPATH="${PYTHONPATH}:${WORKSPACE_PATH}/.ci"
export PYTHONPATH="${PYTHONPATH}:${WORKSPACE_PATH}/.ci/polish"

PSQL_COMMAND="CREATE DATABASE $AIIDA_TEST_BACKEND ENCODING \"UTF8\" LC_COLLATE=\"en_US.UTF-8\" LC_CTYPE=\"en_US.UTF-8\" TEMPLATE=template0;"
psql -h localhost -c "${PSQL_COMMAND}" -U postgres -w

verdi setup --profile $AIIDA_TEST_BACKEND \
--email="aiida@localhost" --first-name=AiiDA --last-name=test --institution="AiiDA Team" \
--db-engine 'postgresql_psycopg2' --db-backend=$AIIDA_TEST_BACKEND --db-host="localhost" --db-port=5432 \
--db-name="$AIIDA_TEST_BACKEND" --db-username=postgres --db-password='' \
--repository="/tmp/repository_${AIIDA_TEST_BACKEND}/" --non-interactive

verdi profile setdefault $AIIDA_TEST_BACKEND
verdi config runner.poll.interval 0

# Start the daemon for the correct profile and add four additional workers to prevent deadlock with integration tests
verdi -p $AIIDA_TEST_BACKEND daemon start
verdi -p $AIIDA_TEST_BACKEND daemon incr 4

verdi -p $AIIDA_TEST_BACKEND computer setup --non-interactive --label=localhost --hostname=localhost --transport=local \
--scheduler=direct --mpiprocs-per-machine=1 --prepend-text="" --append-text=""
verdi -p $AIIDA_TEST_BACKEND computer configure local localhost --non-interactive --safe-interval=0

# Configure the 'add' code inside localhost
verdi -p $AIIDA_TEST_BACKEND code setup -n -L add \
-D "simple script that adds two numbers" --on-computer -P arithmetic.add \
-Y localhost --remote-abs-path=/usr/local/bin/add.sh
36 changes: 0 additions & 36 deletions .ci/setup_profiles.sh

This file was deleted.

Loading