From d90b80b809fae3164d5625b0287c194f4d5ec5bb Mon Sep 17 00:00:00 2001 From: Max Rakitin Date: Sat, 21 Oct 2023 12:48:55 -0400 Subject: [PATCH 1/4] CI: update workflow triggers (schedule for docs; better handling of releases) --- .github/workflows/docs.yml | 12 ++++++++++-- .github/workflows/publish-pypi.yml | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index f74514e..ea7b6d9 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -4,8 +4,16 @@ on: push: pull_request: workflow_dispatch: + inputs: + deploy: + description: 'Deploy documentation' + type: boolean + required: true + default: false + schedule: + - cron: '00 4 * * *' # daily at 4AM release: - types: [created] + types: [created, published, released] jobs: build_docs: @@ -100,7 +108,7 @@ jobs: - name: Deploy documentation to nsls-ii.github.io # if: github.repository_owner == 'NSLS-II' && github.ref_name == 'main' - if: github.event_name == 'release' + if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.deploy) # We pin to the SHA, not the tag, for security reasons. # https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/security-hardening-for-github-actions#using-third-party-actions uses: peaceiris/actions-gh-pages@bbdfb200618d235585ad98e965f4aafc39b4c501 # v3.7.3 diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index 007955e..86719b5 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -7,7 +7,7 @@ name: PyPI upload on: release: - types: [created] + types: [created, published, released] jobs: publish_pypi: From 720594e6821721c8ad4ec7f379112be81615bb40 Mon Sep 17 00:00:00 2001 From: Max Rakitin Date: Sat, 21 Oct 2023 12:49:30 -0400 Subject: [PATCH 2/4] CI: use port 8001 for Sirepo in the action --- .github/workflows/docs.yml | 5 ++++- .github/workflows/testing.yml | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index ea7b6d9..768a681 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -48,9 +48,12 @@ jobs: uses: supercharge/mongodb-github-action@1.6.0 - name: Start Sirepo Docker container - uses: NSLS-II/start-sirepo-action@v2 + uses: mrakitin/start-sirepo-action@add-port-parameter with: docker-binary: ${{ env.DOCKER_BINARY }} + sirepo-bluesky-branch: configurable-sirepo-port + sirepo-bluesky-repo: mrakitin/sirepo-bluesky + sirepo-port: 8001 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index bd0dab1..ee589b6 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -40,9 +40,12 @@ jobs: uses: supercharge/mongodb-github-action@1.6.0 - name: Start Sirepo Docker container - uses: NSLS-II/start-sirepo-action@v2 + uses: mrakitin/start-sirepo-action@add-port-parameter with: docker-binary: ${{ env.DOCKER_BINARY }} + sirepo-bluesky-branch: configurable-sirepo-port + sirepo-bluesky-repo: mrakitin/sirepo-bluesky + sirepo-port: 8001 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 From fbb75dea0c8df954d66ec8bf844aa8ae5a4347e3 Mon Sep 17 00:00:00 2001 From: Max Rakitin Date: Sat, 21 Oct 2023 12:50:09 -0400 Subject: [PATCH 3/4] MNT: enable port parameter in the Sirepo startup script --- scripts/start_sirepo.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/start_sirepo.sh b/scripts/start_sirepo.sh index b4a432a..b460456 100644 --- a/scripts/start_sirepo.sh +++ b/scripts/start_sirepo.sh @@ -25,6 +25,7 @@ SIREPO_SRDB_HOST="${SIREPO_SRDB_HOST:-}" SIREPO_SRDB_HOST_RO="${SIREPO_SRDB_HOST_RO:-}" SIREPO_SRDB_GUEST="${SIREPO_SRDB_GUEST:-}" SIREPO_SRDB_ROOT="${SIREPO_SRDB_ROOT:-'/sirepo'}" +SIREPO_PORT="${SIREPO_PORT:-'8000'}" unset cmd _cmd docker_image SIREPO_DOCKER_CONTAINER_ID @@ -79,8 +80,8 @@ cmd_start="${docker_binary} run ${arg} --init ${remove_container} --name sirepo -e SIREPO_SRDB_ROOT=${SIREPO_SRDB_ROOT} \ -e SIREPO_COOKIE_IS_SECURE=false \ -e SIREPO_FEATURE_CONFIG_REACT_SIM_TYPES='' \ - -p 8000:8000 \ - -v $SIREPO_SRDB_HOST_RO:/SIREPO_SRDB_ROOT:ro,z " + -p ${SIREPO_PORT}:8000 \ + -v ${SIREPO_SRDB_HOST_RO}:/SIREPO_SRDB_ROOT:ro,z " cmd_extra="" if [ ! -z "${SIREPO_SRDB_HOST}" -a ! -z "${SIREPO_SRDB_GUEST}" ]; then From b40ec837cd7aed2b84f5f4dff16ae4a2845a836a Mon Sep 17 00:00:00 2001 From: Max Rakitin Date: Sat, 21 Oct 2023 12:50:34 -0400 Subject: [PATCH 4/4] MNT: use port 8001 in the tests and docs --- docs/source/notebooks/madx.ipynb | 2 +- docs/source/notebooks/shadow.ipynb | 4 ++-- docs/source/notebooks/srw.ipynb | 6 +++--- sirepo_bluesky/tests/conftest.py | 22 +++++++++++----------- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/docs/source/notebooks/madx.ipynb b/docs/source/notebooks/madx.ipynb index 24ca93d..4869a46 100644 --- a/docs/source/notebooks/madx.ipynb +++ b/docs/source/notebooks/madx.ipynb @@ -34,7 +34,7 @@ "from sirepo_bluesky.madx_flyer import MADXFlyer\n", "from sirepo_bluesky.sirepo_ophyd import create_classes\n", "\n", - "connection = SirepoBluesky(\"http://localhost:8000\")\n", + "connection = SirepoBluesky(\"http://localhost:8001\")\n", "\n", "data, schema = connection.auth(\"madx\", \"00000002\")\n", "classes, objects = create_classes(\n", diff --git a/docs/source/notebooks/shadow.ipynb b/docs/source/notebooks/shadow.ipynb index ec9ef62..033911a 100644 --- a/docs/source/notebooks/shadow.ipynb +++ b/docs/source/notebooks/shadow.ipynb @@ -43,7 +43,7 @@ "from sirepo_bluesky.sirepo_bluesky import SirepoBluesky\n", "from sirepo_bluesky.sirepo_ophyd import BeamStatisticsReport, create_classes\n", "\n", - "connection = SirepoBluesky(\"http://localhost:8000\")\n", + "connection = SirepoBluesky(\"http://localhost:8001\")\n", "\n", "data, schema = connection.auth(\"shadow\", sim_id=\"00000002\")\n", "classes, objects = create_classes(connection=connection)\n", @@ -113,7 +113,7 @@ "from sirepo_bluesky.sirepo_bluesky import SirepoBluesky\n", "from sirepo_bluesky.sirepo_ophyd import BeamStatisticsReport, create_classes\n", "\n", - "connection = SirepoBluesky(\"http://localhost:8000\")\n", + "connection = SirepoBluesky(\"http://localhost:8001\")\n", "\n", "data, schema = connection.auth(\"shadow\", sim_id=\"00000002\")\n", "\n", diff --git a/docs/source/notebooks/srw.ipynb b/docs/source/notebooks/srw.ipynb index 237e225..1c7ff9d 100644 --- a/docs/source/notebooks/srw.ipynb +++ b/docs/source/notebooks/srw.ipynb @@ -43,7 +43,7 @@ "from sirepo_bluesky.sirepo_bluesky import SirepoBluesky\n", "from sirepo_bluesky.sirepo_ophyd import create_classes\n", "\n", - "connection = SirepoBluesky(\"http://localhost:8000\")\n", + "connection = SirepoBluesky(\"http://localhost:8001\")\n", "\n", "data, schema = connection.auth(\"srw\", sim_id=\"00000002\")\n", "classes, objects = create_classes(connection=connection)\n", @@ -112,7 +112,7 @@ "from sirepo_bluesky.sirepo_bluesky import SirepoBluesky\n", "from sirepo_bluesky.sirepo_ophyd import create_classes\n", "\n", - "connection = SirepoBluesky(\"http://localhost:8000\")\n", + "connection = SirepoBluesky(\"http://localhost:8001\")\n", "\n", "data, schema = connection.auth(\"srw\", sim_id=\"00000002\")\n", "classes, objects = create_classes(connection=connection)\n", @@ -195,7 +195,7 @@ "from sirepo_bluesky.sirepo_bluesky import SirepoBluesky\n", "from sirepo_bluesky.sirepo_ophyd import create_classes\n", "\n", - "connection = SirepoBluesky(\"http://localhost:8000\")\n", + "connection = SirepoBluesky(\"http://localhost:8001\")\n", "\n", "data, schema = connection.auth(\"srw\", sim_id=\"00000003\")\n", "classes, objects = create_classes(\n", diff --git a/sirepo_bluesky/tests/conftest.py b/sirepo_bluesky/tests/conftest.py index 995f3b5..14f47c3 100644 --- a/sirepo_bluesky/tests/conftest.py +++ b/sirepo_bluesky/tests/conftest.py @@ -67,76 +67,76 @@ def make_dirs(): @pytest.fixture(scope="function") def srw_empty_simulation(make_dirs): - connection = SirepoBluesky("http://localhost:8000") + connection = SirepoBluesky("http://localhost:8001") data, _ = connection.auth("srw", "emptysim") return connection @pytest.fixture(scope="function") def srw_youngs_double_slit_simulation(make_dirs): - connection = SirepoBluesky("http://localhost:8000") + connection = SirepoBluesky("http://localhost:8001") data, _ = connection.auth("srw", "00000000") return connection @pytest.fixture(scope="function") def srw_basic_simulation(make_dirs): - connection = SirepoBluesky("http://localhost:8000") + connection = SirepoBluesky("http://localhost:8001") data, _ = connection.auth("srw", "00000001") return connection @pytest.fixture(scope="function") def srw_tes_simulation(make_dirs): - connection = SirepoBluesky("http://localhost:8000") + connection = SirepoBluesky("http://localhost:8001") data, _ = connection.auth("srw", "00000002") return connection @pytest.fixture(scope="function") def srw_ari_simulation(make_dirs): - connection = SirepoBluesky("http://localhost:8000") + connection = SirepoBluesky("http://localhost:8001") data, _ = connection.auth("srw", "00000003") return connection @pytest.fixture(scope="function") def srw_chx_simulation(make_dirs): - connection = SirepoBluesky("http://localhost:8000") + connection = SirepoBluesky("http://localhost:8001") data, _ = connection.auth("srw", "HXV1JQ5c") return connection @pytest.fixture(scope="function") def shadow_basic_simulation(make_dirs): - connection = SirepoBluesky("http://localhost:8000") + connection = SirepoBluesky("http://localhost:8001") data, _ = connection.auth("shadow", "00000001") return connection @pytest.fixture(scope="function") def shadow_tes_simulation(make_dirs): - connection = SirepoBluesky("http://localhost:8000") + connection = SirepoBluesky("http://localhost:8001") data, _ = connection.auth("shadow", "00000002") return connection @pytest.fixture(scope="function") def madx_resr_storage_ring_simulation(make_dirs): - connection = SirepoBluesky("http://localhost:8000") + connection = SirepoBluesky("http://localhost:8001") data, _ = connection.auth("madx", "00000000") return connection @pytest.fixture(scope="function") def madx_bl1_compton_simulation(make_dirs): - connection = SirepoBluesky("http://localhost:8000") + connection = SirepoBluesky("http://localhost:8001") data, _ = connection.auth("madx", "00000001") return connection @pytest.fixture(scope="function") def madx_bl2_triplet_tdc_simulation(make_dirs): - connection = SirepoBluesky("http://localhost:8000") + connection = SirepoBluesky("http://localhost:8001") data, _ = connection.auth("madx", "00000002") return connection