diff --git a/.github/workflows/buiild.yml b/.github/workflows/buiild.yml index 5a922db..23d861a 100644 --- a/.github/workflows/buiild.yml +++ b/.github/workflows/buiild.yml @@ -49,3 +49,32 @@ jobs: PUSH: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }} CACHE: ${{ env.CACHE }} run: .github/workflows/build.sh + + - name: Upload schema as artifact + uses: actions/upload-artifact@v3 + with: + name: ioc-schema + path: ./*.ibek.ioc.schema.json + + release: + # Release on tag push - publish ioc schema + needs: [build-push-images] + if: ${{ github.event_name == 'push' && github.ref_type == 'tag' }} + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - uses: actions/download-artifact@v3 + with: + name: ioc-schema + path: ./ + zip: false + + - name: Github Release + uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v0.1.15 + with: + files: | + ./*.ibek.ioc.schema.json + generate_release_notes: true diff --git a/.github/workflows/build.sh b/.github/workflows/build.sh index e7e90c8..700521c 100755 --- a/.github/workflows/build.sh +++ b/.github/workflows/build.sh @@ -92,3 +92,12 @@ do_build ${ARCH} runtime ${cachefrom} ${cacheto} # remove old cache to avoid indefinite growth rm -rf ${CACHE} mv ${NEWCACHE} ${CACHE} + +# get the schema file from the developer container +id=$(docker create ${REGISTRY}/${REPOSITORY}-${ARCH}-developer:${TAG}) +# convention for schema name is module.ibek.ioc.schema.json +# we get this my removing the ioc- prefix from the module name +SCHEMA=$(basename ${REPOSITORY} | sed 's/^ioc-//').ibek.ioc.schema.json +docker cp $id:/epics/ioc/${SCHEMA} . +docker rm -v $id + diff --git a/.gitignore b/.gitignore index bb84bf7..6ae7439 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ .history repos* +# build pulls the schema out of the container - ignore it +*.ibek.ioc.schema.json diff --git a/.gitmodules b/.gitmodules index a68fb7f..1933b7a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -2,3 +2,6 @@ [submodule "ibek-defs"] path = ibek-defs url = git@github.com:epics-containers/ibek-defs.git +[submodule "ibek-support"] + path = ibek-support + url = git@github.com:epics-containers/ibek-support.git diff --git a/Dockerfile b/Dockerfile index d37fcee..c168c4d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,71 +1,41 @@ ##### build stage ############################################################## ARG TARGET_ARCHITECTURE -ARG BASE=23.3.1 - -FROM ghcr.io/epics-containers/epics-base-${TARGET_ARCHITECTURE}-developer:${BASE} AS developer - -RUN apt-get update && apt-get upgrade -y && \ - apt-get install -y --no-install-recommends \ - libboost-all-dev \ - libxext-dev \ - libglib2.0-dev \ - libusb-1.0 \ - libxml2-dev \ - libx11-dev \ - meson \ - intltool \ - pkg-config \ - xz-utils - -# build aravis library -RUN cd /usr/local && \ - git clone -b ARAVIS_0_8_1 --depth 1 https://github.com/AravisProject/aravis && \ - cd aravis && \ - meson build && \ - cd build && \ - ninja && \ - ninja install && \ - rm -fr /usr/local/aravis \ - echo /usr/local/lib64 > /etc/ld.so.conf.d/usr.conf && \ - ldconfig - -COPY ctools /ctools/ -RUN pip install ibek==0.9.5.b2 telnetlib3 +ARG BASE=7.0.7ec1 +ARG REGISTRY=ghcr.io/epics-containers + +FROM ${REGISTRY}/epics-base-${TARGET_ARCHITECTURE}-developer:${BASE} AS developer + +# In a devcontainer this folder is mounted on the host's clone of ioc-adsimdetector +WORKDIR /workspaces/ioc-adsimdetector/ibek-support + # copy the global ibek files -COPY ibek-defs/_global /ctools/_global/ +COPY ibek-support/_global/ _global -COPY ibek-defs/asyn/ /ctools/asyn/ -RUN python3 modules.py install ASYN R4-42 github.com/epics-modules/asyn.git --patch asyn/asyn.sh -RUN make -C ${SUPPORT}/asyn -j $(nproc) +COPY ibek-support/iocStats/ iocStats +RUN iocStats/install.sh 3.1.16 -COPY ibek-defs/autosave/ /ctools/autosave/ -RUN python3 modules.py install AUTOSAVE R5-10-2 github.com/epics-modules/autosave.git --patch autosave/autosave.sh -RUN make -C ${SUPPORT}/autosave -j $(nproc) +COPY ibek-support/asyn/ asyn/ +RUN asyn/install.sh R4-42 -COPY ibek-defs/busy/ /ctools/busy -RUN python3 modules.py install BUSY R1-7-3 github.com/epics-modules/busy.git -RUN make -C ${SUPPORT}/busy -j $(nproc) +COPY ibek-support/autosave/ autosave/ +RUN autosave/install.sh R5-10-2 -COPY ibek-defs/adsupport/ /ctools/adsupport/ -RUN python3 modules.py install ADSUPPORT R1-10 github.com/areaDetector/adsupport.git --patch adsupport/adsupport.sh -RUN make -C ${SUPPORT}/adsupport -j $(nproc) +COPY ibek-support/busy/ busy/ +RUN busy/install.sh R1-7-3 -COPY ibek-defs/adcore/ /ctools/adcore/ -RUN python3 modules.py install ADCORE R3-12-1 github.com/areaDetector/adcore.git --patch adcore/adcore.sh -RUN make -C ${SUPPORT}/adcore -j $(nproc) +COPY ibek-support/ADCore/ ADCore/ +RUN ADCore/install.sh R3-12-1 -COPY ibek-defs/adaravis/ /ctools/adaravis/ -RUN python3 modules.py install ADGENICAM R1-8 github.com/areaDetector/adgenicam.git --patch adaravis/adaravis.sh -RUN make -C ${SUPPORT}/adgenicam -j $(nproc) +COPY ibek-support/ADSimDetector/ ADSimDetector/ +RUN ADSimDetector/install.sh R2-10 -RUN python3 modules.py install ADARAVIS R2-2-1 github.com/areaDetector/adaravis.git --patch adaravis/adaravis.sh -RUN make -C ${SUPPORT}/adaravis -j $(nproc) +# Make the IOC +RUN ibek ioc generate-makefile +RUN ibek ioc compile -# add the generic IOC source code. TODO: this will be generated by ibek in future -COPY ioc ${IOC} -# build generic IOC -RUN make -C ${IOC} && make clean -C ${IOC} +# create a schema file for the IOC +RUN bash -c "ibek ioc generate-schema */*ibek.support.yaml --output ${IOC}/adaravis.ibek.ioc.schema.json" ##### runtime preparation stage ################################################ @@ -73,24 +43,21 @@ FROM developer AS runtime_prep # get the products from the build stage and reduce to runtime assets only WORKDIR /min_files -RUN bash /ctools/minimize.sh ${IOC} $(ls -d ${SUPPORT}/*/) /ctools +RUN bash /epics/scripts/minimize.sh ${IOC} $(ls -d ${SUPPORT}/*/) ##### runtime stage ############################################################ -FROM ghcr.io/epics-containers/epics-base-${TARGET_ARCHITECTURE}-runtime:${BASE} AS runtime - -RUN apt-get update && apt-get upgrade -y && \ - apt-get install -y --no-install-recommends \ - libglib2.0-bin \ - libusb-1.0 \ - libxml2 \ - && rm -rf /var/lib/apt/lists/* +FROM ${REGISTRY}/epics-base-${TARGET_ARCHITECTURE}-runtime:${BASE} AS runtime +# get the virtual environment from the developer stage +COPY --from=developer /venv /venv # add products from build stage COPY --from=runtime_prep /min_files / -COPY --from=developer /venv /venv -# add ioc scripts +# install runtime system dependencies, collected from install.sh scripts +RUN ibek support apt-install --runtime + +# add ioc sample startup scripts COPY ioc ${IOC} ENV TARGET_ARCHITECTURE ${TARGET_ARCHITECTURE} diff --git a/build b/build index fe29d62..5986570 100755 --- a/build +++ b/build @@ -1,7 +1,13 @@ #!/bin/bash +set -xe + THIS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +ioc_name=$(basename ${THIS_DIR}) +# schema name drops the ioc- prefix +schema_prefix=${ioc_name##*-} + # a script to locally build all targets containers for this IOC # Note this requires the ec command form # https://github.com/epics-containers/epics-containers-cli @@ -10,3 +16,7 @@ cd ${THIS_DIR} ec dev build --arch linux #ec dev build --arch rtems + +id=$(podman create ghcr.io/epics-containers/${ioc_name}-linux-developer:local) +podman cp $id:/epics/ioc/${schema_prefix}.ibek.ioc.schema.json . +podman rm -v $id diff --git a/ibek-defs b/ibek-defs deleted file mode 160000 index 3fb7493..0000000 --- a/ibek-defs +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 3fb74938a2ed9060b57df8b16e3d9f3c3a4aed8f diff --git a/ibek-support b/ibek-support new file mode 160000 index 0000000..2c323eb --- /dev/null +++ b/ibek-support @@ -0,0 +1 @@ +Subproject commit 2c323eb5134946c02622f5f2b9a61eb3886f51a8