Merge pull request #182 from ucam-department-of-psychiatry/multiple-t… #726
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
--- | |
# yamllint disable rule:line-length | |
name: Installer | |
# yamllint disable-line rule:truthy | |
on: | |
push: | |
paths: | |
- 'crate_anon/**' | |
- .github/workflows/installer.yml | |
- github_action_scripts/anonymisation_checks.sh | |
- github_action_scripts/docker_db_setup.sh | |
- github_action_scripts/installer_setup.sh | |
- github_action_scripts/post_installation_checks.sh | |
- github_action_scripts/python_setup.sh | |
- github_action_scripts/set_crate_installer_environment | |
- github_action_scripts/set_crate_installer_mssql_environment | |
- github_action_scripts/set_crate_installer_mysql_environment | |
- github_action_scripts/source_database_mssql.sql | |
- github_action_scripts/source_database_mysql.sql | |
- 'docker/**' | |
- 'installer/**' | |
- setup.py | |
jobs: | |
installer: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Common setup | |
run: | | |
set -eux -o pipefail | |
source ${GITHUB_WORKSPACE}/github_action_scripts/set_crate_installer_environment | |
${GITHUB_WORKSPACE}/github_action_scripts/installer_setup.sh | |
- name: Set up python virtualenv | |
run: | | |
set -eux -o pipefail | |
${GITHUB_WORKSPACE}/github_action_scripts/python_setup.sh | |
- name: Set up external SQL Server databases | |
run: | | |
set -eux -o pipefail | |
${GITHUB_WORKSPACE}/github_action_scripts/docker_db_setup.sh sqlserver | |
docker ps | |
source ${GITHUB_WORKSPACE}/github_action_scripts/set_crate_installer_environment | |
source ${GITHUB_WORKSPACE}/github_action_scripts/set_crate_installer_mssql_environment | |
sqlcmd -S localhost -U ${CRATE_DOCKER_SOURCE_DATABASE_USER_NAME} -P ${CRATE_DOCKER_SOURCE_DATABASE_USER_PASSWORD} -i ${GITHUB_WORKSPACE}/github_action_scripts/source_database_mssql.sql | |
- name: Set up external MySQL databases | |
run: | | |
set -eux -o pipefail | |
${GITHUB_WORKSPACE}/github_action_scripts/docker_db_setup.sh mysql 43306 | |
docker ps | |
source ${GITHUB_WORKSPACE}/github_action_scripts/set_crate_installer_environment | |
source ${GITHUB_WORKSPACE}/github_action_scripts/set_crate_installer_mysql_environment | |
cat ${GITHUB_WORKSPACE}/github_action_scripts/source_database_mysql.sql | mysql -h localhost -P ${CRATE_INSTALLER_SOURCE_DATABASE_PORT} -u ${CRATE_DOCKER_SOURCE_DATABASE_USER_NAME} -p${CRATE_DOCKER_SOURCE_DATABASE_USER_PASSWORD} --protocol=tcp ${CRATE_DOCKER_SOURCE_DATABASE_NAME} | |
- name: Run installer with external MSSQL databases | |
run: | | |
set -eux -o pipefail | |
source ${GITHUB_WORKSPACE}/github_action_scripts/set_crate_installer_environment | |
source ${GITHUB_WORKSPACE}/github_action_scripts/set_crate_installer_mssql_environment | |
cd ${GITHUB_WORKSPACE}/installer | |
python3 installer_boot.py --crate_root_dir /crate --run_locally | |
export CRATE_HOME=${GITHUB_WORKSPACE} | |
${GITHUB_WORKSPACE}/github_action_scripts/post_installation_checks.sh | |
# docker-compose down --volumes with relevant docker-compose files | |
python3 installer_boot.py --crate_root_dir /crate --run_locally stop | |
rm ${CRATE_INSTALLER_CRATE_ROOT_HOST_DIR}/config/${CRATE_DOCKER_CRATEWEB_CONFIG_FILENAME} | |
rm ${CRATE_INSTALLER_CRATE_ROOT_HOST_DIR}/config/${CRATE_DOCKER_CRATE_ANON_CONFIG} | |
- name: Run installer with external MySQL databases | |
run: | | |
set -eux -o pipefail | |
source ${GITHUB_WORKSPACE}/github_action_scripts/set_crate_installer_environment | |
source ${GITHUB_WORKSPACE}/github_action_scripts/set_crate_installer_mysql_environment | |
cd ${GITHUB_WORKSPACE}/installer | |
python3 installer_boot.py --crate_root_dir /crate --run_locally | |
export CRATE_HOME=${GITHUB_WORKSPACE} | |
${GITHUB_WORKSPACE}/github_action_scripts/post_installation_checks.sh | |
python3 installer_boot.py --crate_root_dir /crate --run_locally stop | |
rm ${CRATE_INSTALLER_CRATE_ROOT_HOST_DIR}/config/${CRATE_DOCKER_CRATEWEB_CONFIG_FILENAME} | |
rm ${CRATE_INSTALLER_CRATE_ROOT_HOST_DIR}/config/${CRATE_DOCKER_CRATE_ANON_CONFIG} | |
- name: Run installer with demo MySQL databases | |
run: | | |
set -eux -o pipefail | |
docker version | |
docker compose version | |
source ${GITHUB_WORKSPACE}/github_action_scripts/set_crate_installer_environment | |
cd ${GITHUB_WORKSPACE}/installer | |
python3 installer_boot.py --crate_root_dir /crate --run_locally | |
export CRATE_HOME=${GITHUB_WORKSPACE} | |
${GITHUB_WORKSPACE}/github_action_scripts/post_installation_checks.sh | |
${GITHUB_WORKSPACE}/github_action_scripts/anonymisation_checks.sh | |
# docker-compose down --volumes with relevant docker-compose files | |
python3 installer_boot.py --crate_root_dir /crate --run_locally stop | |
rm ${CRATE_INSTALLER_CRATE_ROOT_HOST_DIR}/config/${CRATE_DOCKER_CRATEWEB_CONFIG_FILENAME} | |
rm ${CRATE_INSTALLER_CRATE_ROOT_HOST_DIR}/config/${CRATE_DOCKER_CRATE_ANON_CONFIG} | |
- name: Dump stuff on failure | |
if: failure() | |
run: | | |
set -eux -o pipefail | |
env | |
source ${GITHUB_WORKSPACE}/github_action_scripts/set_crate_installer_environment | |
cat ${CRATE_INSTALLER_CRATE_ROOT_HOST_DIR}/config/${CRATE_DOCKER_CRATEWEB_CONFIG_FILENAME} |