Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: CI #45

Merged
merged 9 commits into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 44 additions & 44 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,50 +10,50 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.9]
python-version: [3.12]
fail-fast: false

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
# These packages are installed in the base environment but may be older
# versions. Explicitly upgrade them because they often create
# installation problems if out of date.
python -m pip install --upgrade pip setuptools numpy

pip install .
pip install -r requirements-dev.txt
pip install -r requirements-agents.txt
pip list

- name: Build Docs
run: |
make -C docs/ html

- name: Set env.REPOSITORY_NAME # just the repo, as opposed to org/repo
run: echo "REPOSITORY_NAME=${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV

- name: Upload built docs as artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ env.REPOSITORY_NAME }}-docs
path: docs/build/html

- name: Deploy documentation to blueskyproject.io.
if: github.repository_owner == 'bluesky' && github.ref_name == 'main'
# 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
with:
deploy_key: ${{ secrets.ACTIONS_DOCUMENTATION_DEPLOY_KEY }}
publish_branch: master
publish_dir: ./docs/build/html
external_repository: bluesky/bluesky.github.io
destination_dir: ${{ env.REPOSITORY_NAME }} # just the repo name, without the "bluesky/"
keep_files: true # Keep old files.
force_orphan: false # Keep git history.
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
# These packages are installed in the base environment but may be older
# versions. Explicitly upgrade them because they often create
# installation problems if out of date.
python -m pip install --upgrade pip setuptools numpy

pip install .
pip install -r requirements-dev.txt
pip install -r requirements-agents.txt
pip list

- name: Build Docs
run: |
make -C docs/ html

- name: Set env.REPOSITORY_NAME # just the repo, as opposed to org/repo
run: echo "REPOSITORY_NAME=${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV

- name: Upload built docs as artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ env.REPOSITORY_NAME }}-docs
path: docs/build/html

- name: Deploy documentation to blueskyproject.io.
if: github.repository_owner == 'bluesky' && github.ref_name == 'main'
# 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
with:
deploy_key: ${{ secrets.ACTIONS_DOCUMENTATION_DEPLOY_KEY }}
publish_branch: master
publish_dir: ./docs/build/html
external_repository: bluesky/bluesky.github.io
destination_dir: ${{ env.REPOSITORY_NAME }} # just the repo name, without the "bluesky/"
keep_files: true # Keep old files.
force_orphan: false # Keep git history.
146 changes: 75 additions & 71 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,85 +7,89 @@ on:
- main
workflow_dispatch:
schedule:
- cron: '0 0 * * 0' # weekly
- cron: "0 0 * * 0" # weekly

jobs:
unit-tests:
runs-on: ubuntu-latest

strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]

fail-fast: false
fail-fast: false

steps:
- uses: actions/checkout@v4

- name: Download and build bluesky-pods
run: |
docker pull ghcr.io/bluesky/bluesky-pods-bluesky:main
docker tag ghcr.io/bluesky/bluesky-pods-bluesky:main bluesky:latest

- name: Start Bluesky containers
run: |
pushd bluesky_adaptive/tests/podman
docker-compose up -d
popd

- name: Log which containers are running
run: docker ps -a

- name: Check container status and fetch logs if any failed
run: |
failed_containers=()
while read -r container; do
status=$(docker inspect --format='{{.State.Status}}' "$container")
if [ "$status" != "running" ]; then
echo "::error ::Container $container has status $status"
failed_containers+=("$container")
- uses: actions/checkout@v4

- name: Install Docker Compose
run: |
sudo apt-get update
sudo apt-get install -y docker-compose

- name: Download and build bluesky-pods
run: |
docker pull ghcr.io/bluesky/bluesky-pods-bluesky:main
docker tag ghcr.io/bluesky/bluesky-pods-bluesky:main bluesky:latest

- name: Start Bluesky containers
run: |
pushd bluesky_adaptive/tests/podman
docker-compose up -d
popd

