Skip to content

Relax bloptools pin #91

Relax bloptools pin

Relax bloptools pin #91

Workflow file for this run

name: package_env
on:
push:
# pull_request:
jobs:
generate_conda_packd_envs:
name: conda-pack'd env with Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10"]
fail-fast: false
env:
TZ: America/New_York
defaults:
run:
shell: bash -l {0}
steps:
- name: Set env vars
run: |
export REPOSITORY_NAME=${GITHUB_REPOSITORY#*/} # just the repo, as opposed to org/repo
echo "REPOSITORY_NAME=${REPOSITORY_NAME}" >> $GITHUB_ENV
export DATETIME_STRING=$(date +%Y%m%d%H%M%S)
echo "DATETIME_STRING=${DATETIME_STRING}" >> $GITHUB_ENV
- name: Set non-secret environment variables
run: |
export PYTHONVER=$(echo ${{ matrix.python-version }} | sed 's/\.//g')
echo "PYTHONVER=${PYTHONVER}" >> $GITHUB_ENV
export CONDA_PACK_TEMPLATE_DIR=${HOME}/conda-pack-template
echo "CONDA_PACK_TEMPLATE_DIR=${CONDA_PACK_TEMPLATE_DIR}" >> $GITHUB_ENV
- name: checkout the code
uses: actions/checkout@v3
- name: checkout NSLS-II/conda-pack-template
run: |
git clone https://github.com/NSLS-II/conda-pack-template ${CONDA_PACK_TEMPLATE_DIR}
cd ${CONDA_PACK_TEMPLATE_DIR}
- uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: ${{ env.REPOSITORY_NAME }}
auto-update-conda: true
miniconda-version: "latest"
python-version: ${{ matrix.python-version }}
- name: pip-install dependencies
run: |
# For reference: https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html.
set -vxeuo pipefail
python3 -m pip install -r ${CONDA_PACK_TEMPLATE_DIR}/requirements.txt
python3 -m pip install shyaml
- name: pip-install dev-dependencies
run: |
# For reference: https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html.
set -vxeuo pipefail
python3 -m pip install -r ${CONDA_PACK_TEMPLATE_DIR}/requirements-dev.txt
- name: check env
run: |
# For reference: https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html.
set -vxeuo pipefail
conda info
conda env list
conda list
pip list
conda config --show-sources
conda config --show
printenv | sort
- name: render config
run: |
# For reference: https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html.
set -vxeuo pipefail
env_name=$(cat configs/config-py${PYTHONVER}.yml | shyaml get-value env_name)
export CONDA_PACK_ENV_NAME="${env_name}"
echo "CONDA_PACK_ENV_NAME=${CONDA_PACK_ENV_NAME}" >> $GITHUB_ENV
dockerfile=$(python3 ${CONDA_PACK_TEMPLATE_DIR}/render.py -c configs/config-py${PYTHONVER}.yml -f Dockerfile.j2)
runner=$(python3 ${CONDA_PACK_TEMPLATE_DIR}/render.py -c configs/config-py${PYTHONVER}.yml -f runner.sh.j2)
echo "${dockerfile}"
echo "${runner}"
ls -la
cat "${dockerfile}"
cat "${runner}"
export CONDA_PACK_TEMPLATE_RUNNER="${runner}"
echo "CONDA_PACK_TEMPLATE_RUNNER=${CONDA_PACK_TEMPLATE_RUNNER}" >> $GITHUB_ENV
- name: run a build with Docker/Podman
run: |
# For reference: https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html.
set -vxeo pipefail
cp -v ${CONDA_PACK_TEMPLATE_DIR}/export.sh .
bash ${CONDA_PACK_TEMPLATE_RUNNER}
ls -laF
cp -v Dockerfile ${CONDA_PACK_TEMPLATE_RUNNER} artifacts/
sudo chown -v $USER: artifacts/*
ls -laF artifacts/
- name: contents of the env .yml file
run: |
cat artifacts/${CONDA_PACK_ENV_NAME}.yml
- name: checksum files
run: |
cat artifacts/*sum.txt
# https://github.com/actions/upload-artifact
- name: upload artifacts for branch
if: |
github.ref != 'refs/heads/main'
uses: actions/upload-artifact@v3
with:
name: test-${{ env.CONDA_PACK_ENV_NAME }}-${{ env.DATETIME_STRING }}
path: artifacts
retention-days: 14
- name: upload artifacts for release
if: |
github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v3
with:
name: ${{ env.CONDA_PACK_ENV_NAME }}
path: artifacts
retention-days: 60
- name: upload artifacts for the env .yml file
uses: actions/upload-artifact@v3
with:
name: ${{ env.CONDA_PACK_ENV_NAME }}.yml
path: artifacts/${{ env.CONDA_PACK_ENV_NAME}}.yml
retention-days: 60