Skip to content

Commit

Permalink
Merge branch 'origin152_pullBoptestImage' into origin149_fixStartTime…
Browse files Browse the repository at this point in the history
…Examples2
  • Loading branch information
javiarrobas committed Sep 20, 2024
2 parents 9d34aec + d6920cd commit f904e58
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 44 deletions.
22 changes: 6 additions & 16 deletions .github/workflows/github-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,8 @@ jobs:
uses: actions/checkout@v3
- name: Pull boptestgym image from registry
run: make pull-boptestgym
- run: echo "The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- name: List of files in the repository
run: |
ls ${{ github.workspace }}
- name: Set up Docker
uses: docker/setup-buildx-action@v2
- name: Pull boptest_base image from registry
run: make pull-boptestbase
- name: Install Docker Compose
run: |
sudo apt-get update
Expand All @@ -38,12 +34,8 @@ jobs:
uses: actions/checkout@v3
- name: Pull boptestgym image from registry
run: make pull-boptestgym
- run: echo "The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- name: List of files in the repository
run: |
ls ${{ github.workspace }}
- name: Set up Docker
uses: docker/setup-buildx-action@v2
- name: Pull boptest_base image from registry
run: make pull-boptestbase
- name: Install Docker Compose
run: |
sudo apt-get update
Expand All @@ -60,10 +52,8 @@ jobs:
uses: actions/checkout@v3
- name: Pull boptestgym image from registry
run: make pull-boptestgym
- run: echo "The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- name: List of files in the repository
run: |
ls ${{ github.workspace }}
- name: Pull boptest_base image from registry
run: make pull-boptestbase
- name: Test service version
run: make test-service-in-container

73 changes: 45 additions & 28 deletions testing/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,91 +2,108 @@
ROOT ?= $(shell dirname \
$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))))

# Local image name and home
IMG_NAME=boptestgym
IMG_HOME=/home/developer/boptestgym
# Local image name, home directory, and remote registry for BOPTEST-Gym
IMG_NAME_BOPTESTGYM=boptestgym
IMG_HOME_BOPTESTGYM=/home/developer/boptestgym
IMG_REGI_BOPTESTGYM=javierarroyo/boptestgym

# Name of remote registry image
IMG_REGI=javierarroyo/boptestgym
# Local image name and remote registry for the BOPTEST test case
IMG_NAME_BOPTESTBASE=boptest_base
IMG_REGI_BOPTESTBASE=javierarroyo/boptest_base

# BOPTEST commit used for the tests
BOPTEST_COMMIT=78665506a620fc07bc2a8f301661aef3dd6c88c2

# Define current BOPTEST-Gym version (should be even with BOPTEST version defined in commit above)
VERSION = 0.6.0
VERSION = 0.6.0-dev

build-boptestgym:
docker build -f ${ROOT}/testing/Dockerfile \
--progress=plain --rm -t ${IMG_NAME} .
--progress=plain --rm -t ${IMG_NAME_BOPTESTGYM} .

build-boptestgym-no-cache:
docker build -f ${ROOT}/testing/Dockerfile \
--progress=plain --no-cache --rm -t ${IMG_NAME} .

--progress=plain --no-cache --rm -t ${IMG_NAME_BOPTESTGYM} .

# Build the generic BOPTEST base image without mounting any test case
build-boptestbase:
make download-boptest
cd project1-boptest-${BOPTEST_COMMIT} && \
docker compose build

run-boptestgym:
docker run \
--name ${IMG_NAME} \
--name ${IMG_NAME_BOPTESTGYM} \
--detach=false \
--network=host \
--rm \
--user $(id -u):$(id -g) \
-v ${ROOT}:${IMG_HOME}:rw \
-w ${IMG_HOME}/testing \
-v ${ROOT}:${IMG_HOME_BOPTESTGYM}:rw \
-w ${IMG_HOME_BOPTESTGYM}/testing \
-it \
${IMG_NAME}
${IMG_NAME_BOPTESTGYM}

run-boptestgym-detached:
docker run \
--name ${IMG_NAME} \
--name ${IMG_NAME_BOPTESTGYM} \
--detach=true \
--network=host \
--rm \
--user $(id -u):$(id -g) \
-v ${ROOT}:${IMG_HOME}:rw \
-w ${IMG_HOME}/testing \
-v ${ROOT}:${IMG_HOME_BOPTESTGYM}:rw \
-w ${IMG_HOME_BOPTESTGYM}/testing \
-it \
${IMG_NAME}
${IMG_NAME_BOPTESTGYM}

stop-boptestgym:
docker stop ${IMG_NAME}
docker stop ${IMG_NAME_BOPTESTGYM}

exec-boptestgym:
docker exec \
-i \
${IMG_NAME} \
${IMG_NAME_BOPTESTGYM} \
/bin/bash -c "${ARGS} && exit"

push-boptestgym:
# requires `docker login` first
docker tag ${IMG_NAME} ${IMG_REGI}:${VERSION}
docker push ${IMG_REGI}:${VERSION}
docker tag ${IMG_NAME_BOPTESTGYM} ${IMG_REGI_BOPTESTGYM}:${VERSION}
docker push ${IMG_REGI_BOPTESTGYM}:${VERSION}

pull-boptestgym:
docker pull ${IMG_REGI}:${VERSION}
docker tag ${IMG_REGI}:${VERSION} ${IMG_NAME}
docker pull ${IMG_REGI_BOPTESTGYM}:${VERSION}
docker tag ${IMG_REGI_BOPTESTGYM}:${VERSION} ${IMG_NAME_BOPTESTGYM}

push-boptestbase:
# requires `docker login` first
docker tag ${IMG_NAME_BOPTESTBASE} ${IMG_REGI_BOPTESTBASE}:${VERSION}
docker push ${IMG_REGI_BOPTESTBASE}:${VERSION}

pull-boptestbase:
docker pull ${IMG_REGI_BOPTESTBASE}:${VERSION}
docker tag ${IMG_REGI_BOPTESTBASE}:${VERSION} ${IMG_NAME_BOPTESTBASE}

make download-boptest:
download-boptest:
curl -L -o boptest.zip https://github.com/ibpsa/project1-boptest/archive/${BOPTEST_COMMIT}.zip
unzip -o -q boptest.zip

run-boptest-case:
make download-boptest
cd project1-boptest-${BOPTEST_COMMIT} && \
TESTCASE=bestest_hydronic_heat_pump docker-compose up -d --quiet-pull
TESTCASE=bestest_hydronic_heat_pump docker compose up -d

run-boptest-case-no-cache:
make download-boptest
cd project1-boptest-${BOPTEST_COMMIT} && \
TESTCASE=bestest_hydronic_heat_pump docker-compose up -d --force-recreate --build
TESTCASE=bestest_hydronic_heat_pump docker compose up -d --force-recreate --build

run-boptest-vectorized:
make download-boptest && \
cd .. && python3 generateDockerComposeYml.py testing/project1-boptest-${BOPTEST_COMMIT} && \
cd testing/project1-boptest-${BOPTEST_COMMIT} && \
TESTCASE=bestest_hydronic_heat_pump docker-compose up -d --quiet-pull
TESTCASE=bestest_hydronic_heat_pump docker compose up -d

stop-boptest-case:
cd project1-boptest-${BOPTEST_COMMIT} && docker-compose down
cd project1-boptest-${BOPTEST_COMMIT} && docker compose down

cleanup-boptest:
rm boptest.zip
Expand Down

0 comments on commit f904e58

Please sign in to comment.