WIP #1826
Workflow file for this run
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-and-test | |
| on: [push] | |
| permissions: | |
| contents: read | |
| pull-requests: read | |
| env: | |
| REGISTRY_HANAMI_IMAGE: kitsudaiki/hanami | |
| REGISTRY_DOCS_IMAGE: kitsudaiki/openhanami_docs | |
| HANAMI_ADMIN_ID: asdf | |
| HANAMI_ADMIN_NAME: asdf | |
| HANAMI_ADMIN_PASSPHRASE: asdfasdf | |
| jobs: | |
| clang-format-check: | |
| name: "Check clang-format" | |
| runs-on: ubuntu-latest | |
| env: | |
| FORCE_COLOR: 1 | |
| steps: | |
| - | |
| uses: earthly/actions-setup@43211c7a0eae5344d6d79fb4aaf209c8f8866203 | |
| with: | |
| version: v0.8.0 | |
| - | |
| uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 | |
| - | |
| name: Run check | |
| run: earthly --ci +clang-format | |
| cpp-check: | |
| name: "Run cpp-check" | |
| runs-on: ubuntu-latest | |
| env: | |
| FORCE_COLOR: 1 | |
| steps: | |
| - | |
| uses: earthly/actions-setup@43211c7a0eae5344d6d79fb4aaf209c8f8866203 | |
| with: | |
| version: v0.8.0 | |
| - | |
| uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 | |
| - | |
| name: Run check | |
| run: earthly --ci +cppcheck | |
| # ansible-lint: | |
| # name: "Lint ansible playbook" | |
| # runs-on: ubuntu-latest | |
| # env: | |
| # FORCE_COLOR: 1 | |
| # steps: | |
| # - uses: earthly/actions-setup@43211c7a0eae5344d6d79fb4aaf209c8f8866203 | |
| # with: | |
| # version: v0.8.0 | |
| # - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 | |
| # - | |
| # name: Run check | |
| # run: earthly --ci +ansible-lint | |
| flake8-check: | |
| name: "flake8 check" | |
| runs-on: ubuntu-latest | |
| env: | |
| FORCE_COLOR: 1 | |
| steps: | |
| - | |
| uses: earthly/actions-setup@43211c7a0eae5344d6d79fb4aaf209c8f8866203 | |
| with: | |
| version: v0.8.0 | |
| - | |
| uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 | |
| - | |
| name: Run check | |
| run: earthly --ci +flake8 | |
| check-for-executables: | |
| name: "Detect binary executables" | |
| runs-on: ubuntu-latest | |
| steps: | |
| - | |
| name: checkout code | |
| uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 | |
| - | |
| name: Run binary files check script | |
| run: | | |
| git ls-tree -r HEAD --name-only | while read filename; do | |
| # Check if the file is a binary | |
| if [[ $(file -b --mime-encoding "$filename") == binary ]] && file -b "$filename" | grep -q "executable"; then | |
| echo "Binary file found: $filename" | |
| exit 1 | |
| fi | |
| done | |
| exit 0 | |
| commit-lint: | |
| name: "Lint commits" | |
| runs-on: ubuntu-latest | |
| steps: | |
| - | |
| name: checkout code | |
| uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 | |
| - | |
| name: lint commits | |
| uses: wagoid/commitlint-github-action@7f0a61df502599e1f1f50880aaa7ec1e2c0592f2 | |
| detect-sectets: | |
| name: "Detect secrets" | |
| runs-on: ubuntu-latest | |
| env: | |
| FORCE_COLOR: 1 | |
| steps: | |
| - | |
| uses: earthly/actions-setup@43211c7a0eae5344d6d79fb4aaf209c8f8866203 | |
| with: | |
| version: v0.8.0 | |
| - | |
| uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 | |
| - | |
| name: Run check | |
| run: earthly --ci +secret-scan | |
| build_python_package: | |
| name: "Build SDK python-package" | |
| needs: [ cpp-check, clang-format-check, flake8-check, check-for-executables, commit-lint, detect-sectets ] | |
| runs-on: ubuntu-latest | |
| env: | |
| FORCE_COLOR: 1 | |
| steps: | |
| - | |
| name: Set helm-version as environment variable | |
| run: | | |
| if [[ ${GITHUB_REF#} == refs/tags/* ]]; then \ | |
| echo "PYTHON_PACKAGE_VERSION=$(echo ${GITHUB_REF#refs/tags/} | sed 's/^v//')" | sed 's#/#\-#' >> $GITHUB_ENV; \ | |
| else \ | |
| echo "PYTHON_PACKAGE_VERSION=0.0.0" | sed 's#/#\-#' >> $GITHUB_ENV; \ | |
| fi | |
| - | |
| name: Checkout repository | |
| run: | | |
| # use manually clone, because with the "actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332" action the name of the | |
| # branch can not be read by the git commands, which is necessary for the build-script | |
| git clone https://github.com/kitsudaiki/${GITHUB_REPOSITORY#*/}.git | |
| cd ${GITHUB_REPOSITORY#*/} | |
| git checkout ${GITHUB_REF#refs/heads/} | |
| - | |
| name: Install dependencies for SDK | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y protobuf-compiler wget gzip python3 python3-pip python3-wheel | |
| - | |
| name: Build python package | |
| run: | | |
| cd ${GITHUB_REPOSITORY#*/}/src/sdk/python/hanami_sdk/hanami_sdk | |
| protoc --python_out=. --proto_path ../../../../libs/protobuf hanami_messages.proto3 | |
| cd .. | |
| python3 setup.py bdist_wheel --universal | |
| - | |
| name: Copy files | |
| run: | | |
| mkdir /tmp/hanami_python_build_result | |
| cd ${GITHUB_REPOSITORY#*/}/src/sdk/python/hanami_sdk/dist | |
| ls -l | |
| cp ./hanami_sdk-$PYTHON_PACKAGE_VERSION-py2.py3-none-any.whl /tmp/hanami_python_build_result/ | |
| - | |
| name: Create artifact | |
| uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b | |
| with: | |
| name: hanami_python_build_result | |
| path: /tmp/hanami_python_build_result | |
| retention-days: 1 | |
| build_helm_package: | |
| name: "Build Helm package" | |
| needs: [ cpp-check, clang-format-check, flake8-check, check-for-executables, commit-lint, detect-sectets ] | |
| runs-on: ubuntu-latest | |
| env: | |
| FORCE_COLOR: 1 | |
| steps: | |
| - | |
| name: Set helm-version as environment variable | |
| run: | | |
| if [[ ${GITHUB_REF#} == refs/tags/* ]]; then \ | |
| echo "HELM_VERSION=$(echo ${GITHUB_REF#refs/tags/} | sed 's/^v//')" | sed 's#/#\-#' >> $GITHUB_ENV; \ | |
| else \ | |
| echo "HELM_VERSION=0.0.0" | sed 's#/#\-#' >> $GITHUB_ENV; \ | |
| fi | |
| - | |
| name: Checkout repository | |
| run: | | |
| # use manually clone, because with the "actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332" action the name of the | |
| # branch can not be read by the git commands, which is necessary for the build-script | |
| git clone https://github.com/kitsudaiki/${GITHUB_REPOSITORY#*/}.git | |
| cd ${GITHUB_REPOSITORY#*/} | |
| git checkout ${GITHUB_REF#refs/heads/} | |
| - | |
| name: Build helm chart | |
| run: | | |
| cd ${GITHUB_REPOSITORY#*/}/deploy/k8s/openhanami | |
| helm package --version $HELM_VERSION . | |
| - | |
| name: Copy files | |
| run: | | |
| mkdir /tmp/hanami_helm_build_result | |
| cd ${GITHUB_REPOSITORY#*/} | |
| cp ./deploy/k8s/openhanami/openhanami-$HELM_VERSION.tgz /tmp/hanami_helm_build_result/ | |
| - | |
| name: Create artifact | |
| uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b | |
| with: | |
| name: hanami_helm_build_result | |
| path: /tmp/hanami_helm_build_result | |
| retention-days: 1 | |
| build_hanami_core: | |
| name: "Compile hanami-core (debug)" | |
| needs: [ cpp-check, clang-format-check, flake8-check, check-for-executables, commit-lint, detect-sectets ] | |
| runs-on: ubuntu-latest | |
| env: | |
| FORCE_COLOR: 1 | |
| steps: | |
| - | |
| uses: earthly/actions-setup@43211c7a0eae5344d6d79fb4aaf209c8f8866203 | |
| with: | |
| version: v0.8.0 | |
| - | |
| name: Checkout repository | |
| run: | | |
| # use manually clone, because with the "actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332" action the name of the | |
| # branch can not be read by the git commands, which is necessary for the build-script | |
| git clone https://github.com/kitsudaiki/${GITHUB_REPOSITORY#*/}.git | |
| cd ${GITHUB_REPOSITORY#*/} | |
| git checkout ${GITHUB_REF#refs/heads/} | |
| git submodule init | |
| git submodule update --recursive | |
| - | |
| name: Compile core-lib (Debug) | |
| run: | | |
| cd ${GITHUB_REPOSITORY#*/} | |
| earthly --artifact +compile-core-lib-debug/tmp/hanami_core ./builds/binaries | |
| - | |
| name: Copy files | |
| run: | | |
| mkdir /tmp/Hanami_core_debug_build_result | |
| cd ${GITHUB_REPOSITORY#*/} | |
| cp -r builds/binaries/* /tmp/Hanami_core_debug_build_result/ | |
| - | |
| name: Create artifact | |
| uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b | |
| with: | |
| name: Hanami_core_debug_build_result | |
| path: /tmp/Hanami_core_debug_build_result | |
| retention-days: 1 | |
| build_hanami: | |
| name: "Compile hanami (debug)" | |
| needs: [ cpp-check, clang-format-check, flake8-check, check-for-executables, commit-lint, detect-sectets ] | |
| runs-on: ubuntu-latest | |
| env: | |
| FORCE_COLOR: 1 | |
| steps: | |
| - | |
| uses: earthly/actions-setup@43211c7a0eae5344d6d79fb4aaf209c8f8866203 | |
| with: | |
| version: v0.8.0 | |
| - | |
| name: Checkout repository | |
| run: | | |
| # use manually clone, because with the "actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332" action the name of the | |
| # branch can not be read by the git commands, which is necessary for the build-script | |
| git clone https://github.com/kitsudaiki/${GITHUB_REPOSITORY#*/}.git | |
| cd ${GITHUB_REPOSITORY#*/} | |
| git checkout ${GITHUB_REF#refs/heads/} | |
| git submodule init | |
| git submodule update --recursive | |
| - | |
| name: Compile core-lib (Debug) | |
| run: | | |
| cd ${GITHUB_REPOSITORY#*/} | |
| earthly --artifact +compile-hanami/tmp/hanami ./builds/ | |
| - | |
| name: Copy files | |
| run: | | |
| mkdir /tmp/Hanami_debug_build_result | |
| cd ${GITHUB_REPOSITORY#*/} | |
| cp -r builds/hanami /tmp/Hanami_debug_build_result/ | |
| - | |
| name: Create artifact | |
| uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b | |
| with: | |
| name: Hanami_debug_build_result | |
| path: /tmp/Hanami_debug_build_result | |
| retention-days: 1 | |
| build_hanamictl: | |
| name: "Compile CLI" | |
| needs: [ cpp-check, clang-format-check, flake8-check, check-for-executables, commit-lint, detect-sectets ] | |
| runs-on: ubuntu-latest | |
| env: | |
| FORCE_COLOR: 1 | |
| steps: | |
| - | |
| uses: earthly/actions-setup@43211c7a0eae5344d6d79fb4aaf209c8f8866203 | |
| with: | |
| version: v0.8.0 | |
| - | |
| name: Checkout repository | |
| run: | | |
| # use manually clone, because with the "actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332" action the name of the | |
| # branch can not be read by the git commands, which is necessary for the build-script | |
| git clone https://github.com/kitsudaiki/${GITHUB_REPOSITORY#*/}.git | |
| cd ${GITHUB_REPOSITORY#*/} | |
| git checkout ${GITHUB_REF#refs/heads/} | |
| git submodule init | |
| git submodule update --recursive | |
| - | |
| name: Compile code | |
| run: | | |
| cd ${GITHUB_REPOSITORY#*/} | |
| earthly --artifact +compile-cli/tmp/hanamictl ./builds/ | |
| - | |
| name: Copy files | |
| run: | | |
| mkdir /tmp/hanamictl_build_result | |
| cd ${GITHUB_REPOSITORY#*/} | |
| cp -r builds/hanamictl /tmp/hanamictl_build_result/ | |
| - | |
| name: Create artifact | |
| uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b | |
| with: | |
| name: hanamictl_build_result | |
| path: /tmp/hanamictl_build_result | |
| retention-days: 1 | |
| compiler_test: | |
| if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/develop' }} | |
| needs: [ cpp-check, clang-format-check, flake8-check, check-for-executables, commit-lint, detect-sectets ] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| compiler: | |
| - { tag: "ubuntu-2204_clang-13", name: "Ubuntu 22.04 Clang 13", cxx: "/usr/bin/clang++-13", cc: "/usr/bin/clang-13", runs-on: "ubuntu-22.04" } | |
| - { tag: "ubuntu-2204_clang-14", name: "Ubuntu 22.04 Clang 14", cxx: "/usr/bin/clang++-14", cc: "/usr/bin/clang-14", runs-on: "ubuntu-22.04" } | |
| - { tag: "ubuntu-2204_clang-15", name: "Ubuntu 22.04 Clang 15", cxx: "/usr/bin/clang++-15", cc: "/usr/bin/clang-15", runs-on: "ubuntu-22.04" } | |
| - { tag: "ubuntu-2404_clang-15", name: "Ubuntu 24.04 Clang 15", cxx: "/usr/bin/clang++-15", cc: "/usr/bin/clang-15", runs-on: "ubuntu-24.04" } | |
| - { tag: "ubuntu-2404_clang-16", name: "Ubuntu 24.04 Clang 16", cxx: "/usr/bin/clang++-16", cc: "/usr/bin/clang-16", runs-on: "ubuntu-24.04" } | |
| - { tag: "ubuntu-2404_clang-17", name: "Ubuntu 24.04 Clang 17", cxx: "/usr/bin/clang++-17", cc: "/usr/bin/clang-17", runs-on: "ubuntu-24.04" } | |
| - { tag: "ubuntu-2404_clang-18", name: "Ubuntu 24.04 Clang 18", cxx: "/usr/bin/clang++-18", cc: "/usr/bin/clang-18", runs-on: "ubuntu-24.04" } | |
| - { tag: "ubuntu-2204_gcc-10", name: "Ubuntu 22.04 G++ 10", cxx: "/usr/bin/g++-10", cc: "/usr/bin/gcc-10", runs-on: "ubuntu-22.04" } | |
| - { tag: "ubuntu-2204_gcc-11", name: "Ubuntu 22.04 G++ 11", cxx: "/usr/bin/g++-11", cc: "/usr/bin/gcc-11", runs-on: "ubuntu-22.04" } | |
| - { tag: "ubuntu-2204_gcc-12", name: "Ubuntu 22.04 G++ 12", cxx: "/usr/bin/g++-12", cc: "/usr/bin/gcc-12", runs-on: "ubuntu-22.04" } | |
| - { tag: "ubuntu-2404_gcc-12", name: "Ubuntu 24.04 G++ 12", cxx: "/usr/bin/g++-12", cc: "/usr/bin/gcc-12", runs-on: "ubuntu-24.04" } | |
| - { tag: "ubuntu-2404_gcc-13", name: "Ubuntu 24.04 G++ 13", cxx: "/usr/bin/g++-13", cc: "/usr/bin/gcc-13", runs-on: "ubuntu-24.04" } | |
| - { tag: "ubuntu-2404_gcc-14", name: "Ubuntu 24.04 G++ 14", cxx: "/usr/bin/g++-14", cc: "/usr/bin/gcc-14", runs-on: "ubuntu-24.04" } | |
| runs-on: ${{ matrix.compiler.runs-on }} | |
| name: "${{ matrix.compiler.name }}" | |
| env: | |
| CXX: ${{ matrix.compiler.cxx }} | |
| CC: ${{ matrix.compiler.cc }} | |
| outputs: | |
| ubuntu-2204_clang-13: ${{ steps.status.outputs.ubuntu-2204_clang-13 }} | |
| ubuntu-2204_clang-14: ${{ steps.status.outputs.ubuntu-2204_clang-14 }} | |
| ubuntu-2204_clang-15: ${{ steps.status.outputs.ubuntu-2204_clang-15 }} | |
| ubuntu-2404_clang-15: ${{ steps.status.outputs.ubuntu-2404_clang-15 }} | |
| ubuntu-2404_clang-16: ${{ steps.status.outputs.ubuntu-2404_clang-16 }} | |
| ubuntu-2404_clang-17: ${{ steps.status.outputs.ubuntu-2404_clang-17 }} | |
| ubuntu-2404_clang-18: ${{ steps.status.outputs.ubuntu-2404_clang-18 }} | |
| ubuntu-2204_gcc-10: ${{ steps.status.outputs.ubuntu-2204_gcc-10 }} | |
| ubuntu-2204_gcc-11: ${{ steps.status.outputs.ubuntu-2204_gcc-11 }} | |
| ubuntu-2204_gcc-12: ${{ steps.status.outputs.ubuntu-2204_gcc-12 }} | |
| ubuntu-2404_gcc-12: ${{ steps.status.outputs.ubuntu-2404_gcc-12 }} | |
| ubuntu-2404_gcc-13: ${{ steps.status.outputs.ubuntu-2404_gcc-13 }} | |
| ubuntu-2404_gcc-14: ${{ steps.status.outputs.ubuntu-2404_gcc-14 }} | |
| steps: | |
| - | |
| name: Checkout repository | |
| run: | | |
| # use manually clone, because with the "actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332" action the name of the | |
| # branch can not be read by the git commands, which is necessary for the build-script | |
| git clone https://github.com/kitsudaiki/${GITHUB_REPOSITORY#*/}.git | |
| cd ${GITHUB_REPOSITORY#*/} | |
| git checkout ${GITHUB_REF#refs/heads/} | |
| git submodule init | |
| git submodule update --recursive | |
| - | |
| name: Install basic packages | |
| run: | | |
| sudo apt-get update && \ | |
| sudo apt-get install -y make \ | |
| cmake \ | |
| bison \ | |
| flex \ | |
| git \ | |
| ssh \ | |
| libssl-dev \ | |
| libcrypto++-dev \ | |
| libboost-dev \ | |
| nlohmann-json3-dev \ | |
| uuid-dev \ | |
| libsqlite3-dev \ | |
| protobuf-compiler | |
| - | |
| name: Install clang on Ubuntu 22.04 | |
| if: (matrix.compiler.tag == 'ubuntu-2204_clang-14') || (matrix.compiler.tag == 'ubuntu-2204_clang-15') | |
| run: | | |
| sudo apt-get install -y clang-15 clang-14 clang-13 | |
| - | |
| name: Install clang on Ubuntu 24.04 | |
| if: (matrix.compiler.tag == 'ubuntu-2404_clang-15') || (matrix.compiler.tag == 'ubuntu-2404_clang-16') || (matrix.compiler.tag == 'ubuntu-2404_clang-17') || (matrix.compiler.tag == 'ubuntu-2404_clang-18') | |
| run: | | |
| sudo apt-get install -y clang-15 clang-16 clang-17 clang-18 | |
| - | |
| name: Install gcc on Ubuntu 22.04 | |
| if: (matrix.compiler.tag == 'ubuntu-2204_gcc-10') || (matrix.compiler.tag == 'ubuntu-2204_gcc-11') || (matrix.compiler.tag == 'ubuntu-2204_gcc-12') | |
| run: | | |
| sudo apt-get install -y gcc-10 g++-10 gcc-11 g++-11 gcc-12 g++-12 | |
| - | |
| name: Install gcc on Ubuntu 24.04 | |
| if: (matrix.compiler.tag == 'ubuntu-2404_gcc-12') || (matrix.compiler.tag == 'ubuntu-2404_gcc-13') || (matrix.compiler.tag == 'ubuntu-2404_gcc-14') | |
| run: | | |
| sudo apt-get install -y gcc-12 g++-12 gcc-13 g++-13 gcc-14 g++-14 | |
| - | |
| name: Compile code | |
| run: | | |
| cd ${GITHUB_REPOSITORY#*/} && \ | |
| cmake -DCMAKE_BUILD_TYPE=Release -Drun_tests=ON -DCMAKE_CXX_COMPILER=${{ matrix.compiler.cxx }} -DCMAKE_C_COMPILER=${{ matrix.compiler.cc }} . && \ | |
| make -j4 | |
| - | |
| name: Run basic test | |
| run: | | |
| cd ${GITHUB_REPOSITORY#*/} | |
| ./src/hanami/hanami_unittests | |
| - | |
| name: Update Result | |
| id: status | |
| if: ${{ always() }} | |
| run: echo "${{ matrix.compiler.tag }}=${{ job.status }}" >> $GITHUB_OUTPUT | |
| unit_tests: | |
| name: "Unit-Tests (C++-libs)" | |
| needs: [ build_hanami, build_hanami_core, build_hanamictl, build_helm_package, build_python_package ] | |
| runs-on: ubuntu-latest | |
| container: | |
| image: ubuntu:24.04 | |
| steps: | |
| - | |
| name: Get artifact | |
| uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 | |
| with: | |
| name: Hanami_core_debug_build_result | |
| path: /tmp/Hanami_core_debug_build_result | |
| - | |
| name: "Check target-directory" | |
| run: ls -l /tmp/Hanami_core_debug_build_result | |
| - | |
| name: "Run test: hanami" | |
| run: | | |
| chmod +x /tmp/Hanami_core_debug_build_result/hanami_unittests | |
| /tmp/Hanami_core_debug_build_result/hanami_unittests | |
| memory_leak_tests: | |
| name: "Memory-Leak-Tests (C++-libs)" | |
| needs: [ build_hanami, build_hanami_core, build_hanamictl, build_helm_package, build_python_package ] | |
| runs-on: ubuntu-latest | |
| container: | |
| image: ubuntu:24.04 | |
| steps: | |
| - | |
| name: Get artifact | |
| uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 | |
| with: | |
| name: Hanami_core_debug_build_result | |
| path: /tmp/Hanami_core_debug_build_result | |
| - | |
| name: "Check target-directory" | |
| run: ls -l /tmp/Hanami_core_debug_build_result | |
| - | |
| name: "Run test: hanami" | |
| run: | | |
| chmod +x /tmp/Hanami_core_debug_build_result/hanami_memory_leak_tests | |
| /tmp/Hanami_core_debug_build_result/hanami_memory_leak_tests | |
| cargo_tests: | |
| name: "Cargo Test" | |
| needs: [ build_hanami, build_hanami_core, build_hanamictl, build_helm_package, build_python_package ] | |
| runs-on: ubuntu-latest | |
| env: | |
| FORCE_COLOR: 1 | |
| steps: | |
| - | |
| uses: earthly/actions-setup@43211c7a0eae5344d6d79fb4aaf209c8f8866203 | |
| with: | |
| version: v0.8.0 | |
| - | |
| name: Checkout repository | |
| run: | | |
| # use manually clone, because with the "actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332" action the name of the | |
| # branch can not be read by the git commands, which is necessary for the build-script | |
| git clone https://github.com/kitsudaiki/${GITHUB_REPOSITORY#*/}.git | |
| cd ${GITHUB_REPOSITORY#*/} | |
| git checkout ${GITHUB_REF#refs/heads/} | |
| git submodule init | |
| git submodule update --recursive | |
| - | |
| name: Compile code | |
| run: | | |
| cd ${GITHUB_REPOSITORY#*/} | |
| earthly +test-hanami | |
| sdk_api_tests: | |
| name: "SDK-API-Tests" | |
| needs: [ cargo_tests, unit_tests, memory_leak_tests ] | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - | |
| name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y openssl libsqlite3-0 | |
| - | |
| name: Set python-version as environment variable | |
| run: | | |
| if [[ ${GITHUB_REF#} == refs/tags/* ]]; then \ | |
| echo "PYTHON_PACKAGE_VERSION=$(echo ${GITHUB_REF#refs/tags/} | sed 's/^v//')" | sed 's#/#\-#' >> $GITHUB_ENV; \ | |
| else \ | |
| echo "PYTHON_PACKAGE_VERSION=0.0.0" | sed 's#/#\-#' >> $GITHUB_ENV; \ | |
| fi | |
| - | |
| name: Checkout repository | |
| run: | | |
| # use manually clone, because with the "actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332" action the name of the | |
| # branch can not be read by the git commands, which is necessary for the build-script | |
| git clone https://github.com/kitsudaiki/${GITHUB_REPOSITORY#*/}.git | |
| cd ${GITHUB_REPOSITORY#*/} | |
| git checkout ${GITHUB_REF#refs/heads/} | |
| git submodule init | |
| git submodule update --recursive | |
| - | |
| name: Get artifact | |
| uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 | |
| with: | |
| name: hanami_python_build_result | |
| path: /tmp/hanami_python_build_result | |
| - | |
| name: Get artifact | |
| uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 | |
| with: | |
| name: Hanami_debug_build_result | |
| path: /tmp/Hanami_debug_build_result | |
| - | |
| name: Install dependencies for SDK | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y protobuf-compiler wget gzip python3 python3-pip | |
| cd /tmp/hanami_python_build_result | |
| ls -l | |
| pip3 install -U hanami_sdk-$PYTHON_PACKAGE_VERSION-py2.py3-none-any.whl | |
| - | |
| name: Download mnist-files | |
| run: | | |
| cd /tmp/ | |
| wget https://storage.googleapis.com/cvdf-datasets/mnist/train-images-idx3-ubyte.gz | |
| wget https://storage.googleapis.com/cvdf-datasets/mnist/train-labels-idx1-ubyte.gz | |
| wget https://storage.googleapis.com/cvdf-datasets/mnist/t10k-images-idx3-ubyte.gz | |
| wget https://storage.googleapis.com/cvdf-datasets/mnist/t10k-labels-idx1-ubyte.gz | |
| gzip -d train-images-idx3-ubyte.gz | |
| gzip -d train-labels-idx1-ubyte.gz | |
| gzip -d t10k-images-idx3-ubyte.gz | |
| gzip -d t10k-labels-idx1-ubyte.gz | |
| - | |
| name: run Hanami in backgroupd | |
| run: | | |
| cd ${GITHUB_REPOSITORY#*/} | |
| chmod +x /tmp/Hanami_debug_build_result/hanami | |
| mkdir -p builds/binaries | |
| sudo cp -r ./example_configs/openhanami /etc/openhanami | |
| sudo chmod 777 -R /etc/openhanami | |
| /tmp/Hanami_debug_build_result/hanami & | |
| # BINARY_PID=$! | |
| # trap "kill $BINARY_PID" EXIT | |
| - | |
| name: Sleep for 15 seconds | |
| uses: jakejarvis/wait-action@919fc193e07906705e5b7a50f90ea9e74d20b2b0 | |
| with: | |
| time: '15s' | |
| - | |
| name: Run test | |
| run: | | |
| cd ${GITHUB_REPOSITORY#*/}/testing/python_sdk_api | |
| mkdir -p test_dir | |
| cp sdk_api_test.py test_dir/ | |
| cp test_values.py test_dir/ | |
| cd test_dir | |
| /usr/bin/python3 sdk_api_test.py | |
| cli_api_tests: | |
| name: "CLI-API-Tests" | |
| needs: [ cargo_tests, unit_tests, memory_leak_tests ] | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - | |
| name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y openssl libsqlite3-0 | |
| - | |
| name: Checkout repository | |
| run: | | |
| # use manually clone, because with the "actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332" action the name of the | |
| # branch can not be read by the git commands, which is necessary for the build-script | |
| git clone https://github.com/kitsudaiki/${GITHUB_REPOSITORY#*/}.git | |
| cd ${GITHUB_REPOSITORY#*/} | |
| git checkout ${GITHUB_REF#refs/heads/} | |
| git submodule init | |
| git submodule update --recursive | |
| - | |
| name: Get artifact | |
| uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 | |
| with: | |
| name: Hanami_debug_build_result | |
| path: /tmp/Hanami_debug_build_result | |
| - | |
| name: Get artifact | |
| uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 | |
| with: | |
| name: hanamictl_build_result | |
| path: /tmp/hanamictl_build_result | |
| - | |
| name: Build local docker-image | |
| run: | | |
| chmod +x /tmp/hanamictl_build_result/hanamictl | |
| cp /tmp/hanamictl_build_result/hanamictl ${GITHUB_REPOSITORY#*/}/testing/go_cli_api/ | |
| - | |
| name: Download mnist-files | |
| run: | | |
| cd /tmp/ | |
| wget https://storage.googleapis.com/cvdf-datasets/mnist/train-images-idx3-ubyte.gz | |
| wget https://storage.googleapis.com/cvdf-datasets/mnist/train-labels-idx1-ubyte.gz | |
| wget https://storage.googleapis.com/cvdf-datasets/mnist/t10k-images-idx3-ubyte.gz | |
| wget https://storage.googleapis.com/cvdf-datasets/mnist/t10k-labels-idx1-ubyte.gz | |
| gzip -d train-images-idx3-ubyte.gz | |
| gzip -d train-labels-idx1-ubyte.gz | |
| gzip -d t10k-images-idx3-ubyte.gz | |
| gzip -d t10k-labels-idx1-ubyte.gz | |
| - | |
| name: run Hanami in backgroupd | |
| run: | | |
| cd ${GITHUB_REPOSITORY#*/} | |
| chmod +x /tmp/Hanami_debug_build_result/hanami | |
| mkdir -p builds/binaries | |
| sudo cp -r ./example_configs/openhanami /etc/openhanami | |
| sudo chmod 777 -R /etc/openhanami | |
| /tmp/Hanami_debug_build_result/hanami & | |
| # BINARY_PID=$! | |
| # trap "kill $BINARY_PID" EXIT | |
| - | |
| name: Sleep for 15 seconds | |
| uses: jakejarvis/wait-action@919fc193e07906705e5b7a50f90ea9e74d20b2b0 | |
| with: | |
| time: '15s' | |
| - | |
| name: Run test | |
| run: | | |
| export PATH=$PATH:/usr/local/go/bin | |
| cd ${GITHUB_REPOSITORY#*/}/testing/go_cli_api | |
| export HANAMI_ADDRESS=http://127.0.0.1:11418 | |
| export HANAMI_USER=asdf | |
| export HANAMI_PASSPHRASE=asdfasdf | |
| export train_inputs=/tmp/train-images-idx3-ubyte | |
| export train_labels=/tmp/train-labels-idx1-ubyte | |
| export request_inputs=/tmp/t10k-images-idx3-ubyte | |
| export request_labels=/tmp/t10k-labels-idx1-ubyte | |
| ./cli_test.sh | |
| python_version_test: | |
| # if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/develop' }} | |
| needs: [ cargo_tests, unit_tests, memory_leak_tests ] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python_version: | |
| - { tag: "python-3_9", name: "Python 3.9", version: "3.9", runs-on: "ubuntu-20.04" } | |
| - { tag: "python-3_10", name: "Python 3.10", version: "3.10", runs-on: "ubuntu-22.04" } | |
| - { tag: "python-3_11", name: "Python 3.11", version: "3.11", runs-on: "ubuntu-22.04" } | |
| - { tag: "python-3_12", name: "Python 3.12", version: "3.12", runs-on: "ubuntu-24.04" } | |
| runs-on: ${{ matrix.python_version.runs-on }} | |
| name: "${{ matrix.python_version.name }}" | |
| outputs: | |
| python-3_9: ${{ steps.status.outputs.python-3_9 }} | |
| python-3_10: ${{ steps.status.outputs.python-3_10 }} | |
| python-3_11: ${{ steps.status.outputs.python-3_11 }} | |
| python-3_12: ${{ steps.status.outputs.python-3_12 }} | |
| steps: | |
| - | |
| name: Set python-version as environment variable | |
| run: | | |
| if [[ ${GITHUB_REF#} == refs/tags/* ]]; then \ | |
| echo "PYTHON_PACKAGE_VERSION=$(echo ${GITHUB_REF#refs/tags/} | sed 's/^v//')" | sed 's#/#\-#' >> $GITHUB_ENV; \ | |
| else \ | |
| echo "PYTHON_PACKAGE_VERSION=0.0.0" | sed 's#/#\-#' >> $GITHUB_ENV; \ | |
| fi | |
| - | |
| name: Checkout repository | |
| run: | | |
| # use manually clone, because with the "actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332" action the name of the | |
| # branch can not be read by the git commands, which is necessary for the build-script | |
| git clone https://github.com/kitsudaiki/${GITHUB_REPOSITORY#*/}.git | |
| cd ${GITHUB_REPOSITORY#*/} | |
| git checkout ${GITHUB_REF#refs/heads/} | |
| git submodule init | |
| git submodule update --recursive | |
| - | |
| name: Get artifact | |
| uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 | |
| with: | |
| name: hanami_python_build_result | |
| path: /tmp/hanami_python_build_result | |
| - | |
| name: Get artifact | |
| uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 | |
| with: | |
| name: Hanami_debug_build_result | |
| path: /tmp/Hanami_debug_build_result | |
| - | |
| name: Install python | |
| uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f | |
| with: | |
| python-version: "${{ matrix.python_version.version }}" | |
| - | |
| name: Install hanami-sdk | |
| run: | | |
| cd /tmp/hanami_python_build_result | |
| ls -l | |
| pip install -U hanami_sdk-$PYTHON_PACKAGE_VERSION-py2.py3-none-any.whl | |
| - | |
| name: Print installed python-version | |
| run: | | |
| python --version | |
| - | |
| name: Print installed pip-packages | |
| run: | | |
| pip list | |
| - | |
| name: Build local docker-image | |
| run: | | |
| cd ${GITHUB_REPOSITORY#*/} | |
| chmod +x /tmp/Hanami_debug_build_result/hanami | |
| mkdir -p builds/binaries | |
| cp /tmp/Hanami_debug_build_result/hanami ./builds/binaries/ | |
| # IMPORTANT: use the Dockerfile instead of the Earthfile here, | |
| # because the Dockerfile is also used in the final build-process. | |
| # So using the Dockerfile here to ensure, the final build after | |
| # merge doesn't fail. | |
| docker build -t kitsudaiki/hanami:test . | |
| - | |
| name: Download mnist-files | |
| run: | | |
| cd /tmp/ | |
| wget https://storage.googleapis.com/cvdf-datasets/mnist/train-images-idx3-ubyte.gz | |
| wget https://storage.googleapis.com/cvdf-datasets/mnist/train-labels-idx1-ubyte.gz | |
| wget https://storage.googleapis.com/cvdf-datasets/mnist/t10k-images-idx3-ubyte.gz | |
| wget https://storage.googleapis.com/cvdf-datasets/mnist/t10k-labels-idx1-ubyte.gz | |
| gzip -d train-images-idx3-ubyte.gz | |
| gzip -d train-labels-idx1-ubyte.gz | |
| gzip -d t10k-images-idx3-ubyte.gz | |
| gzip -d t10k-labels-idx1-ubyte.gz | |
| - | |
| name: Start hanami-docker-container | |
| run: | | |
| cd ${GITHUB_REPOSITORY#*/} | |
| sudo cp -r ./example_configs/openhanami /etc/ | |
| docker run -d -v \ | |
| ./example_configs/openhanami:/etc/openhanami \ | |
| -p 127.0.0.1:11418:11418 \ | |
| --name=hanami \ | |
| --env HANAMI_ADMIN_ID=asdf \ | |
| --env HANAMI_ADMIN_NAME=asdf \ | |
| --env HANAMI_ADMIN_PASSPHRASE=asdfasdf \ | |
| kitsudaiki/hanami:test | |
| - | |
| name: Sleep for 15 seconds | |
| uses: jakejarvis/wait-action@919fc193e07906705e5b7a50f90ea9e74d20b2b0 | |
| with: | |
| time: '15s' | |
| - | |
| name: Run test | |
| run: | | |
| cd ${GITHUB_REPOSITORY#*/}/testing/python_sdk_api | |
| mkdir -p test_dir | |
| cp sdk_api_test.py test_dir/ | |
| cp test_values.py test_dir/ | |
| cd test_dir | |
| python sdk_api_test.py | |
| - | |
| name: Update Result | |
| id: status | |
| if: ${{ always() }} | |
| run: echo "${{ matrix.python_version.tag }}=${{ job.status }}" >> $GITHUB_OUTPUT | |
| docker_build: | |
| name: "Build Docker-images" | |
| # if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/develop' || github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }} | |
| needs: [ sdk_api_tests, cli_api_tests ] | |
| runs-on: ubuntu-24.04 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: | |
| - linux/amd64 | |
| # - linux/arm64 | |
| steps: | |
| - | |
| name: Prepare | |
| run: | | |
| platform=${{ matrix.platform }} | |
| echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV | |
| - | |
| uses: earthly/actions-setup@43211c7a0eae5344d6d79fb4aaf209c8f8866203 | |
| with: | |
| version: v0.8.0 | |
| - | |
| name: Checkout repository | |
| run: | | |
| # use manually clone, because with the "actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332" action the name of the | |
| # branch can not be read by the git commands, which is necessary for the build-script | |
| git clone https://github.com/kitsudaiki/${GITHUB_REPOSITORY#*/}.git | |
| cd ${GITHUB_REPOSITORY#*/} | |
| git checkout ${GITHUB_REF#refs/heads/} | |
| git submodule init | |
| git submodule update --recursive | |
| - | |
| name: Docker meta | |
| id: meta | |
| uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 | |
| with: | |
| images: ${{ env.REGISTRY_HANAMI_IMAGE }} | |
| - | |
| name: Set up QEMU | |
| uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf | |
| - | |
| name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db | |
| - | |
| name: Login to Docker Hub | |
| uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - | |
| name: Check location | |
| run: | | |
| pwd | |
| cd OpenHanami | |
| ls -l | |
| - | |
| name: Build and push by digest | |
| id: build | |
| uses: docker/build-push-action@5176d81f87c23d6fc96624dfdbcd9f3830bbe445 | |
| with: | |
| context: ./OpenHanami | |
| platforms: ${{ matrix.platform }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| outputs: type=image,name=${{ env.REGISTRY_HANAMI_IMAGE }},push-by-digest=true,name-canonical=true,push=true | |
| - | |
| name: Export digest | |
| run: | | |
| mkdir -p /tmp/digests | |
| digest="${{ steps.build.outputs.digest }}" | |
| touch "/tmp/digests/${digest#sha256:}" | |
| - | |
| name: Upload digest | |
| uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b | |
| with: | |
| name: digests-${{ env.PLATFORM_PAIR }} | |
| path: /tmp/digests/* | |
| if-no-files-found: error | |
| retention-days: 1 | |
| docker_merge: | |
| name: "Merge and push Docker-image" | |
| # if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/develop' || github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }} | |
| runs-on: ubuntu-24.04 | |
| needs: [ docker_build ] | |
| steps: | |
| - | |
| name: Set branch name as environment variable | |
| run: | | |
| if [[ ${GITHUB_REF#} == refs/tags/* ]]; then \ | |
| echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/tags/} | sed 's/^v//')" | sed 's#/#\-#' >> $GITHUB_ENV; \ | |
| else \ | |
| echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})" | sed 's#/#\-#' >> $GITHUB_ENV; \ | |
| fi | |
| - | |
| name: Check docker-tag | |
| run: echo "Docker-tag=$BRANCH_NAME" | |
| - | |
| name: Download digests | |
| uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 | |
| with: | |
| path: /tmp/digests | |
| pattern: digests-* | |
| merge-multiple: true | |
| - | |
| name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db | |
| - | |
| name: Docker meta | |
| id: meta | |
| uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 | |
| with: | |
| images: ${{ env.REGISTRY_HANAMI_IMAGE }} | |
| - | |
| name: Login to Docker Hub | |
| uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - | |
| name: Create manifest list and push | |
| working-directory: /tmp/digests | |
| run: | | |
| docker buildx imagetools create -t ${{ env.REGISTRY_HANAMI_IMAGE }}:${{ env.BRANCH_NAME }} \ | |
| $(printf '${{ env.REGISTRY_HANAMI_IMAGE }}@sha256:%s ' *) | |
| - | |
| name: Inspect image | |
| run: | | |
| docker buildx imagetools inspect ${{ env.REGISTRY_HANAMI_IMAGE }}:${{ env.BRANCH_NAME }} | |
| kubernetes_test: | |
| if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/develop' || github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }} | |
| needs: [ docker_merge ] | |
| runs-on: ubuntu-22.04 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| kubernetes_version: | |
| - { tag: "kubernetes-1_26", name: "Kubernetes 1.26", version: "1.26.15"} | |
| - { tag: "kubernetes-1_27", name: "Kubernetes 1.27", version: "1.27.15"} | |
| - { tag: "kubernetes-1_28", name: "Kubernetes 1.28", version: "1.28.11"} | |
| - { tag: "kubernetes-1_29", name: "Kubernetes 1.29", version: "1.29.6"} | |
| - { tag: "kubernetes-1_30", name: "Kubernetes 1.30", version: "1.30.2"} | |
| name: "${{ matrix.kubernetes_version.name }}" | |
| outputs: | |
| kubernetes-1_26: ${{ steps.status.outputs.kubernetes-1_26 }} | |
| kubernetes-1_27: ${{ steps.status.outputs.kubernetes-1_27 }} | |
| kubernetes-1_28: ${{ steps.status.outputs.kubernetes-1_28 }} | |
| kubernetes-1_29: ${{ steps.status.outputs.kubernetes-1_29 }} | |
| kubernetes-1_30: ${{ steps.status.outputs.kubernetes-1_30 }} | |
| env: | |
| KUBECONFIG: /etc/rancher/k3s/k3s.yaml | |
| steps: | |
| - | |
| name: Set branch name as environment variable | |
| run: | | |
| if [[ ${GITHUB_REF#} == refs/tags/* ]]; then \ | |
| echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/tags/} | sed 's/^v//')" | sed 's#/#\-#' >> $GITHUB_ENV; \ | |
| else \ | |
| echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})" | sed 's#/#\-#' >> $GITHUB_ENV; \ | |
| fi | |
| - | |
| name: Set python-version as environment variable | |
| run: | | |
| if [[ ${GITHUB_REF#} == refs/tags/* ]]; then \ | |
| echo "PYTHON_PACKAGE_VERSION=$(echo ${GITHUB_REF#refs/tags/} | sed 's/^v//')" | sed 's#/#\-#' >> $GITHUB_ENV; \ | |
| else \ | |
| echo "PYTHON_PACKAGE_VERSION=0.0.0" | sed 's#/#\-#' >> $GITHUB_ENV; \ | |
| fi | |
| - | |
| name: Set helm-version as environment variable | |
| run: | | |
| if [[ ${GITHUB_REF#} == refs/tags/* ]]; then \ | |
| echo "HELM_VERSION=$(echo ${GITHUB_REF#refs/tags/} | sed 's/^v//')" | sed 's#/#\-#' >> $GITHUB_ENV; \ | |
| else \ | |
| echo "HELM_VERSION=0.0.0" | sed 's#/#\-#' >> $GITHUB_ENV; \ | |
| fi | |
| - | |
| name: Get artifact | |
| uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 | |
| with: | |
| name: hanami_python_build_result | |
| path: /tmp/hanami_python_build_result | |
| - | |
| name: Install dependencies for SDK | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y protobuf-compiler wget gzip python3 python3-pip | |
| cd /tmp/hanami_python_build_result | |
| ls -l | |
| pip3 install -U hanami_sdk-$PYTHON_PACKAGE_VERSION-py2.py3-none-any.whl | |
| - | |
| name: Check docker-tag | |
| run: echo "Docker-tag=$BRANCH_NAME" | |
| - | |
| name: Checkout repository | |
| run: | | |
| # use manually clone, because with the "actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332" action the name of the | |
| # branch can not be read by the git commands, which is necessary for the build-script | |
| git clone https://github.com/kitsudaiki/${GITHUB_REPOSITORY#*/}.git | |
| cd ${GITHUB_REPOSITORY#*/} | |
| git checkout ${GITHUB_REF#refs/heads/} | |
| git submodule init | |
| git submodule update --recursive | |
| - | |
| name: Get helm-chart artifact | |
| uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 | |
| with: | |
| name: hanami_helm_build_result | |
| path: /tmp/hanami_helm_build_result | |
| - | |
| name: Install dependencies for SDK | |
| run: | | |
| sudo snap install helm --classic | |
| sudo snap install kubectl --classic | |
| - | |
| name: Install k3s without traefik | |
| run: | | |
| sudo curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="--disable traefik" INSTALL_K3S_VERSION=v${{ matrix.kubernetes_version.version }}+k3s1 sh - | |
| - | |
| name: Sleep for 60 seconds | |
| uses: jakejarvis/wait-action@919fc193e07906705e5b7a50f90ea9e74d20b2b0 | |
| with: | |
| time: '60s' | |
| - | |
| name: Install nginx ingress controller | |
| run: | | |
| sudo chmod -R +r /etc/rancher/k3s | |
| export KUBECONFIG=/etc/rancher/k3s/k3s.yaml | |
| kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.8.1/deploy/static/provider/baremetal/deploy.yaml | |
| sleep 15 | |
| cat <<EOF > ingress-nginx-controller-loadbalancer.yaml | |
| --- | |
| apiVersion: v1 | |
| kind: Service | |
| metadata: | |
| name: ingress-nginx-controller-loadbalancer | |
| namespace: ingress-nginx | |
| spec: | |
| selector: | |
| app.kubernetes.io/component: controller | |
| app.kubernetes.io/instance: ingress-nginx | |
| app.kubernetes.io/name: ingress-nginx | |
| ports: | |
| - name: http | |
| port: 80 | |
| protocol: TCP | |
| targetPort: 80 | |
| - name: https | |
| port: 443 | |
| protocol: TCP | |
| targetPort: 443 | |
| type: LoadBalancer | |
| EOF | |
| cat ingress-nginx-controller-loadbalancer.yaml | |
| kubectl apply -f ingress-nginx-controller-loadbalancer.yaml | |
| sleep 15 | |
| - | |
| name: Install cert-manager in kubernetes_test | |
| run: | | |
| export KUBECONFIG=/etc/rancher/k3s/k3s.yaml | |
| helm repo add jetstack https://charts.jetstack.io | |
| helm repo update | |
| kubectl create namespace cert-manager | |
| helm install cert-manager jetstack/cert-manager --namespace cert-manager --set installCRDs=true | |
| - | |
| name: Label nodes | |
| run: | | |
| kubectl label nodes --all hanami-node=true | |
| - | |
| name: Install hanami | |
| run: | | |
| helm install --set docker.tag="${{ env.BRANCH_NAME }}" --set user.id=asdf --set user.name="test user" --set user.passphrase="asdfasdf" --set token.data="this is a test-token" --set api.domain=local-hanami openhanami /tmp/hanami_helm_build_result/openhanami-$HELM_VERSION.tgz | |
| - | |
| name: Sleep for 60 seconds | |
| uses: jakejarvis/wait-action@919fc193e07906705e5b7a50f90ea9e74d20b2b0 | |
| with: | |
| time: '60s' | |
| - | |
| name: Update hosts-file | |
| run: | | |
| ingress_ip=$(kubectl get ingress hanami-ingress -o jsonpath='{.status.loadBalancer.ingress[0].ip}') | |
| echo "$ingress_ip local-hanami" | sudo tee -a /etc/hosts | |
| cat /etc/hosts | |
| - | |
| name: Download mnist-files | |
| run: | | |
| cd /tmp/ | |
| wget https://storage.googleapis.com/cvdf-datasets/mnist/train-images-idx3-ubyte.gz | |
| wget https://storage.googleapis.com/cvdf-datasets/mnist/train-labels-idx1-ubyte.gz | |
| wget https://storage.googleapis.com/cvdf-datasets/mnist/t10k-images-idx3-ubyte.gz | |
| wget https://storage.googleapis.com/cvdf-datasets/mnist/t10k-labels-idx1-ubyte.gz | |
| gzip -d train-images-idx3-ubyte.gz | |
| gzip -d train-labels-idx1-ubyte.gz | |
| gzip -d t10k-images-idx3-ubyte.gz | |
| gzip -d t10k-labels-idx1-ubyte.gz | |
| - | |
| name: Prepare test-config | |
| run: | | |
| cd ${GITHUB_REPOSITORY#*/} | |
| sudo cp -r ./example_configs/openhanami /etc/ | |
| sudo sed -i 's/address = http:\/\/127\.0\.0\.1:11418/address = https:\/\/local-hanami/g' /etc/openhanami/hanami_testing.conf | |
| - | |
| name: Run test | |
| run: | | |
| cd ${GITHUB_REPOSITORY#*/}/testing/python_sdk_api | |
| mkdir -p test_dir | |
| cp sdk_api_test.py test_dir/ | |
| cp test_values.py test_dir/ | |
| cd test_dir | |
| /usr/bin/python3 sdk_api_test.py | |
| - | |
| name: Update Result | |
| id: status | |
| if: ${{ always() }} | |
| run: echo "${{ matrix.kubernetes_version.tag }}=${{ job.status }}" >> $GITHUB_OUTPUT | |
| # badge-upload: | |
| # if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/develop' && always() }} | |
| # # needs: [ kubernetes_test, python_version_test, compiler_test ] | |
| # needs: [ compiler_test ] | |
| # runs-on: ubuntu-22.04 | |
| # name: Publish badges | |
| # steps: | |
| # - | |
| # name: Set branch name as environment variable | |
| # run: | | |
| # if [[ ${GITHUB_REF#} == refs/tags/* ]]; then \ | |
| # echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/tags/} | sed 's/^v//')" | sed 's#/#\-#' >> $GITHUB_ENV; \ | |
| # else \ | |
| # echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})" | sed 's#/#\-#' >> $GITHUB_ENV; \ | |
| # fi | |
| # - | |
| # name: Checkout repository | |
| # uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 | |
| # - | |
| # name: Publish Compiler Badges | |
| # uses: ./.github/actions/badge | |
| # with: | |
| # category: compiler_version | |
| # badges: ${{ toJson(needs.compiler_test.outputs) }} | |
| # github_token: ${{ secrets.BADGES_PUSH_TOKEN }} | |
| # branch_name: ${{ env.BRANCH_NAME }} | |
| # - | |
| # name: Publish Python Badges | |
| # uses: ./.github/actions/badge | |
| # with: | |
| # category: python_version | |
| # badges: ${{ toJson(needs.python_version_test.outputs) }} | |
| # github_token: ${{ secrets.BADGES_PUSH_TOKEN }} | |
| # branch_name: ${{ env.BRANCH_NAME }} | |
| # - | |
| # name: Publish Kubernetes Badges | |
| # uses: ./.github/actions/badge | |
| # with: | |
| # category: kubernetes_version | |
| # badges: ${{ toJson(needs.kubernetes_test.outputs) }} | |
| # github_token: ${{ secrets.BADGES_PUSH_TOKEN }} | |
| # branch_name: ${{ env.BRANCH_NAME }} | |
| build_docs: | |
| name: Build and push docs | |
| needs: [ kubernetes_test ] | |
| runs-on: ubuntu-latest | |
| # if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/develop' || github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }} | |
| env: | |
| FORCE_COLOR: 1 | |
| steps: | |
| - | |
| name: Set branch name as environment variable | |
| run: | | |
| if [[ ${GITHUB_REF#} == refs/tags/* ]]; then \ | |
| echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/tags/} | sed 's/^v//')" | sed 's#/#\-#' >> $GITHUB_ENV; \ | |
| else \ | |
| echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})" | sed 's#/#\-#' >> $GITHUB_ENV; \ | |
| fi | |
| - | |
| name: Check docker-tag | |
| run: echo "Docker-tag=$BRANCH_NAME" | |
| - | |
| uses: earthly/actions-setup@43211c7a0eae5344d6d79fb4aaf209c8f8866203 | |
| with: | |
| version: v0.8.0 | |
| - | |
| name: Checkout repository | |
| run: | | |
| # use manually clone, because with the "actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332" action the name of the | |
| # branch can not be read by the git commands, which is necessary for the build-script | |
| git clone https://github.com/kitsudaiki/${GITHUB_REPOSITORY#*/}.git | |
| cd ${GITHUB_REPOSITORY#*/} | |
| git checkout ${GITHUB_REF#refs/heads/} | |
| git submodule init | |
| git submodule update --recursive | |
| - | |
| name: Build docs | |
| run: | | |
| cd ${GITHUB_REPOSITORY#*/} | |
| earthly +build-docs --image_name=${{ env.REGISTRY_DOCS_IMAGE }}:${{ env.BRANCH_NAME }} | |
| - | |
| name: Login to Docker Hub | |
| uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - | |
| name: Push image | |
| run: docker push ${{ env.REGISTRY_DOCS_IMAGE }}:${{ env.BRANCH_NAME }} | |
| # upload_files: | |
| # name: "Upload files to share" | |
| # needs: [ kubernetes_test ] | |
| # runs-on: ubuntu-latest | |
| # if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/develop' || github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }} | |
| # env: | |
| # FORCE_COLOR: 1 | |
| # steps: | |
| # - | |
| # name: Set branch name as environment variable | |
| # run: | | |
| # if [[ ${GITHUB_REF#} == refs/tags/* ]]; then \ | |
| # echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/tags/} | sed 's/^v//')" | sed 's#/#\-#' >> $GITHUB_ENV; \ | |
| # else \ | |
| # echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})" | sed 's#/#\-#' >> $GITHUB_ENV; \ | |
| # fi | |
| # - | |
| # name: Set helm-version as environment variable | |
| # run: | | |
| # if [[ ${GITHUB_REF#} == refs/tags/* ]]; then \ | |
| # echo "HELM_VERSION=$(echo ${GITHUB_REF#refs/tags/} | sed 's/^v//')" | sed 's#/#\-#' >> $GITHUB_ENV; \ | |
| # else \ | |
| # echo "HELM_VERSION=0.0.0" | sed 's#/#\-#' >> $GITHUB_ENV; \ | |
| # fi | |
| # - | |
| # name: Set python-version as environment variable | |
| # run: | | |
| # if [[ ${GITHUB_REF#} == refs/tags/* ]]; then \ | |
| # echo "PYTHON_PACKAGE_VERSION=$(echo ${GITHUB_REF#refs/tags/} | sed 's/^v//')" | sed 's#/#\-#' >> $GITHUB_ENV; \ | |
| # else \ | |
| # echo "PYTHON_PACKAGE_VERSION=0.0.0" | sed 's#/#\-#' >> $GITHUB_ENV; \ | |
| # fi | |
| # - | |
| # name: Get artifact | |
| # uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 | |
| # with: | |
| # name: hanamictl_build_result | |
| # path: /tmp/hanamictl_build_result | |
| # - | |
| # name: Get helm-chart artifact | |
| # uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 | |
| # with: | |
| # name: hanami_helm_build_result | |
| # path: /tmp/hanami_helm_build_result | |
| # - | |
| # name: Get artifact | |
| # uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 | |
| # with: | |
| # name: hanami_python_build_result | |
| # path: /tmp/hanami_python_build_result | |
| # - | |
| # name: Prepare ssh-keys | |
| # run: | | |
| # mkdir -p ~/.ssh | |
| # echo "${{ secrets.SHARE_SSH_PUBLIC_KEY }}" > ~/.ssh/id_rsa.pub | |
| # echo "${{ secrets.SHARE_SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa | |
| # echo "${{ secrets.SHARE_SSH_KNOWN_HOSTS }}" > ~/.ssh/known_hosts | |
| # chmod 600 ~/.ssh/id_rsa | |
| # - | |
| # name: Create remote directory, if not exist | |
| # run: | | |
| # ssh ${{ secrets.SHARE_SSH_ACCESS }} "mkdir -p ~/hanami_file_share/$BRANCH_NAME" | |
| # ssh ${{ secrets.SHARE_SSH_ACCESS }} "mkdir -p ~/hanami_file_share/$BRANCH_NAME/helm-chart" | |
| # ssh ${{ secrets.SHARE_SSH_ACCESS }} "mkdir -p ~/hanami_file_share/$BRANCH_NAME/python-package" | |
| # ssh ${{ secrets.SHARE_SSH_ACCESS }} "mkdir -p ~/hanami_file_share/$BRANCH_NAME/client" | |
| # - | |
| # name: Upload hanamictl | |
| # run: | | |
| # cd /tmp/hanamictl_build_result | |
| # tar -czvf hanamictl_amd64_$BRANCH_NAME.tar.gz hanamictl | |
| # scp hanamictl_amd64_$BRANCH_NAME.tar.gz ${{ secrets.SHARE_SSH_ACCESS }}:~/hanami_file_share/$BRANCH_NAME/client/ | |
| # - | |
| # name: Upload helm-chart | |
| # run: | | |
| # scp /tmp/hanami_helm_build_result/openhanami-$HELM_VERSION.tgz ${{ secrets.SHARE_SSH_ACCESS }}:~/hanami_file_share/$BRANCH_NAME/helm-chart/ | |
| # - | |
| # name: Upload pip-package | |
| # run: | | |
| # scp /tmp/hanami_python_build_result/hanami_sdk-$PYTHON_PACKAGE_VERSION-py2.py3-none-any.whl ${{ secrets.SHARE_SSH_ACCESS }}:~/hanami_file_share/$BRANCH_NAME/python-package/ |