Update dependencies #270
Workflow file for this run
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: package_env | |
on: | |
push: | |
# TODO: react also on reopening the PR. | |
# pull_request: | |
workflow_dispatch: | |
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", "3.11", "3.12"] | |
python-version: ["3.11", "3.12"] | |
fail-fast: false | |
env: | |
TZ: America/New_York | |
defaults: | |
run: | |
shell: bash -lvxeo pipefail {0} | |
steps: | |
- name: Checkout the code | |
uses: actions/checkout@v4 | |
- name: Install Python for YAML CLI tools | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: Install YAML CLI tools | |
run: | | |
python3 -m pip install shyaml | |
- name: Set env vars | |
run: | | |
set -vxeuo pipefail | |
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 | |
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 | |
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 | |
env | sort -u | |
# - uses: conda-incubator/setup-miniconda@v3 | |
# with: | |
# python-version: ${{ matrix.python-version }} | |
# # mamba-version: "*" | |
# channels: conda-forge | |
# channel-priority: strict | |
# activate-environment: packaging | |
# environment-file: envs/env-py${{ env.PYTHONVER }}.yml | |
- name: Setup umamba | |
uses: mamba-org/setup-micromamba@v1 | |
with: | |
environment-file: envs/env-py${{ env.PYTHONVER }}.yml | |
log-level: info | |
- 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: Add packages for py311 | |
if: matrix.python-version == '3.11' | |
run: | | |
conda install -c conda-forge \ | |
"bloptools>=0.7.0" \ | |
"bluesky-darkframes>=0.6.0" \ | |
caproto \ | |
emojis \ | |
happi \ | |
pexpect \ | |
"pyolog>=4.5.0" \ | |
pyserial \ | |
python-confluent-kafka \ | |
pyzenodo3 \ | |
simple-pid \ | |
slack-sdk \ | |
hklpy \ | |
"hxnfly>=0.0.11" \ | |
kkcalc \ | |
ppmac \ | |
"pychx>=4.3.1" \ | |
"xpdacq==1.0.0" \ | |
hunter \ | |
logging_tree \ | |
line_profiler \ | |
pyinstrument \ | |
pyperformance \ | |
botorch \ | |
gpytorch \ | |
ortools-python \ | |
pytorch \ | |
scikit-optimize | |
- name: Export files | |
run: | | |
set -vxeo pipefail | |
export ARTIFACTS_DIR="$HOME/artifacts" | |
echo "ARTIFACTS_DIR=${ARTIFACTS_DIR}" >> $GITHUB_ENV | |
if [ ! -d "${ARTIFACTS_DIR}" ]; then | |
mkdir -v -p "${ARTIFACTS_DIR}" | |
fi | |
# conda env export -n ${CONDA_PACK_ENV_NAME} -f ${ARTIFACTS_DIR}/${CONDA_PACK_ENV_NAME}.yml -c conda-forge --override-channels | |
conda env export -f ${ARTIFACTS_DIR}/${CONDA_PACK_ENV_NAME}.yml | |
# Per https://conda.github.io/conda-pack/cli.html: | |
conda-pack -o ${ARTIFACTS_DIR}/${CONDA_PACK_ENV_NAME}.tar.gz --ignore-missing-files --ignore-editable-packages | |
openssl sha256 ${ARTIFACTS_DIR}/${CONDA_PACK_ENV_NAME}.tar.gz > ${ARTIFACTS_DIR}/${CONDA_PACK_ENV_NAME}-sha256sum.txt | |
openssl md5 ${ARTIFACTS_DIR}/${CONDA_PACK_ENV_NAME}.tar.gz > ${ARTIFACTS_DIR}/${CONDA_PACK_ENV_NAME}-md5sum.txt | |
chmod -v 664 ${ARTIFACTS_DIR}/${CONDA_PACK_ENV_NAME}[.-]* | |
- name: Contents of the env .yml file | |
run: | | |
cat ${ARTIFACTS_DIR}/${CONDA_PACK_ENV_NAME}.yml | |
- name: Checksum files | |
run: | | |
cat ${ARTIFACTS_DIR}/*sum.txt | |
# https://github.com/actions/upload-artifact | |
- name: Upload artifacts for the env .yml file | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.CONDA_PACK_ENV_NAME }}.yml | |
path: ${{ env.ARTIFACTS_DIR }}/${{ env.CONDA_PACK_ENV_NAME }}.yml | |
retention-days: 60 | |
- name: Upload artifacts for branch | |
if: | | |
github.ref != 'refs/heads/main' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-${{ env.CONDA_PACK_ENV_NAME }}-${{ env.DATETIME_STRING }} | |
path: ${{ env.ARTIFACTS_DIR }} | |
retention-days: 14 | |
- name: Upload artifacts for release | |
if: | | |
github.ref == 'refs/heads/main' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.CONDA_PACK_ENV_NAME }} | |
path: ${{ env.ARTIFACTS_DIR }} | |
retention-days: 60 |