Z3fdb/climate dt on lumi databridge #10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build Z3FDB Web Service Container | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - develop | |
| pull_request: | |
| env: | |
| REGISTRY: eccr.ecmwf.int | |
| IMAGE_NAME: z3fdb-web-service | |
| PROJECT_NAME: kkratz | |
| jobs: | |
| build-packages: | |
| name: Build Packages | |
| runs-on: [self-hosted, Linux, platform-builder-docker] | |
| container: | |
| image: eccr.ecmwf.int/ci-utils/ubuntu_rolling_fdb_build_env:latest | |
| credentials: | |
| username: ${{ secrets.ECMWF_DOCKER_REGISTRY_USERNAME }} | |
| password: ${{ secrets.ECMWF_DOCKER_REGISTRY_ACCESS_TOKEN }} | |
| steps: | |
| - name: Get ecbuild | |
| uses: actions/checkout@v5 | |
| with: | |
| repository: ecmwf/ecbuild | |
| ref: develop | |
| path: ecbuild | |
| - name: Get cxx-dependencies | |
| uses: actions/checkout@v5 | |
| with: | |
| repository: ecmwf/cxx-dependencies | |
| ref: master | |
| path: cxx-dependencies-src | |
| token: ${{ secrets.GH_REPO_READ_TOKEN }} | |
| submodules: recursive | |
| - name: Install dependencies | |
| run: | | |
| mkdir cxx-dependencies-build | |
| BUILD_PATH=cxx-dependencies-build INSTALL_PREFIX=dependencies cxx-dependencies-src/build.sh | |
| - name: Get eccodes | |
| uses: actions/checkout@v5 | |
| with: | |
| repository: ecmwf/eccodes | |
| ref: develop | |
| path: eccodes-src | |
| - name: Install eccodes | |
| run: | | |
| mkdir eccodes-build | |
| cmake \ | |
| -B eccodes-build \ | |
| -S eccodes-src \ | |
| -GNinja \ | |
| -DCMAKE_INSTALL_PREFIX=dependencies \ | |
| -DCMAKE_PREFIX_PATH=dependencies \ | |
| -DCMAKE_BUILD_TYPE=RelWithDebInfo \ | |
| -DENABLE_MEMFS=ON \ | |
| -DENABLE_AEC=ON | |
| cmake --build eccodes-build -j -t install | |
| - name: Get eckit | |
| uses: actions/checkout@v5 | |
| with: | |
| repository: ecmwf/eckit | |
| ref: develop | |
| path: eckit-src | |
| - name: Install eckit | |
| run: | | |
| mkdir eckit-build | |
| cmake \ | |
| -B eckit-build \ | |
| -S eckit-src \ | |
| -GNinja \ | |
| -DCMAKE_INSTALL_PREFIX=dependencies \ | |
| -DCMAKE_PREFIX_PATH=dependencies \ | |
| -DCMAKE_BUILD_TYPE=RelWithDebInfo | |
| cmake --build eckit-build -j -t install | |
| - name: Get metkit | |
| uses: actions/checkout@v5 | |
| with: | |
| repository: ecmwf/metkit | |
| ref: develop | |
| path: metkit-src | |
| - name: Install Metkit | |
| run: | | |
| mkdir metkit-build | |
| cmake \ | |
| -B metkit-build \ | |
| -S metkit-src \ | |
| -GNinja \ | |
| -DCMAKE_INSTALL_PREFIX=dependencies \ | |
| -DCMAKE_PREFIX_PATH=dependencies \ | |
| -DCMAKE_BUILD_TYPE=RelWithDebInfo | |
| cmake --build metkit-build -j -t install | |
| - name: Get fdb5 | |
| uses: actions/checkout@v5 | |
| with: | |
| repository: ecmwf/fdb | |
| path: fdb-src | |
| - name: Build Fdb | |
| run: | | |
| export PATH=$(pwd)/dependencies/bin:$PATH | |
| mkdir fdb-build | |
| cmake \ | |
| -B fdb-build \ | |
| -S fdb-src \ | |
| -GNinja \ | |
| -DCMAKE_INSTALL_PREFIX=dependencies \ | |
| -DCMAKE_PREFIX_PATH=dependencies \ | |
| -DCMAKE_BUILD_TYPE=RelWithDebInfo \ | |
| -DENABLE_TOOLS=ON \ | |
| -DENABLE_PYTHON_ZARR_INTERFACE=ON | |
| cmake --build fdb-build -j | |
| cd fdb-build | |
| ctest -j $(nproc) --output-on-failure | |
| - name: Run Z3fdb Wheel Installation Test | |
| run: | | |
| pip install $(ls ./fdb-build/z3fdb*.whl) | |
| FDB5_HOME=fdb-build python -c "import z3fdb" | |
| - name: Package minimal FDB | |
| run: | | |
| mkdir -p stage-fdb-minimal/fdb/lib | |
| cp fdb-build/lib/libmetkit.so \ | |
| fdb-build/lib/libfdb5.so \ | |
| fdb-build/lib/libeckit_option.so \ | |
| fdb-build/lib/libeccodes.so \ | |
| fdb-build/lib/libeckit.so \ | |
| fdb-build/lib/libeccodes_memfs.so \ | |
| dependencies/lib/libaec.so* \ | |
| stage-fdb-minimal/fdb/lib | |
| tar --zstd -cvf fdb.tar.zst -C stage-fdb-minimal/ fdb | |
| - name: Create z3fdb-web-service whl | |
| run: | | |
| python -m build --wheel fdb-source/tools/z3fdb-web-service -o . | |
| - name: Assemble staging | |
| run: | | |
| mkdir -p stage | |
| cp *.whl fdb.tar.zst stage | |
| - name: Upload stage archive | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: stage | |
| path: stage/ | |
| build-container: | |
| name: Build Image | |
| runs-on: [self-hosted, Linux, platform-builder-docker] | |
| needs: [build-packages] | |
| steps: | |
| - name: Download stage archive | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: stage | |
| path: stage/ | |
| - name: Log in to ECCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ secrets.KKRATZ_ECCR_USER }} | |
| password: ${{ secrets.KKRATZ_ECCR_TOKEN }} | |
| - name: Extract metadata (tags, labels) | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.PROJECT_NAME }}/${{ env.IMAGE_NAME }} | |
| tags: | | |
| type=sha | |
| type=raw,value=latest,enable={{is_default_branch}} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: ./stage | |
| file: ./containerfiles/z3fdb_web_service/Dockerfile | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} |