Skip to content

Merge pull request #639 from LSSTDESC/u/jrbogart/integrate_dataregistry2 #214

Merge pull request #639 from LSSTDESC/u/jrbogart/integrate_dataregistry2

Merge pull request #639 from LSSTDESC/u/jrbogart/integrate_dataregistry2 #214

Workflow file for this run

name: DESC Env Docker Deployment
on:
push:
branches: [ master ]
jobs:
docker-build:
runs-on: ubuntu-latest
env:
SCRIPT_DIR: scripts
INSTALL_SCRIPT: scripts/install.sh
TEST_SCRIPT: scripts/test.sh
strategy:
matrix:
image_version: [bleed, latest]
steps:
- name: Prepare an installation script
run: |
mkdir -p $SCRIPT_DIR
echo '#!/bin/bash' > $INSTALL_SCRIPT
- name: Add pre-installation steps for bleed/latest
if: matrix.image_version == 'bleed' || matrix.image_version == 'latest'
run: |
echo 'source /opt/desc/py/etc/profile.d/conda.sh' >> $INSTALL_SCRIPT
echo 'conda activate base' >> $INSTALL_SCRIPT
- name: Make a copy of the installation script for test script
run: |
cp $INSTALL_SCRIPT $TEST_SCRIPT
- name: Add installation steps
run: |
echo 'pip install https://github.com/${{ github.repository }}/archive/master.zip' >> $INSTALL_SCRIPT
- name: Add test steps
run: |
echo 'python -c "import GCRCatalogs; print(GCRCatalogs.__version__)"' >> $TEST_SCRIPT
echo 'python -c "import pyccl; print(pyccl.__version__)"' >> $TEST_SCRIPT
- name: Set up environment variables for bleed/latest
if: matrix.image_version == 'bleed' || matrix.image_version == 'latest'
run: |
echo "CONTAINER=updateGCR-${{ matrix.image_version }}" >> $GITHUB_ENV
echo "IMAGE=lsstdesc/desc-python:${{ matrix.image_version }}" >> $GITHUB_ENV
- name: Run docker login
run: echo '${{ secrets.DOCKERHUB_ACCESSTOK }}' | docker login --username ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
- run: docker pull $IMAGE
- name: Run installation script in docker
run: |
docker run -v $(pwd)/$SCRIPT_DIR:/$SCRIPT_DIR --name=$CONTAINER $IMAGE /bin/bash /$INSTALL_SCRIPT
docker commit -m="Installed ${{ github.repository }} master" $CONTAINER $IMAGE
docker rm $CONTAINER
- name: Test the updated image
run: |
docker run --rm -v $(pwd)/$SCRIPT_DIR:/$SCRIPT_DIR $IMAGE /bin/bash /$TEST_SCRIPT
- run: docker push $IMAGE