- name: Log which containers are running
run: docker ps -a

- name: Check container status and fetch logs if any failed
run: |
failed_containers=()
while read -r container; do
status=$(docker inspect --format='{{.State.Status}}' "$container")
if [ "$status" != "running" ]; then
echo "::error ::Container $container has status $status"
failed_containers+=("$container")
fi
done < <(docker ps -aq)

for container in "${failed_containers[@]}"; do
echo "Logs for $container:"
docker logs "$container"
done

if [ ${#failed_containers[@]} -ne 0 ]; then
echo "::error ::Some containers failed to start"
docker ps -a
exit 1
fi
done < <(docker ps -aq)

for container in "${failed_containers[@]}"; do
echo "Logs for $container:"
docker logs "$container"
done

if [ ${#failed_containers[@]} -ne 0 ]; then
echo "::error ::Some containers failed to start"
docker ps -a
exit 1
fi

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install
shell: bash -l {0}
run: |
set -vxeuo pipefail
pip install --upgrade pip wheel
pip install .
pip install -r requirements-dev.txt
pip install -r requirements-agents.txt
mkdir -p /home/runner/.config/tiled/profiles
cp ./bluesky_adaptive/tests/podman/tiled_client_config.yml /home/runner/.config/tiled/profiles/tiled_client_config.yml
pip list

- name: Reload Permissions for QServer (Ensures plans are available)
shell: bash -l {0}
run: |
set -vxeuo pipefail
qserver environment open
qserver permissions reload

- name: Test with pytest
shell: bash -l {0}
run: |
set -vxeuo pipefail
coverage run -m pytest -v
coverage report

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install
shell: bash -l {0}
run: |
set -vxeuo pipefail
pip install --upgrade pip wheel
pip install .
pip install -r requirements-dev.txt
pip install -r requirements-agents.txt
mkdir -p /home/runner/.config/tiled/profiles
cp ./bluesky_adaptive/tests/podman/tiled_client_config.yml /home/runner/.config/tiled/profiles/tiled_client_config.yml
pip list

- name: Reload Permissions for QServer (Ensures plans are available)
shell: bash -l {0}
run: |
set -vxeuo pipefail
qserver environment open
qserver permissions reload

- name: Test with pytest
shell: bash -l {0}
run: |
set -vxeuo pipefail
coverage run -m pytest -v
coverage report
10 changes: 6 additions & 4 deletions bluesky_adaptive/tests/test_botorch_agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,10 @@ def test_remodel_from_report(catalog):
partial_acq_function=lambda gp: UpperConfidenceBound(gp, beta=1.5),
)
acqf, gp = new_agent.remodel_from_report(catalog[agent_uid])
assert (
gp.get_parameter("covar_module.base_kernel.raw_lengthscale")
== agent.surrogate_model.get_parameter("covar_module.base_kernel.raw_lengthscale")
).all()
try:
param = gp.get_parameter("covar_module.base_kernel.raw_lengthscale")
assert (param == agent.surrogate_model.get_parameter("covar_module.base_kernel.raw_lengthscale")).all()
except AttributeError:
param = gp.get_parameter("covar_module.raw_lengthscale")
assert (param == agent.surrogate_model.get_parameter("covar_module.raw_lengthscale")).all()
assert acqf.beta == 0.1
2 changes: 1 addition & 1 deletion bluesky_adaptive/tests/test_communication.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""""Testing the communication patterns of Bluesky Adatptive Async Agents"""
"""Testing the communication patterns of Bluesky Adaptive Async Agents"""

from typing import Sequence, Tuple, Union

Expand Down
4 changes: 3 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ tiled[client]
numpy
pydantic

databroker @ git+https://github.com/bluesky/databroker.git@v2.0.0b41#egg=databroker
databroker @ git+https://github.com/bluesky/databroker.git@v2.0.0b56#egg=databroker
bluesky-tiled-plugins
json-rpc
Loading