From 79726f57a2537f8734311d652059a712c28db633 Mon Sep 17 00:00:00 2001 From: Max Rakitin Date: Tue, 11 Feb 2025 17:14:31 -0500 Subject: [PATCH 01/37] CI: fix conda/mamba command --- .github/workflows/testing.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index a41e6b3..455d8ce 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -44,7 +44,7 @@ jobs: - name: Setup umamba uses: mamba-org/setup-micromamba@v1 - - name: Setup umamba + - name: Create a conda env from Zenodo run: | set -vxeo pipefail url="https://zenodo.org/record/${{ matrix.zenodo-id }}/files/${CONDA_ENV_NAME}.tar.gz?download=1" @@ -58,8 +58,8 @@ jobs: md5sum --check checksum.txt mkdir -p $HOME/${CONDA_ENV_NAME} tar -xf ${CONDA_ENV_NAME}.tar.gz -C $HOME/${CONDA_ENV_NAME} - conda activate $HOME/${CONDA_ENV_NAME} - conda unpack + ${MAMBA_EXE} activate $HOME/${CONDA_ENV_NAME} + conda-unpack - name: Start MongoDB uses: supercharge/mongodb-github-action@1.6.0 @@ -83,6 +83,7 @@ jobs: run: | set -vxeuo pipefail source ~/cms-epics-containers/environment.sh + ${MAMBA_EXE} activate $HOME/${CONDA_ENV_NAME} echo "\n" | python iocs/spoof_beamline.py --list-pvs sleep 20 @@ -105,4 +106,5 @@ jobs: print(f'Executing {f} in CI') ip.parent._exec_file(f)" + ${MAMBA_EXE} activate $HOME/${CONDA_ENV_NAME} ipython --profile=test -c "$command" From b2890458dd30af1e721f44ed320943d20e934fa7 Mon Sep 17 00:00:00 2001 From: Max Rakitin Date: Tue, 11 Feb 2025 17:28:14 -0500 Subject: [PATCH 02/37] CI: switch to conda --- .github/workflows/testing.yml | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 455d8ce..d97b46d 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -24,7 +24,7 @@ jobs: defaults: run: - shell: bash -l {0} + shell: bash -leo pipefail {0} steps: - name: Set env vars @@ -41,12 +41,18 @@ jobs: - name: Checkout the code uses: actions/checkout@v4 - - name: Setup umamba - uses: mamba-org/setup-micromamba@v1 + - 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: Setup umamba + # uses: mamba-org/setup-micromamba@v1 - name: Create a conda env from Zenodo run: | - set -vxeo pipefail url="https://zenodo.org/record/${{ matrix.zenodo-id }}/files/${CONDA_ENV_NAME}.tar.gz?download=1" wget --progress=dot:giga ${url} -O ${CONDA_ENV_NAME}.tar.gz status=$? @@ -58,7 +64,7 @@ jobs: md5sum --check checksum.txt mkdir -p $HOME/${CONDA_ENV_NAME} tar -xf ${CONDA_ENV_NAME}.tar.gz -C $HOME/${CONDA_ENV_NAME} - ${MAMBA_EXE} activate $HOME/${CONDA_ENV_NAME} + conda activate $HOME/${CONDA_ENV_NAME} conda-unpack - name: Start MongoDB @@ -66,13 +72,11 @@ jobs: - name: Prepare databroker config run: | - set -vxeuo pipefail mkdir -v -p $HOME/.config/databroker/ cp -v configs/databroker/local.yml $HOME/.config/databroker/ - name: Start epics-containers run: | - set -vxeuo pipefail git clone --depth 1 --branch CMS-IOCs https://github.com/NSLS2/cms-epics-containers.git ~/cms-epics-containers source ~/cms-epics-containers/environment.sh cd ~/cms-epics-containers @@ -81,9 +85,8 @@ jobs: - name: Start caproto IOC run: | - set -vxeuo pipefail source ~/cms-epics-containers/environment.sh - ${MAMBA_EXE} activate $HOME/${CONDA_ENV_NAME} + conda activate $HOME/${CONDA_ENV_NAME} echo "\n" | python iocs/spoof_beamline.py --list-pvs sleep 20 @@ -106,5 +109,5 @@ jobs: print(f'Executing {f} in CI') ip.parent._exec_file(f)" - ${MAMBA_EXE} activate $HOME/${CONDA_ENV_NAME} + conda activate $HOME/${CONDA_ENV_NAME} ipython --profile=test -c "$command" From c3e859fe0c686b4d96e62e5d927bc6ff328d6ab9 Mon Sep 17 00:00:00 2001 From: Max Rakitin Date: Tue, 11 Feb 2025 17:40:48 -0500 Subject: [PATCH 03/37] CI: add missing configs --- .ci/kafka-config.sh | 15 +++++++++++++++ .github/workflows/testing.yml | 16 ++++++++-------- 2 files changed, 23 insertions(+), 8 deletions(-) create mode 100755 .ci/kafka-config.sh diff --git a/.ci/kafka-config.sh b/.ci/kafka-config.sh new file mode 100755 index 0000000..e6e12b4 --- /dev/null +++ b/.ci/kafka-config.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# Kafka config: +cat << EOF > kafka.yml +--- +abort_run_on_kafka_exception: false +bootstrap_servers: + - localhost:9092 +runengine_producer_config: + security.protocol: PLAINTEXT +EOF + +sudo mkdir -v -p /etc/bluesky/ +sudo mv -v kafka.yml /etc/bluesky/kafka.yml # TODO: put it into the home directory via an env var +cat /etc/bluesky/kafka.yml \ No newline at end of file diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index d97b46d..6cadb1d 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -41,6 +41,14 @@ jobs: - name: Checkout the code uses: actions/checkout@v4 + - name: Prepare Tiled and Kafka configs + run: | + .ci/tiled-config.sh + .ci/kafka-config.sh + + - name: Start MongoDB + uses: supercharge/mongodb-github-action@1.6.0 + - uses: conda-incubator/setup-miniconda@v2 with: activate-environment: ${{ env.REPOSITORY_NAME }} @@ -67,14 +75,6 @@ jobs: conda activate $HOME/${CONDA_ENV_NAME} conda-unpack - - name: Start MongoDB - uses: supercharge/mongodb-github-action@1.6.0 - - - name: Prepare databroker config - run: | - mkdir -v -p $HOME/.config/databroker/ - cp -v configs/databroker/local.yml $HOME/.config/databroker/ - - name: Start epics-containers run: | git clone --depth 1 --branch CMS-IOCs https://github.com/NSLS2/cms-epics-containers.git ~/cms-epics-containers From ebf1e1bc7171bf7834de420a21c0e0b1cc17dbf0 Mon Sep 17 00:00:00 2001 From: Max Rakitin Date: Tue, 11 Feb 2025 18:05:03 -0500 Subject: [PATCH 04/37] CI: use mrakitin fork for epics-services with minor fixes --- .github/workflows/testing.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 6cadb1d..27e1458 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -77,7 +77,8 @@ jobs: - name: Start epics-containers run: | - git clone --depth 1 --branch CMS-IOCs https://github.com/NSLS2/cms-epics-containers.git ~/cms-epics-containers + # git clone --depth 1 --branch CMS-IOCs https://github.com/NSLS2/cms-epics-containers.git ~/cms-epics-containers + git clone --depth 1 --branch ci-gha-profile https://github.com/mrakitin/epics-containers-example-services.git ~/cms-epics-containers source ~/cms-epics-containers/environment.sh cd ~/cms-epics-containers docker-compose up -d @@ -92,7 +93,11 @@ jobs: - name: Test the code run: | - set -vxeuo pipefail + # Start Xvfb + # (from https://developercommunity.visualstudio.com/content/problem/336288/headless-testing-using-xvfb-on-hosted-ubuntu-1604.html) + /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1280x1024x16 + export DISPLAY=:99 + # This is what IPython does internally to load the startup files: command=" import os From bfbf41073a4f10476e52e45908c46c012fb124b4 Mon Sep 17 00:00:00 2001 From: Max Rakitin Date: Tue, 11 Feb 2025 18:13:26 -0500 Subject: [PATCH 05/37] CI: install docker-compose --- .github/workflows/testing.yml | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 27e1458..05cbb29 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -41,6 +41,20 @@ jobs: - name: Checkout the code uses: actions/checkout@v4 + - name: Install docker-compose + run: | + sudo apt-get update + sudo apt-get install docker-compose-plugin + + - name: Start epics-containers + run: | + # git clone --depth 1 --branch CMS-IOCs https://github.com/NSLS2/cms-epics-containers.git ~/cms-epics-containers + git clone --depth 1 --branch ci-gha-profile https://github.com/mrakitin/epics-containers-example-services.git ~/cms-epics-containers + source ~/cms-epics-containers/environment.sh + cd ~/cms-epics-containers + docker-compose up -d + sleep 20 + - name: Prepare Tiled and Kafka configs run: | .ci/tiled-config.sh @@ -71,19 +85,11 @@ jobs: echo "${{ matrix.md5-checksum }} ${CONDA_ENV_NAME}.tar.gz" > checksum.txt md5sum --check checksum.txt mkdir -p $HOME/${CONDA_ENV_NAME} + echo "Unarchiving the tarball..." tar -xf ${CONDA_ENV_NAME}.tar.gz -C $HOME/${CONDA_ENV_NAME} conda activate $HOME/${CONDA_ENV_NAME} conda-unpack - - name: Start epics-containers - run: | - # git clone --depth 1 --branch CMS-IOCs https://github.com/NSLS2/cms-epics-containers.git ~/cms-epics-containers - git clone --depth 1 --branch ci-gha-profile https://github.com/mrakitin/epics-containers-example-services.git ~/cms-epics-containers - source ~/cms-epics-containers/environment.sh - cd ~/cms-epics-containers - docker-compose up -d - sleep 20 - - name: Start caproto IOC run: | source ~/cms-epics-containers/environment.sh From bd7a9c44cca207b04390f7acc2caec9698a37997 Mon Sep 17 00:00:00 2001 From: Max Rakitin Date: Tue, 11 Feb 2025 18:16:46 -0500 Subject: [PATCH 06/37] CI: install docker-compose from GH release --- .github/workflows/testing.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 05cbb29..6d27f27 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -43,8 +43,9 @@ jobs: - name: Install docker-compose run: | - sudo apt-get update - sudo apt-get install docker-compose-plugin + sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose + sudo chmod +x /usr/local/bin/docker-compose + docker-compose --version - name: Start epics-containers run: | From dfc9184ad357732fa3d7e71b6711251ab339371e Mon Sep 17 00:00:00 2001 From: Max Rakitin Date: Tue, 11 Feb 2025 18:22:56 -0500 Subject: [PATCH 07/37] CI: send caproto process to background --- .github/workflows/testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 6d27f27..69a63df 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -95,7 +95,7 @@ jobs: run: | source ~/cms-epics-containers/environment.sh conda activate $HOME/${CONDA_ENV_NAME} - echo "\n" | python iocs/spoof_beamline.py --list-pvs + echo "\n" | python iocs/spoof_beamline.py --list-pvs & sleep 20 - name: Test the code From 795988d9d8f19c65f9743404622f1fbe14671f54 Mon Sep 17 00:00:00 2001 From: Max Rakitin Date: Tue, 11 Feb 2025 18:29:17 -0500 Subject: [PATCH 08/37] CI: source env vars for IPython profile startup --- .github/workflows/testing.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 69a63df..9f86917 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -122,4 +122,6 @@ jobs: ip.parent._exec_file(f)" conda activate $HOME/${CONDA_ENV_NAME} + + source ~/cms-epics-containers/environment.sh ipython --profile=test -c "$command" From 431aee7f9838a412f91608b3aeff134b26cf5baf Mon Sep 17 00:00:00 2001 From: Max Rakitin Date: Tue, 11 Feb 2025 18:45:11 -0500 Subject: [PATCH 09/37] CI: run beamline specific steps --- .ci/bl-specific.sh | 3 ++- .github/workflows/testing.yml | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) mode change 100644 => 100755 .ci/bl-specific.sh diff --git a/.ci/bl-specific.sh b/.ci/bl-specific.sh old mode 100644 new mode 100755 index f00b1ca..5dd1e25 --- a/.ci/bl-specific.sh +++ b/.ci/bl-specific.sh @@ -1,3 +1,4 @@ #!/bin/bash -# cp -v <...> ~/.ipython/profile_${TEST_PROFILE}/ +mkdir -v -p ~/.ipython/profile_test/startup/ +cp -v startup/.cms_config ~/.ipython/profile_test/startup/cms_config.py diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 9f86917..be0abb3 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -56,6 +56,10 @@ jobs: docker-compose up -d sleep 20 + - name: Run beamline-specific setup + run: | + .ci/bl-specific.sh + - name: Prepare Tiled and Kafka configs run: | .ci/tiled-config.sh From 2fb0e607fb5a1a501ab1f4ca67e9c2ff5f6d5332 Mon Sep 17 00:00:00 2001 From: Max Rakitin Date: Tue, 11 Feb 2025 18:51:31 -0500 Subject: [PATCH 10/37] CI: fix the config file name --- .ci/bl-specific.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/bl-specific.sh b/.ci/bl-specific.sh index 5dd1e25..d004b87 100755 --- a/.ci/bl-specific.sh +++ b/.ci/bl-specific.sh @@ -1,4 +1,4 @@ #!/bin/bash mkdir -v -p ~/.ipython/profile_test/startup/ -cp -v startup/.cms_config ~/.ipython/profile_test/startup/cms_config.py +cp -v startup/.cms_config ~/.ipython/profile_test/startup/ From 9ddf21a744eacb16a699f2d98b3c2f0cc35ce89e Mon Sep 17 00:00:00 2001 From: Max Rakitin Date: Wed, 12 Feb 2025 11:29:10 -0500 Subject: [PATCH 11/37] CI: configure beamline redis --- .ci/bl-specific.sh | 2 ++ .github/workflows/testing.yml | 3 +++ 2 files changed, 5 insertions(+) diff --git a/.ci/bl-specific.sh b/.ci/bl-specific.sh index d004b87..a3c6a35 100755 --- a/.ci/bl-specific.sh +++ b/.ci/bl-specific.sh @@ -1,4 +1,6 @@ #!/bin/bash +sudo echo "127.0.0.1 info.cms.nsls2.bnl.gov" >> /etc/hosts + mkdir -v -p ~/.ipython/profile_test/startup/ cp -v startup/.cms_config ~/.ipython/profile_test/startup/ diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index be0abb3..f8bdd49 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -65,6 +65,9 @@ jobs: .ci/tiled-config.sh .ci/kafka-config.sh + - name: Install Redis + uses: supercharge/redis-github-action@1.0.0 + - name: Start MongoDB uses: supercharge/mongodb-github-action@1.6.0 From 77a910847dbbc44ca4215e083eb353c2da86a947 Mon Sep 17 00:00:00 2001 From: Max Rakitin Date: Wed, 12 Feb 2025 11:51:53 -0500 Subject: [PATCH 12/37] CI: more diag checks of the redis address --- .ci/bl-specific.sh | 3 +++ .github/workflows/testing.yml | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.ci/bl-specific.sh b/.ci/bl-specific.sh index a3c6a35..46a893b 100755 --- a/.ci/bl-specific.sh +++ b/.ci/bl-specific.sh @@ -1,6 +1,9 @@ #!/bin/bash +set -veo pipefail + sudo echo "127.0.0.1 info.cms.nsls2.bnl.gov" >> /etc/hosts +cat /etc/hosts mkdir -v -p ~/.ipython/profile_test/startup/ cp -v startup/.cms_config ~/.ipython/profile_test/startup/ diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index f8bdd49..1800cc2 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -59,13 +59,16 @@ jobs: - name: Run beamline-specific setup run: | .ci/bl-specific.sh + sudo systemctl restart systemd-networkd + ping info.cms.nsls2.bnl.gov -t 5 + echo "" | telnet info.cms.nsls2.bnl.gov 6379 - name: Prepare Tiled and Kafka configs run: | .ci/tiled-config.sh .ci/kafka-config.sh - - name: Install Redis + - name: Start Redis uses: supercharge/redis-github-action@1.0.0 - name: Start MongoDB From 59a6b728f4ee018fa32822f2e34f423cb1a6eb98 Mon Sep 17 00:00:00 2001 From: Max Rakitin Date: Wed, 12 Feb 2025 11:58:24 -0500 Subject: [PATCH 13/37] CI: stop execution in scripts if there are failures --- .ci/bl-specific.sh | 7 ++++++- .ci/kafka-config.sh | 2 ++ .ci/tiled-config.sh | 2 ++ .github/workflows/testing.yml | 8 ++++++++ 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/.ci/bl-specific.sh b/.ci/bl-specific.sh index 46a893b..dcfdf31 100755 --- a/.ci/bl-specific.sh +++ b/.ci/bl-specific.sh @@ -2,8 +2,13 @@ set -veo pipefail -sudo echo "127.0.0.1 info.cms.nsls2.bnl.gov" >> /etc/hosts +# Per https://stackoverflow.com/a/66982842: +sudo echo "127.0.0.1 info.cms.nsls2.bnl.gov" | sudo tee -a /etc/hosts cat /etc/hosts +# Copy config files into the dummy IPython profile: mkdir -v -p ~/.ipython/profile_test/startup/ cp -v startup/.cms_config ~/.ipython/profile_test/startup/ + +# Create the /nsls2 dir tree: +mkdir -v -p /nsls2 diff --git a/.ci/kafka-config.sh b/.ci/kafka-config.sh index e6e12b4..92500ad 100755 --- a/.ci/kafka-config.sh +++ b/.ci/kafka-config.sh @@ -1,5 +1,7 @@ #!/bin/bash +set -veo pipefail + # Kafka config: cat << EOF > kafka.yml --- diff --git a/.ci/tiled-config.sh b/.ci/tiled-config.sh index 9277949..21f27bf 100755 --- a/.ci/tiled-config.sh +++ b/.ci/tiled-config.sh @@ -1,5 +1,7 @@ #!/bin/bash +set -veo pipefail + # Tiled profile config: tiled_profiles_dir="$HOME/.config/tiled/profiles/" diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 1800cc2..55ad797 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -74,6 +74,14 @@ jobs: - name: Start MongoDB uses: supercharge/mongodb-github-action@1.6.0 + - name: Check Docker state + run: | + docker images + docker ps -a + docker network ls + docker volume ls + + - uses: conda-incubator/setup-miniconda@v2 with: activate-environment: ${{ env.REPOSITORY_NAME }} From 9583bdc0784864ec8069fd2037708902b40c22ab Mon Sep 17 00:00:00 2001 From: Max Rakitin Date: Wed, 12 Feb 2025 12:01:02 -0500 Subject: [PATCH 14/37] CI: use sudo for making dirs --- .ci/bl-specific.sh | 3 ++- .github/workflows/testing.yml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.ci/bl-specific.sh b/.ci/bl-specific.sh index dcfdf31..48e3642 100755 --- a/.ci/bl-specific.sh +++ b/.ci/bl-specific.sh @@ -11,4 +11,5 @@ mkdir -v -p ~/.ipython/profile_test/startup/ cp -v startup/.cms_config ~/.ipython/profile_test/startup/ # Create the /nsls2 dir tree: -mkdir -v -p /nsls2 +sudo mkdir -v -p /nsls2 +sudo chown -R -v $USER: /nsls2 diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 55ad797..14cf902 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -59,7 +59,7 @@ jobs: - name: Run beamline-specific setup run: | .ci/bl-specific.sh - sudo systemctl restart systemd-networkd + # sudo systemctl restart systemd-networkd ping info.cms.nsls2.bnl.gov -t 5 echo "" | telnet info.cms.nsls2.bnl.gov 6379 From 93565fb073dee1948d7523c2071fda255c851d17 Mon Sep 17 00:00:00 2001 From: Max Rakitin Date: Wed, 12 Feb 2025 12:13:47 -0500 Subject: [PATCH 15/37] CI: non-blocking ping --- .github/workflows/testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 14cf902..79f50ca 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -60,7 +60,7 @@ jobs: run: | .ci/bl-specific.sh # sudo systemctl restart systemd-networkd - ping info.cms.nsls2.bnl.gov -t 5 + ping -c 5 info.cms.nsls2.bnl.gov echo "" | telnet info.cms.nsls2.bnl.gov 6379 - name: Prepare Tiled and Kafka configs From 736dcaa28f90a284470adf1cf056faf3707f0d59 Mon Sep 17 00:00:00 2001 From: Max Rakitin Date: Wed, 12 Feb 2025 12:24:22 -0500 Subject: [PATCH 16/37] CI: run redis addr diag after the service start --- .github/workflows/testing.yml | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 79f50ca..63bb10a 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -56,18 +56,6 @@ jobs: docker-compose up -d sleep 20 - - name: Run beamline-specific setup - run: | - .ci/bl-specific.sh - # sudo systemctl restart systemd-networkd - ping -c 5 info.cms.nsls2.bnl.gov - echo "" | telnet info.cms.nsls2.bnl.gov 6379 - - - name: Prepare Tiled and Kafka configs - run: | - .ci/tiled-config.sh - .ci/kafka-config.sh - - name: Start Redis uses: supercharge/redis-github-action@1.0.0 @@ -81,6 +69,17 @@ jobs: docker network ls docker volume ls + - name: Prepare Tiled and Kafka configs + run: | + .ci/tiled-config.sh + .ci/kafka-config.sh + + - name: Run beamline-specific setup + run: | + .ci/bl-specific.sh + # sudo systemctl restart systemd-networkd + ping -c 5 info.cms.nsls2.bnl.gov + echo "" | telnet info.cms.nsls2.bnl.gov 6379 - uses: conda-incubator/setup-miniconda@v2 with: From 1c9c115c1e47c3c64d45fffa72102afedb611be7 Mon Sep 17 00:00:00 2001 From: Max Rakitin Date: Wed, 12 Feb 2025 12:32:14 -0500 Subject: [PATCH 17/37] CI: more tests in `drop-in.py` --- .ci/drop-in.py | 10 +++++++++- .github/workflows/testing.yml | 4 ++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.ci/drop-in.py b/.ci/drop-in.py index d26eb14..06f6a2d 100644 --- a/.ci/drop-in.py +++ b/.ci/drop-in.py @@ -1,3 +1,5 @@ +import numpy as np + caput(beam.mono_bragg_pv, 1.03953) pilatus2M.tiff.create_directory.set(-20) sam = SampleGISAXS('test') @@ -5,4 +7,10 @@ pilatus2M.cam.num_images.put(1) -RE(bp.count([pilatus2M], num=3)) +uid, = RE(bp.count([pilatus2M], num=3)) + +hdr = db[uid] +print(hdr.table(fill=True)) + +data = np.array(list(hdr.data("pilatus2M_image"))) +print(f"{data = }\n{data.shape = }") diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 63bb10a..f804577 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -81,11 +81,11 @@ jobs: ping -c 5 info.cms.nsls2.bnl.gov echo "" | telnet info.cms.nsls2.bnl.gov 6379 - - uses: conda-incubator/setup-miniconda@v2 + - uses: conda-incubator/setup-miniconda@v3 with: activate-environment: ${{ env.REPOSITORY_NAME }} auto-update-conda: true - miniconda-version: "latest" + miniforge-version: latest python-version: ${{ matrix.python-version }} # - name: Setup umamba From 40d996dd1d61f0c4e4dae0cc71ba2f015a7c7bc6 Mon Sep 17 00:00:00 2001 From: Max Rakitin Date: Wed, 12 Feb 2025 14:10:43 -0500 Subject: [PATCH 18/37] CI: mount data directory where AD will write the data --- .ci/bl-specific.sh | 1 + .github/workflows/testing.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.ci/bl-specific.sh b/.ci/bl-specific.sh index 48e3642..1133e4c 100755 --- a/.ci/bl-specific.sh +++ b/.ci/bl-specific.sh @@ -13,3 +13,4 @@ cp -v startup/.cms_config ~/.ipython/profile_test/startup/ # Create the /nsls2 dir tree: sudo mkdir -v -p /nsls2 sudo chown -R -v $USER: /nsls2 +sudo ln -sv $HOME/cms-epics-containers/pilatus-data/ /nsls2/data/ diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index f804577..2552106 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -53,6 +53,7 @@ jobs: git clone --depth 1 --branch ci-gha-profile https://github.com/mrakitin/epics-containers-example-services.git ~/cms-epics-containers source ~/cms-epics-containers/environment.sh cd ~/cms-epics-containers + mkdir ./pilatus-data/ docker-compose up -d sleep 20 From e4e5d19cbf95f70d3b0c0ee96b5369cfdd37ed42 Mon Sep 17 00:00:00 2001 From: Max Rakitin Date: Wed, 12 Feb 2025 14:15:37 -0500 Subject: [PATCH 19/37] CI: fix the target for symlink for the detector data dir --- .ci/bl-specific.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/bl-specific.sh b/.ci/bl-specific.sh index 1133e4c..ec8d34c 100755 --- a/.ci/bl-specific.sh +++ b/.ci/bl-specific.sh @@ -13,4 +13,4 @@ cp -v startup/.cms_config ~/.ipython/profile_test/startup/ # Create the /nsls2 dir tree: sudo mkdir -v -p /nsls2 sudo chown -R -v $USER: /nsls2 -sudo ln -sv $HOME/cms-epics-containers/pilatus-data/ /nsls2/data/ +sudo ln -sv $HOME/cms-epics-containers/pilatus-data/ /nsls2/ From ec21fa18075a9b00674805a52d01a5acb2c07108 Mon Sep 17 00:00:00 2001 From: Max Rakitin Date: Wed, 12 Feb 2025 15:44:55 -0500 Subject: [PATCH 20/37] CI: check the dir tree with the saved files after triggering the detector --- .github/workflows/testing.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 2552106..48e80a9 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -143,3 +143,10 @@ jobs: source ~/cms-epics-containers/environment.sh ipython --profile=test -c "$command" + + - name: Check dir tree + if: always() + run: | + tree -a $HOME/cms-epics-containers/pilatus-data/ + tree -a /nsls2/ + ls -laF /nsls2/ From 64cedcac6f5f0427f30c1d309574930209d1371a Mon Sep 17 00:00:00 2001 From: Max Rakitin Date: Wed, 12 Feb 2025 15:55:42 -0500 Subject: [PATCH 21/37] CI: check dirs simpler --- .github/workflows/testing.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 48e80a9..13afbad 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -147,6 +147,6 @@ jobs: - name: Check dir tree if: always() run: | - tree -a $HOME/cms-epics-containers/pilatus-data/ - tree -a /nsls2/ ls -laF /nsls2/ + tree -a $HOME/cms-epics-containers/pilatus-data/ + # tree -a /nsls2/ From b58dc9d3a5c3396bbf8454c5193149840ae2127d Mon Sep 17 00:00:00 2001 From: Max Rakitin Date: Wed, 12 Feb 2025 17:58:29 -0500 Subject: [PATCH 22/37] CI: uncomment the check of /nsls2/ --- .github/workflows/testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 13afbad..1c1f750 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -149,4 +149,4 @@ jobs: run: | ls -laF /nsls2/ tree -a $HOME/cms-epics-containers/pilatus-data/ - # tree -a /nsls2/ + tree -a /nsls2/ From 94deb4a4ad77d2757accf228cf88128f777d2bbe Mon Sep 17 00:00:00 2001 From: Max Rakitin Date: Wed, 12 Feb 2025 18:11:04 -0500 Subject: [PATCH 23/37] CI: fix the symlink to /nsls/data/ --- .ci/bl-specific.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.ci/bl-specific.sh b/.ci/bl-specific.sh index ec8d34c..a5cae34 100755 --- a/.ci/bl-specific.sh +++ b/.ci/bl-specific.sh @@ -11,6 +11,6 @@ mkdir -v -p ~/.ipython/profile_test/startup/ cp -v startup/.cms_config ~/.ipython/profile_test/startup/ # Create the /nsls2 dir tree: -sudo mkdir -v -p /nsls2 -sudo chown -R -v $USER: /nsls2 -sudo ln -sv $HOME/cms-epics-containers/pilatus-data/ /nsls2/ +sudo mkdir -v -p /nsls2/ +sudo chown -R -v $USER: /nsls2/ +sudo ln -sv $HOME/cms-epics-containers/pilatus-data/data/ /nsls2/ From 0a21977a4c7dfc77209a1f028185ae16e071c411 Mon Sep 17 00:00:00 2001 From: Max Rakitin Date: Wed, 12 Feb 2025 18:19:29 -0500 Subject: [PATCH 24/37] CI: check `/nsls2/data/` contents --- .github/workflows/testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 1c1f750..1323d0b 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -149,4 +149,4 @@ jobs: run: | ls -laF /nsls2/ tree -a $HOME/cms-epics-containers/pilatus-data/ - tree -a /nsls2/ + tree -a /nsls2/data/ From 64d3d3b0110c711d8c74ebf6226b97b11fc6032f Mon Sep 17 00:00:00 2001 From: Max Rakitin Date: Wed, 12 Feb 2025 18:34:25 -0500 Subject: [PATCH 25/37] CI: `docker-compose` -> `docker compose`; install `xorg` pkgs --- .github/workflows/testing.yml | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 1323d0b..12bffd7 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -38,14 +38,27 @@ jobs: export CONDA_ENV_NAME="${{ matrix.conda-env-version }}-py${PYTHONVER}-tiled" echo "CONDA_ENV_NAME=${CONDA_ENV_NAME}" >> $GITHUB_ENV + - name: Install system packages + run: | + sudo apt-get update + sudo apt-get install -y xorg openbox + - name: Checkout the code uses: actions/checkout@v4 - - name: Install docker-compose + - name: Start docker service run: | - sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose - sudo chmod +x /usr/local/bin/docker-compose - docker-compose --version + sudo systemctl status docker + sudo systemctl start docker + sudo systemctl status docker + docker version + docker compose --version + + # - name: Install docker-compose + # run: | + # sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose + # sudo chmod +x /usr/local/bin/docker-compose + # docker-compose --version - name: Start epics-containers run: | @@ -54,7 +67,7 @@ jobs: source ~/cms-epics-containers/environment.sh cd ~/cms-epics-containers mkdir ./pilatus-data/ - docker-compose up -d + docker compose up -d sleep 20 - name: Start Redis @@ -78,7 +91,6 @@ jobs: - name: Run beamline-specific setup run: | .ci/bl-specific.sh - # sudo systemctl restart systemd-networkd ping -c 5 info.cms.nsls2.bnl.gov echo "" | telnet info.cms.nsls2.bnl.gov 6379 From 3f4dd6558048f4b3ea6f7a3de9a5be29955b6b3e Mon Sep 17 00:00:00 2001 From: Max Rakitin Date: Wed, 12 Feb 2025 22:18:21 -0500 Subject: [PATCH 26/37] CI: more complex matrix --- .github/workflows/testing.yml | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 12bffd7..f0f490d 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -14,10 +14,17 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - conda-env-version: ["2024-3.0"] - zenodo-id: ["14019710"] - md5-checksum: ["0ec1899a4f5989292e07380f96b97498"] - python-version: ["3.10"] # , "3.11", "3.12"] + zenodo-deposition: + # https://zenodo.org/records/14019710 + - env-version: "2024-3.0" + zenodo-id: "14019710" + artifact: + - python-version: "3.10" + md5-checksum: "0ec1899a4f5989292e07380f96b97498" + - python-version: "3.11" + md5-checksum: "016b041ce78a13b1c4b65ef73fa9f85d" + - python-version: "3.12" + md5-checksum: "29f6bef5fcad82bbdb896a81275e0478" fail-fast: false env: TZ: America/New_York @@ -32,10 +39,10 @@ jobs: export REPOSITORY_NAME=${GITHUB_REPOSITORY#*/} # just the repo, as opposed to org/repo echo "REPOSITORY_NAME=${REPOSITORY_NAME}" >> $GITHUB_ENV - export PYTHONVER=$(echo ${{ matrix.python-version }} | sed 's/\.//g') + export PYTHONVER=$(echo ${{ matrix.artifact.python-version }} | sed 's/\.//g') echo "PYTHONVER=${PYTHONVER}" >> $GITHUB_ENV - export CONDA_ENV_NAME="${{ matrix.conda-env-version }}-py${PYTHONVER}-tiled" + export CONDA_ENV_NAME="${{ matrix.zenodo-deposition.env-version }}-py${PYTHONVER}-tiled" echo "CONDA_ENV_NAME=${CONDA_ENV_NAME}" >> $GITHUB_ENV - name: Install system packages @@ -54,12 +61,6 @@ jobs: docker version docker compose --version - # - name: Install docker-compose - # run: | - # sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose - # sudo chmod +x /usr/local/bin/docker-compose - # docker-compose --version - - name: Start epics-containers run: | # git clone --depth 1 --branch CMS-IOCs https://github.com/NSLS2/cms-epics-containers.git ~/cms-epics-containers @@ -99,21 +100,19 @@ jobs: activate-environment: ${{ env.REPOSITORY_NAME }} auto-update-conda: true miniforge-version: latest - python-version: ${{ matrix.python-version }} - - # - name: Setup umamba - # uses: mamba-org/setup-micromamba@v1 + python-version: ${{ matrix.artifact.python-version }} + conda-remove-defaults: true - name: Create a conda env from Zenodo run: | - url="https://zenodo.org/record/${{ matrix.zenodo-id }}/files/${CONDA_ENV_NAME}.tar.gz?download=1" + url="https://zenodo.org/record/${{ matrix.zenodo-deposition.zenodo-id }}/files/${CONDA_ENV_NAME}.tar.gz?download=1" wget --progress=dot:giga ${url} -O ${CONDA_ENV_NAME}.tar.gz status=$? if [ $status -gt 0 ]; then echo "Cannot download from ${url}. Exit code: ${status}" exit $status fi - echo "${{ matrix.md5-checksum }} ${CONDA_ENV_NAME}.tar.gz" > checksum.txt + echo "${{ matrix.artifact.md5-checksum }} ${CONDA_ENV_NAME}.tar.gz" > checksum.txt md5sum --check checksum.txt mkdir -p $HOME/${CONDA_ENV_NAME} echo "Unarchiving the tarball..." From fb4978d7b9c08931870ec586a3e912e3e19f22ca Mon Sep 17 00:00:00 2001 From: Max Rakitin Date: Wed, 12 Feb 2025 22:40:48 -0500 Subject: [PATCH 27/37] CI: hardcode the python version to 3.10 in the base conda env --- .github/workflows/testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index f0f490d..e6bd55f 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -100,7 +100,7 @@ jobs: activate-environment: ${{ env.REPOSITORY_NAME }} auto-update-conda: true miniforge-version: latest - python-version: ${{ matrix.artifact.python-version }} + python-version: "3.10" conda-remove-defaults: true - name: Create a conda env from Zenodo From b4f02d2d1c4051a8124d80473db67b0ace972dbd Mon Sep 17 00:00:00 2001 From: Max Rakitin Date: Wed, 12 Feb 2025 22:45:37 -0500 Subject: [PATCH 28/37] CI: check bluesky logs after execution --- .github/workflows/testing.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index e6bd55f..ed83f04 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -155,6 +155,11 @@ jobs: source ~/cms-epics-containers/environment.sh ipython --profile=test -c "$command" + - name: Show bluesky logs + if: always() + run: | + cat $HOME/.cache/bluesky/log/bluesky.log + - name: Check dir tree if: always() run: | From 2b5e968218e86001af2b51ba5298357760e75d26 Mon Sep 17 00:00:00 2001 From: Max Rakitin Date: Wed, 12 Feb 2025 23:07:51 -0500 Subject: [PATCH 29/37] CI: use 2025-1.0 conda envs (fixed pyolog / configparser) --- .github/workflows/testing.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index ed83f04..aac5f4a 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -15,16 +15,16 @@ jobs: strategy: matrix: zenodo-deposition: - # https://zenodo.org/records/14019710 - - env-version: "2024-3.0" - zenodo-id: "14019710" + # https://zenodo.org/records/14862443 + - env-version: "2025-1.0" + zenodo-id: "14862443" artifact: - python-version: "3.10" - md5-checksum: "0ec1899a4f5989292e07380f96b97498" + md5-checksum: "d031ed24ad7beebb836f93712d8def2e" - python-version: "3.11" - md5-checksum: "016b041ce78a13b1c4b65ef73fa9f85d" + md5-checksum: "3b1074c0827ee3baf0cdcd64917b9afa" - python-version: "3.12" - md5-checksum: "29f6bef5fcad82bbdb896a81275e0478" + md5-checksum: "624239ed0846ef95d8334ea100581b83" fail-fast: false env: TZ: America/New_York From 18ff2a63b59d481c57875f044c7e1c99f8641821 Mon Sep 17 00:00:00 2001 From: Max Rakitin Date: Wed, 12 Feb 2025 23:26:01 -0500 Subject: [PATCH 30/37] CI: do not start docker systemd unit - it should be running already --- .github/workflows/testing.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index aac5f4a..a8acde7 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -55,9 +55,9 @@ jobs: - name: Start docker service run: | - sudo systemctl status docker - sudo systemctl start docker - sudo systemctl status docker + # sudo systemctl status docker + # sudo systemctl start docker + # sudo systemctl status docker docker version docker compose --version From 846b4b6fb990dc5c3b6134e7b260e53922771479 Mon Sep 17 00:00:00 2001 From: Max Rakitin Date: Thu, 13 Feb 2025 00:46:01 -0500 Subject: [PATCH 31/37] CI: move some configuration into scripts --- .ci/bl-specific.sh | 8 ++++-- .ci/kafka-config.sh | 6 ++--- .github/workflows/testing.yml | 51 ++++++++++++++++++----------------- 3 files changed, 36 insertions(+), 29 deletions(-) diff --git a/.ci/bl-specific.sh b/.ci/bl-specific.sh index a5cae34..71fe435 100755 --- a/.ci/bl-specific.sh +++ b/.ci/bl-specific.sh @@ -6,11 +6,15 @@ set -veo pipefail sudo echo "127.0.0.1 info.cms.nsls2.bnl.gov" | sudo tee -a /etc/hosts cat /etc/hosts +ping -c 5 info.cms.nsls2.bnl.gov +echo "" | telnet info.cms.nsls2.bnl.gov 6379 + # Copy config files into the dummy IPython profile: mkdir -v -p ~/.ipython/profile_test/startup/ cp -v startup/.cms_config ~/.ipython/profile_test/startup/ -# Create the /nsls2 dir tree: +# Create pilatus and /nsls2 dir trees: sudo mkdir -v -p /nsls2/ sudo chown -R -v $USER: /nsls2/ -sudo ln -sv $HOME/cms-epics-containers/pilatus-data/data/ /nsls2/ +mkdir -v -p $HOME/cms-epics-containers/pilatus-data/data/ +ln -sv $HOME/cms-epics-containers/pilatus-data/data/ /nsls2/ diff --git a/.ci/kafka-config.sh b/.ci/kafka-config.sh index 92500ad..baf11fb 100755 --- a/.ci/kafka-config.sh +++ b/.ci/kafka-config.sh @@ -12,6 +12,6 @@ runengine_producer_config: security.protocol: PLAINTEXT EOF -sudo mkdir -v -p /etc/bluesky/ -sudo mv -v kafka.yml /etc/bluesky/kafka.yml # TODO: put it into the home directory via an env var -cat /etc/bluesky/kafka.yml \ No newline at end of file +mkdir -v -p $HOME/.config/bluesky/ +mv -v kafka.yml $HOME/.config/bluesky/kafka.yml +cat $HOME/.config/bluesky/kafka.yml diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index a8acde7..a927948 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -45,29 +45,43 @@ jobs: export CONDA_ENV_NAME="${{ matrix.zenodo-deposition.env-version }}-py${PYTHONVER}-tiled" echo "CONDA_ENV_NAME=${CONDA_ENV_NAME}" >> $GITHUB_ENV + export BLUESKY_KAFKA_CONFIG_PATH="$HOME/.config/bluesky/kafka.yml" + echo "BLUESKY_KAFKA_CONFIG_PATH=${BLUESKY_KAFKA_CONFIG_PATH}" >> $GITHUB_ENV + - name: Install system packages run: | sudo apt-get update sudo apt-get install -y xorg openbox + - name: Check Docker version + run: | + docker version + docker compose --version + - name: Checkout the code uses: actions/checkout@v4 - - name: Start docker service + - name: Configure epics-containers run: | - # sudo systemctl status docker - # sudo systemctl start docker - # sudo systemctl status docker - docker version - docker compose --version + # git clone --depth 1 --branch CMS-IOCs https://github.com/NSLS2/cms-epics-containers.git $HOME/cms-epics-containers + git clone --depth 1 --branch ci-gha-profile https://github.com/mrakitin/epics-containers-example-services.git $HOME/cms-epics-containers + + source $HOME/cms-epics-containers/environment.sh + echo "EPICS_CA_ADDR_LIST=${EPICS_CA_ADDR_LIST}" >> $GITHUB_ENV + echo "EPICS_CA_AUTO_ADDR_LIST=${EPICS_CA_AUTO_ADDR_LIST}" >> $GITHUB_ENV + + - name: Prepare Tiled and Kafka configs + run: | + .ci/tiled-config.sh + .ci/kafka-config.sh + + - name: Run beamline-specific setup + run: | + .ci/bl-specific.sh - name: Start epics-containers run: | - # git clone --depth 1 --branch CMS-IOCs https://github.com/NSLS2/cms-epics-containers.git ~/cms-epics-containers - git clone --depth 1 --branch ci-gha-profile https://github.com/mrakitin/epics-containers-example-services.git ~/cms-epics-containers - source ~/cms-epics-containers/environment.sh - cd ~/cms-epics-containers - mkdir ./pilatus-data/ + cd $HOME/cms-epics-containers docker compose up -d sleep 20 @@ -84,17 +98,6 @@ jobs: docker network ls docker volume ls - - name: Prepare Tiled and Kafka configs - run: | - .ci/tiled-config.sh - .ci/kafka-config.sh - - - name: Run beamline-specific setup - run: | - .ci/bl-specific.sh - ping -c 5 info.cms.nsls2.bnl.gov - echo "" | telnet info.cms.nsls2.bnl.gov 6379 - - uses: conda-incubator/setup-miniconda@v3 with: activate-environment: ${{ env.REPOSITORY_NAME }} @@ -122,7 +125,7 @@ jobs: - name: Start caproto IOC run: | - source ~/cms-epics-containers/environment.sh + # source $HOME/cms-epics-containers/environment.sh conda activate $HOME/${CONDA_ENV_NAME} echo "\n" | python iocs/spoof_beamline.py --list-pvs & sleep 20 @@ -152,7 +155,7 @@ jobs: conda activate $HOME/${CONDA_ENV_NAME} - source ~/cms-epics-containers/environment.sh + # source $HOME/cms-epics-containers/environment.sh ipython --profile=test -c "$command" - name: Show bluesky logs From e599dd9f8456c32989ecc3207b70ab44c8a808e6 Mon Sep 17 00:00:00 2001 From: Max Rakitin Date: Thu, 13 Feb 2025 00:50:42 -0500 Subject: [PATCH 32/37] CI: start docker-based services earlier --- .github/workflows/testing.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index a927948..da43efd 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -58,6 +58,12 @@ jobs: docker version docker compose --version + - name: Start Redis + uses: supercharge/redis-github-action@1.0.0 + + - name: Start MongoDB + uses: supercharge/mongodb-github-action@1.6.0 + - name: Checkout the code uses: actions/checkout@v4 @@ -85,12 +91,6 @@ jobs: docker compose up -d sleep 20 - - name: Start Redis - uses: supercharge/redis-github-action@1.0.0 - - - name: Start MongoDB - uses: supercharge/mongodb-github-action@1.6.0 - - name: Check Docker state run: | docker images From a6c4467208ba3546474cf0d88919f2afb76959a3 Mon Sep 17 00:00:00 2001 From: Max Rakitin Date: Thu, 13 Feb 2025 01:00:52 -0500 Subject: [PATCH 33/37] CI: update EPICS auto env var --- .github/workflows/testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index da43efd..b301263 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -74,7 +74,7 @@ jobs: source $HOME/cms-epics-containers/environment.sh echo "EPICS_CA_ADDR_LIST=${EPICS_CA_ADDR_LIST}" >> $GITHUB_ENV - echo "EPICS_CA_AUTO_ADDR_LIST=${EPICS_CA_AUTO_ADDR_LIST}" >> $GITHUB_ENV + echo "EPICS_CA_AUTO_ADDR_LIST=NO" >> $GITHUB_ENV - name: Prepare Tiled and Kafka configs run: | From 152fd4b17e15e1f292564953bc25b4e427c7be73 Mon Sep 17 00:00:00 2001 From: Max Rakitin Date: Thu, 13 Feb 2025 11:25:10 -0500 Subject: [PATCH 34/37] CI: check if EPICS vars got propagated --- .github/workflows/testing.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index b301263..b07ac86 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -156,6 +156,7 @@ jobs: conda activate $HOME/${CONDA_ENV_NAME} # source $HOME/cms-epics-containers/environment.sh + env | grep EPICS ipython --profile=test -c "$command" - name: Show bluesky logs From 5824ffaf7c35adb8b09434d27a293cf17a9b9c7f Mon Sep 17 00:00:00 2001 From: Max Rakitin Date: Thu, 13 Feb 2025 11:45:05 -0500 Subject: [PATCH 35/37] CI: add env var for `DISPLAY` as well --- .github/workflows/testing.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index b07ac86..bbd1922 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -75,6 +75,7 @@ jobs: source $HOME/cms-epics-containers/environment.sh echo "EPICS_CA_ADDR_LIST=${EPICS_CA_ADDR_LIST}" >> $GITHUB_ENV echo "EPICS_CA_AUTO_ADDR_LIST=NO" >> $GITHUB_ENV + echo "DISPLAY=${DISPLAY}" >> $GITHUB_ENV - name: Prepare Tiled and Kafka configs run: | @@ -98,6 +99,11 @@ jobs: docker network ls docker volume ls + - name: Check Docker logs + run: | + cd $HOME/cms-epics-containers + docker compose logs + - uses: conda-incubator/setup-miniconda@v3 with: activate-environment: ${{ env.REPOSITORY_NAME }} From b62158224601017ef72d8592cf996a194d3ba286 Mon Sep 17 00:00:00 2001 From: Max Rakitin Date: Thu, 13 Feb 2025 12:39:28 -0500 Subject: [PATCH 36/37] CI: run source command on every step involving EPICS --- .github/workflows/testing.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index bbd1922..b3beaf6 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -89,6 +89,7 @@ jobs: - name: Start epics-containers run: | cd $HOME/cms-epics-containers + source $HOME/cms-epics-containers/environment.sh docker compose up -d sleep 20 @@ -131,7 +132,7 @@ jobs: - name: Start caproto IOC run: | - # source $HOME/cms-epics-containers/environment.sh + source $HOME/cms-epics-containers/environment.sh conda activate $HOME/${CONDA_ENV_NAME} echo "\n" | python iocs/spoof_beamline.py --list-pvs & sleep 20 @@ -161,7 +162,7 @@ jobs: conda activate $HOME/${CONDA_ENV_NAME} - # source $HOME/cms-epics-containers/environment.sh + source $HOME/cms-epics-containers/environment.sh env | grep EPICS ipython --profile=test -c "$command" From 1fddb5497d8388563d29f5de861bdcda32654675 Mon Sep 17 00:00:00 2001 From: Max Rakitin Date: Thu, 13 Feb 2025 12:52:51 -0500 Subject: [PATCH 37/37] CI: do not add EPICS env vars to GITHUB_ENV --- .github/workflows/testing.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index b3beaf6..06f83de 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -72,10 +72,8 @@ jobs: # git clone --depth 1 --branch CMS-IOCs https://github.com/NSLS2/cms-epics-containers.git $HOME/cms-epics-containers git clone --depth 1 --branch ci-gha-profile https://github.com/mrakitin/epics-containers-example-services.git $HOME/cms-epics-containers - source $HOME/cms-epics-containers/environment.sh - echo "EPICS_CA_ADDR_LIST=${EPICS_CA_ADDR_LIST}" >> $GITHUB_ENV - echo "EPICS_CA_AUTO_ADDR_LIST=NO" >> $GITHUB_ENV - echo "DISPLAY=${DISPLAY}" >> $GITHUB_ENV + # source $HOME/cms-epics-containers/environment.sh + # echo "EPICS_CA_ADDR_LIST=${EPICS_CA_ADDR_LIST}" >> $GITHUB_ENV - name: Prepare Tiled and Kafka configs run: |