Restore databases #764
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: "Test Build" | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ master, production, itrb-test ] | |
paths: | |
- 'code/**' | |
- 'DockerBuild/**' | |
- 'requirements.txt' | |
- '.github/workflows/pytest.yml' | |
pull_request: | |
branches: [ master, production, itrb-test ] | |
paths: | |
- 'code/**' | |
- 'DockerBuild/**' | |
- 'requirements.txt' | |
- '.github/workflows/pytest.yml' | |
jobs: | |
analyze: | |
name: Analyze | |
runs-on: [self-hosted, ARAX, docker] | |
permissions: | |
actions: read | |
contents: read | |
security-events: read | |
strategy: | |
fail-fast: false | |
matrix: | |
language: [ 'python' ] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up config files | |
run: | | |
scp [email protected]:config_secrets.json /mnt/config/config_secrets.json | |
echo "http://localhost:5008/api/rtxkg2/v1.4" > /mnt/config/kg2_url_override.txt | |
# - name: Append code dir to GITHUB_PATH # Causing RTXConfiguration import error | |
# run: echo $GITHUB_PATH | |
# - name: Download databases as needed | |
# run: python3 $HOME/RTX/code/ARAX/ARAXQuery/ARAX_database_manager.py --mnt --skip-if-exists --remove_unused | |
- name: Stop any running containers | |
continue-on-error: true | |
run: sudo docker stop $(sudo docker ps -aq) | |
- name: Clean up any left over containers | |
continue-on-error: true | |
run: sudo docker rm $(sudo docker ps -aq) | |
- name: Clean up any left over images | |
continue-on-error: true | |
run: sudo docker rmi $(sudo docker images -q) | |
- name: Build docker image | |
run: sudo docker build --no-cache=true --rm -t rtx:test DockerBuild/ -f DockerBuild/Merged-Dockerfile | |
- name: Run docker container | |
run: sudo docker run -d -it --name rtx_test -v /mnt/data/orangeboard/databases:/mnt/data/orangeboard/databases -v /mnt/config/kg2_url_override.txt:/mnt/data/orangeboard/production/RTX/code/kg2_url_override.txt -v /mnt/config/config_secrets.json:/mnt/data/orangeboard/production/RTX/code/config_secrets.json -v /mnt/config/config_secrets.json:/mnt/data/orangeboard/kg2/RTX/code/config_secrets.json rtx:test | |
# - name: Add config.domain | |
# run: | | |
# sudo docker exec rtx_test bash -c "sudo -u rt bash -c 'cd /mnt/data/orangeboard/production/RTX/code && echo \'RTXTeam/RTX Github actions test suite\' > config.domain'" | |
# sudo docker exec rtx_test bash -c "sudo -u rt bash -c 'cd /mnt/data/orangeboard/kg2/RTX/code && echo \'RTXTeam/RTX Github actions test suite\' > config.domain'" | |
- name: Create symlinks | |
run: | | |
sudo docker exec rtx_test bash -c "sudo -u rt bash -c 'cd /mnt/data/orangeboard/production/RTX && python3 code/ARAX/ARAXQuery/ARAX_database_manager.py'" | |
sudo docker exec rtx_test bash -c "sudo -u rt bash -c 'cd /mnt/data/orangeboard/kg2/RTX && python3 code/ARAX/ARAXQuery/ARAX_database_manager.py'" | |
- name: Start services | |
run: | | |
sudo docker exec rtx_test service apache2 start | |
sudo docker exec rtx_test service RTX_OpenAPI_kg2 start | |
sudo docker exec rtx_test service RTX_OpenAPI_production start | |
sudo docker exec rtx_test service RTX_Complete start | |
- name: Run tests with pytest | |
run: sudo docker exec rtx_test bash -c "cd /mnt/data/orangeboard/production/RTX/code/ARAX/test && pytest -v --disable-pytest-warnings" | |
- name: Remove and delete all docker containers & images | |
continue-on-error: true | |
run: | | |
sudo docker stop $(sudo docker ps -aq) | |
sudo docker rm $(sudo docker ps -aq) | |
sudo docker rmi $(sudo docker images -q) |