Merge pull request #57 from Daylily-Informatics/20240730a #218
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: BLOOM CentOS | |
on: | |
push: | |
branches: | |
- 'main' | |
tags: | |
- '*' | |
pull_request: | |
branches: | |
- '**' | |
jobs: | |
centos9-job: | |
runs-on: ubuntu-latest # We use the default GitHub runner to start a Docker container | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Set up Docker | |
uses: docker/setup-buildx-action@v2 | |
- name: Build and run CentOS 9 compatible container | |
run: | | |
docker run --name rocky9-container -d rockylinux:9 sleep infinity | |
docker exec rocky9-container yum install -y python3 python3-pip wget | |
docker exec rocky9-container python3 -m pip install --upgrade pip | |
# Create a user named 'bloom' and switch to this user | |
docker exec rocky9-container useradd -m bloom | |
# Install Miniconda for user 'bloom' | |
docker exec rocky9-container su - bloom -c "wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh" | |
docker exec rocky9-container su - bloom -c "bash /tmp/miniconda.sh -b -p /home/bloom/miniconda" | |
docker exec rocky9-container su - bloom -c "echo 'export PATH=/home/bloom/miniconda/bin:$PATH' >> /home/bloom/.bashrc" | |
docker exec rocky9-container su - bloom -c "/home/bloom/miniconda/bin/conda init" | |
# Source the conda script and create conda environment | |
docker exec rocky9-container su - bloom -c "source /home/bloom/.bashrc && conda create -n BLOOM2 python=3.12.0 pip -y" | |
# Copy repository content to container | |
docker cp . rocky9-container:/home/bloom/workspace | |
docker exec rocky9-container chown -R bloom:bloom /home/bloom/workspace | |
# Run the setup script and tests | |
docker exec rocky9-container su - bloom -c "cd /home/bloom/workspace && source /home/bloom/.bashrc && source bloom_lims/env/install_postgres.sh && pytest" | |
- name: Clean up Docker container | |
run: docker rm -f rocky9-container |