Skip to content

Integration test for run_dicom_archive_loader.py #270

Integration test for run_dicom_archive_loader.py

Integration test for run_dicom_archive_loader.py #270

Workflow file for this run

name: Integration tests
on:
pull_request:
push:
branches:
- 'main'
- '*-release'
env:
DATABASE_NAME: TestDatabase
DATABASE_USERNAME: TestUsername
DATABASE_PASSWORD: TestPassword
BUCKET_URL: ${{ vars.S3_BUCKET_URL }}
BUCKET_NAME: ${{ vars.S3_BUCKET_NAME }}
BUCKET_ACCESS_KEY: ${{ secrets.S3_BUCKET_ACCESS_KEY }}
BUCKET_SECRET_KEY: ${{ secrets.S3_BUCKET_SECRET_KEY }}
jobs:
docker:
name: Docker
runs-on: ubuntu-latest
steps:
- name: Print variables
run: echo ${{ vars.S3_BUCKET_URL }} ${{ vars.S3_BUCKET_NAME }}
- name: Check out LORIS-MRI
uses: actions/checkout@v4
- name: Clone the LORIS core repository
run: git clone https://github.com/aces/Loris.git ./test/Loris
- name: Overwrite Raisinbread SQL files
run: cp -f ./test/RB_SQL/*.sql ./test/Loris/raisinbread/RB_files/
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker database image
uses: docker/build-push-action@v6
with:
context: .
file: ./test/db.Dockerfile
build-args: |
DATABASE_NAME=${{ env.DATABASE_NAME }}
DATABASE_USER=${{ env.DATABASE_USERNAME }}
DATABASE_PASS=${{ env.DATABASE_PASSWORD }}
tags: loris-db
load: true
cache-from: type=gha,scope=loris-db
cache-to: type=gha,scope=loris-db
- name: Build Docker MRI image
uses: docker/build-push-action@v6
with:
context: .
file: ./test/mri.Dockerfile
build-args: |
DATABASE_NAME=${{ env.DATABASE_NAME }}
DATABASE_USER=${{ env.DATABASE_USERNAME }}
DATABASE_PASS=${{ env.DATABASE_PASSWORD }}
BUCKET_URL=${{ env.BUCKET_URL }}
BUCKET_NAME=${{ env.BUCKET_NAME }}
BUCKET_ACCESS_KEY=${{ env.BUCKET_ACCESS_KEY }}
BUCKET_SECRET_KEY=${{ env.BUCKET_SECRET_KEY }}
tags: loris-mri
load: true
cache-from: type=gha,scope=loris-mri
cache-to: type=gha,mode=max,scope=loris-mri
# TODO: Move as much as possible of this in the MRI dockerfile
- name: Mount imaging files S3 bucket
run: |
sudo apt-get update
sudo apt-get install -y s3fs fuse kmod
sudo modprobe fuse
sudo mkdir /data-imaging
touch .passwd-s3fs
chmod 600 .passwd-s3fs
echo ${{ env.BUCKET_ACCESS_KEY }}:${{ env.BUCKET_SECRET_KEY }} > .passwd-s3fs
sudo s3fs ${{ env.BUCKET_NAME }} /data-imaging -o passwd_file=.passwd-s3fs -o url=${{ env.BUCKET_URL }} -o use_path_request_style -o allow_other
- name: Run integration tests
run: docker compose --file ./test/docker-compose.yml run mri pytest python/tests/integration