Test Build #1202
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, dev ] | |
paths: | |
- 'code/**' | |
- 'DockerBuild/**' | |
- 'requirements.txt' | |
- '.github/workflows/pytest.yml' | |
pull_request: | |
branches: [ master, production, itrb-test, dev ] | |
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 | |
- name: Download databases into CICD instance | |
continue-on-error: true | |
run: | | |
cd /home/ubuntu/RTX | |
git checkout ${GITHUB_REF#refs/heads/} | |
git pull | |
/home/ubuntu/venv3.9/bin/pip3 install -r requirements.txt | |
/home/ubuntu/venv3.9/bin/python3 code/ARAX/ARAXQuery/ARAX_database_manager.py --mnt --skip-if-exists --remove_unused | |
git checkout master | |
- 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/config_secrets.json:/mnt/data/orangeboard/production/RTX/code/config_secrets.json rtx:test | |
- 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'" | |
- name: Build KP info cache | |
run: sudo docker exec rtx_test bash -c "cd /mnt/data/orangeboard/production/RTX/code/ARAX/ARAXQuery/Expand && python3 kp_info_cacher.py" | |
- name: Start services | |
run: | | |
sudo docker exec rtx_test service apache2 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) |