Skip to content

chore(deps): bump tonic from 0.14.4 to 0.14.5 #3143

chore(deps): bump tonic from 0.14.4 to 0.14.5

chore(deps): bump tonic from 0.14.4 to 0.14.5 #3143

Workflow file for this run

name: build-and-test
on: [push]
permissions:
contents: read
pull-requests: read
env:
REGISTRY_DOCS_IMAGE: kitsudaiki/ainari_docs
AINARI_ADMIN_ID: asdf
AINARI_ADMIN_NAME: asdf
AINARI_ADMIN_PASSPHRASE: asdfasdf
RUSTFLAGS: "-Dwarnings"
jobs:
# 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
clippy-check:
name: cargo clippy
runs-on: ubuntu-24.04
steps:
-
name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler gcc ssh curl pkg-config libssl-dev libsqlite3-dev
sudo curl https://sh.rustup.rs -sSf | sh -s -- -y
-
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
-
name: Run Clippy
run: cargo clippy --all-targets --all-features
rustfmt-check:
name: cargo fmt
runs-on: ubuntu-latest
steps:
-
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
-
uses: actions-rust-lang/setup-rust-toolchain@fb51252c7ba57d633bc668f941da052e410add48
with:
components: rustfmt
-
name: Rustfmt Check
uses: actions-rust-lang/rustfmt@559aa3035a47390ba96088dffa783b5d26da9326
flake8-check:
name: "flake8 check"
runs-on: ubuntu-latest
env:
FORCE_COLOR: 1
steps:
-
uses: earthly/actions-setup@b81a8e082d9fae6174210cfc6e54bd2feb124d94
with:
version: "latest"
-
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:
-
name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y git python3 python3-venv python3-pip
-
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
-
name: Run check
run: |
python3 -m venv venv
source venv/bin/activate
pip3 install detect-secrets
git ls-files -z | xargs -0 detect-secrets-hook --baseline .secrets.baseline
build_python_package:
name: "Build SDK python-package"
needs: [ clippy-check, rustfmt-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/ainari_sdk
python3 setup.py bdist_wheel --universal
-
name: Copy files
run: |
mkdir /tmp/ainari_python_build_result
cd ${GITHUB_REPOSITORY#*/}/src/sdk/python/ainari_sdk/dist
ls -l
cp ./ainari_sdk-$PYTHON_PACKAGE_VERSION-py2.py3-none-any.whl /tmp/ainari_python_build_result/
-
name: Create artifact
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b
with:
name: ainari_python_build_result
path: /tmp/ainari_python_build_result
retention-days: 1
build_helm_package:
name: "Build Helm package"
needs: [ clippy-check, rustfmt-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/ainari
helm package --version $HELM_VERSION .
-
name: Copy files
run: |
mkdir /tmp/ainari_helm_build_result
cd ${GITHUB_REPOSITORY#*/}
cp ./deploy/k8s/ainari/ainari-$HELM_VERSION.tgz /tmp/ainari_helm_build_result/
-
name: Create artifact
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b
with:
name: ainari_helm_build_result
path: /tmp/ainari_helm_build_result
retention-days: 1
build_ainari_debug:
name: "Compile ainari (debug)"
needs: [ clippy-check, rustfmt-check, flake8-check, check-for-executables, commit-lint, detect-sectets ]
runs-on: ubuntu-latest
env:
FORCE_COLOR: 1
steps:
-
name: Install dependencies for SDK
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler gcc ssh curl pkg-config libssl-dev libsqlite3-dev
sudo curl https://sh.rustup.rs -sSf | sh -s -- -y
-
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 ainari
run: |
cd ${GITHUB_REPOSITORY#*/}
cargo build
-
name: Copy files
run: |
mkdir -p /tmp/ainari_debug_build_result/ainari/
cd ${GITHUB_REPOSITORY#*/}
cp ./target/debug/sakura /tmp/ainari_debug_build_result/ainari/
cp ./target/debug/miko /tmp/ainari_debug_build_result/ainari/
cp ./target/debug/ryokan /tmp/ainari_debug_build_result/ainari/
cp ./target/debug/hanami /tmp/ainari_debug_build_result/ainari/
cp ./target/debug/torii /tmp/ainari_debug_build_result/ainari/
cp ./target/debug/omamori /tmp/ainari_debug_build_result/ainari/
cp ./target/debug/onsen /tmp/ainari_debug_build_result/ainari/
-
name: Create artifact
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b
with:
name: ainari_debug_build_result
path: /tmp/ainari_debug_build_result
retention-days: 1
build_ainarictl:
name: "Compile CLI"
needs: [ clippy-check, rustfmt-check, flake8-check, check-for-executables, commit-lint, detect-sectets ]
runs-on: ubuntu-latest
env:
FORCE_COLOR: 1
steps:
-
uses: earthly/actions-setup@b81a8e082d9fae6174210cfc6e54bd2feb124d94
with:
version: "latest"
-
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/ainarictl ./builds/
-
name: Copy files
run: |
mkdir /tmp/ainarictl_build_result
cd ${GITHUB_REPOSITORY#*/}
cp -r builds/ainarictl /tmp/ainarictl_build_result/
-
name: Create artifact
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b
with:
name: ainarictl_build_result
path: /tmp/ainarictl_build_result
retention-days: 1
cargo_tests:
name: "Cargo Test"
needs: [ clippy-check, rustfmt-check, flake8-check, check-for-executables, commit-lint, detect-sectets ]
runs-on: ubuntu-latest
env:
FORCE_COLOR: 1
steps:
-
uses: earthly/actions-setup@b81a8e082d9fae6174210cfc6e54bd2feb124d94
with:
version: "latest"
-
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-ainari
sdk_api_tests:
name: "SDK-API-Tests"
needs: [ cargo_tests, build_ainari_debug, build_ainarictl, build_helm_package, build_python_package ]
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: ainari_python_build_result
path: /tmp/ainari_python_build_result
-
name: Get artifact
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16
with:
name: ainari_debug_build_result
path: /tmp/ainari_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/ainari_python_build_result
ls -l
pip3 install -U ainari_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 Sakura in background
run: |
cd ${GITHUB_REPOSITORY#*/}
export INTERNAL_API_KEY=test-internal-api-key && export SAKURA_REGISTRATION_KEY=sakura-key && export ONSEN_REGISTRATION_KEY=onsen-key
chmod +x /tmp/ainari_debug_build_result/ainari/hanami
chmod +x /tmp/ainari_debug_build_result/ainari/miko
chmod +x /tmp/ainari_debug_build_result/ainari/ryokan
chmod +x /tmp/ainari_debug_build_result/ainari/sakura
chmod +x /tmp/ainari_debug_build_result/ainari/torii
chmod +x /tmp/ainari_debug_build_result/ainari/omamori
chmod +x /tmp/ainari_debug_build_result/ainari/onsen
mkdir -p builds/binaries
sudo cp -r ./example_configs/ainari /etc/ainari
sudo chmod 777 -R /etc/ainari
/tmp/ainari_debug_build_result/ainari/hanami &
/tmp/ainari_debug_build_result/ainari/miko &
/tmp/ainari_debug_build_result/ainari/ryokan &
/tmp/ainari_debug_build_result/ainari/torii &
/tmp/ainari_debug_build_result/ainari/omamori &
# sleep to make sure, that hanami is started before sakura starts
sleep 10
/tmp/ainari_debug_build_result/ainari/sakura &
/tmp/ainari_debug_build_result/ainari/onsen &
# 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/
cp csv_test.csv test_dir/
cd test_dir
/usr/bin/python3 sdk_api_test.py
cli_api_tests:
name: "CLI-API-Tests"
needs: [ cargo_tests, build_ainari_debug, build_ainarictl, build_helm_package, build_python_package ]
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: ainari_debug_build_result
path: /tmp/ainari_debug_build_result
-
name: Get artifact
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16
with:
name: ainarictl_build_result
path: /tmp/ainarictl_build_result
-
name: Build local docker-image
run: |
chmod +x /tmp/ainarictl_build_result/ainarictl
cp /tmp/ainarictl_build_result/ainarictl ${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 Sakura in background
run: |
cd ${GITHUB_REPOSITORY#*/}
export INTERNAL_API_KEY=test-internal-api-key && export SAKURA_REGISTRATION_KEY=sakura-key && export ONSEN_REGISTRATION_KEY=onsen-key
chmod +x /tmp/ainari_debug_build_result/ainari/hanami
chmod +x /tmp/ainari_debug_build_result/ainari/miko
chmod +x /tmp/ainari_debug_build_result/ainari/ryokan
chmod +x /tmp/ainari_debug_build_result/ainari/sakura
chmod +x /tmp/ainari_debug_build_result/ainari/torii
chmod +x /tmp/ainari_debug_build_result/ainari/omamori
chmod +x /tmp/ainari_debug_build_result/ainari/onsen
mkdir -p builds/binaries
sudo cp -r ./example_configs/ainari /etc/ainari
sudo chmod 777 -R /etc/ainari
/tmp/ainari_debug_build_result/ainari/hanami &
/tmp/ainari_debug_build_result/ainari/miko &
/tmp/ainari_debug_build_result/ainari/ryokan &
/tmp/ainari_debug_build_result/ainari/torii &
/tmp/ainari_debug_build_result/ainari/omamori &
# sleep to make sure, that hanami is started before sakura starts
sleep 10
/tmp/ainari_debug_build_result/ainari/sakura &
/tmp/ainari_debug_build_result/ainari/onsen &
# 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 AINARI_ADDRESS=http://127.0.0.1:11417
export AINARI_USER=asdf
export AINARI_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, build_ainari_debug, build_ainarictl, build_helm_package, build_python_package ]
strategy:
fail-fast: false
matrix:
python_version:
- { 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_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: 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: ainari_python_build_result
path: /tmp/ainari_python_build_result
-
name: Get artifact
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16
with:
name: ainari_debug_build_result
path: /tmp/ainari_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/ainari_python_build_result
ls -l
pip3 install -U ainari_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 Sakura in background
run: |
cd ${GITHUB_REPOSITORY#*/}
export INTERNAL_API_KEY=test-internal-api-key && export SAKURA_REGISTRATION_KEY=sakura-key && export ONSEN_REGISTRATION_KEY=onsen-key
chmod +x /tmp/ainari_debug_build_result/ainari/hanami
chmod +x /tmp/ainari_debug_build_result/ainari/miko
chmod +x /tmp/ainari_debug_build_result/ainari/ryokan
chmod +x /tmp/ainari_debug_build_result/ainari/sakura
chmod +x /tmp/ainari_debug_build_result/ainari/torii
chmod +x /tmp/ainari_debug_build_result/ainari/omamori
chmod +x /tmp/ainari_debug_build_result/ainari/onsen
mkdir -p builds/binaries
sudo cp -r ./example_configs/ainari /etc/ainari
sudo chmod 777 -R /etc/ainari
/tmp/ainari_debug_build_result/ainari/hanami &
/tmp/ainari_debug_build_result/ainari/miko &
/tmp/ainari_debug_build_result/ainari/ryokan &
/tmp/ainari_debug_build_result/ainari/torii &
/tmp/ainari_debug_build_result/ainari/omamori &
# sleep to make sure, that hanami is started before sakura starts
sleep 10
/tmp/ainari_debug_build_result/ainari/sakura &
/tmp/ainari_debug_build_result/ainari/onsen &
# BINARY_PID=$!
# trap "kill $BINARY_PID" EXIT
-
name: Sleep for 15 seconds
uses: jakejarvis/wait-action@919fc193e07906705e5b7a50f90ea9e74d20b2b0
with:
time: '15s'
-
name: Install python
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f
with:
python-version: "${{ matrix.python_version.version }}"
-
name: Install ainari-sdk
run: |
cd /tmp/ainari_python_build_result
ls -l
pip install -U ainari_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: 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/
cp csv_test.csv test_dir/
cd test_dir
python sdk_api_test.py
# -
# name: Get log-output for debugging
# id: docker_log
# if: ${{ always() }}
# run: docker logs hanami
-
name: Update Result
id: status
if: ${{ always() }}
run: echo "${{ matrix.python_version.tag }}=${{ job.status }}" >> $GITHUB_OUTPUT
docker_build:
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/develop' || github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }}
name: "Build"
needs: [ sdk_api_tests, cli_api_tests ]
strategy:
fail-fast: false
matrix:
builds:
- { component: "hanami", platform: "linux/amd64", runner: "ubuntu-24.04", regitry: "kitsudaiki/hanami" }
- { component: "hanami", platform: "linux/arm64", runner: "ubuntu-24.04-arm", regitry: "kitsudaiki/hanami" }
- { component: "miko", platform: "linux/amd64", runner: "ubuntu-24.04", regitry: "kitsudaiki/miko" }
- { component: "miko", platform: "linux/arm64", runner: "ubuntu-24.04-arm", regitry: "kitsudaiki/miko" }
- { component: "ryokan", platform: "linux/amd64", runner: "ubuntu-24.04", regitry: "kitsudaiki/ryokan" }
- { component: "ryokan", platform: "linux/arm64", runner: "ubuntu-24.04-arm", regitry: "kitsudaiki/ryokan" }
- { component: "sakura", platform: "linux/amd64", runner: "ubuntu-24.04", regitry: "kitsudaiki/sakura" }
- { component: "sakura", platform: "linux/arm64", runner: "ubuntu-24.04-arm", regitry: "kitsudaiki/sakura" }
- { component: "torii", platform: "linux/amd64", runner: "ubuntu-24.04", regitry: "kitsudaiki/torii" }
- { component: "torii", platform: "linux/arm64", runner: "ubuntu-24.04-arm", regitry: "kitsudaiki/torii" }
- { component: "omamori", platform: "linux/amd64", runner: "ubuntu-24.04", regitry: "kitsudaiki/omamori" }
- { component: "omamori", platform: "linux/arm64", runner: "ubuntu-24.04-arm", regitry: "kitsudaiki/omamori" }
- { component: "onsen", platform: "linux/amd64", runner: "ubuntu-24.04", regitry: "kitsudaiki/onsen" }
- { component: "onsen", platform: "linux/arm64", runner: "ubuntu-24.04-arm", regitry: "kitsudaiki/onsen" }
- { component: "dashboard", platform: "linux/amd64", runner: "ubuntu-24.04", regitry: "kitsudaiki/ainari_dashboard" }
- { component: "dashboard", platform: "linux/arm64", runner: "ubuntu-24.04-arm", regitry: "kitsudaiki/ainari_dashboard" }
runs-on: ${{ matrix.builds.runner }}
steps:
-
name: Prepare
run: |
platform=${{ matrix.builds.platform }}
echo "PLATFORM_PAIR_COMPONENT=${platform//\//-}" >> $GITHUB_ENV
-
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: ${{ matrix.builds.regitry }}
-
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 ainari
ls -l
-
name: Build and push by digest
id: build
uses: docker/build-push-action@5176d81f87c23d6fc96624dfdbcd9f3830bbe445
with:
context: ./ainari
file: ./ainari/dockerfiles/Dockerfile_${{ matrix.builds.component }}
platforms: ${{ matrix.builds.platform }}
labels: ${{ steps.meta.outputs.labels }}
outputs: type=image,name=${{ matrix.builds.regitry }},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-${{ matrix.builds.component }}-${{ env.PLATFORM_PAIR_COMPONENT }}
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1
docker_merge:
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/develop' || github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }}
name: "Merge and push Docker-images"
runs-on: ubuntu-24.04
needs: [ docker_build ]
strategy:
fail-fast: false
matrix:
builds:
- { component: "hanami", regitry: "kitsudaiki/hanami" }
- { component: "miko", regitry: "kitsudaiki/miko" }
- { component: "ryokan", regitry: "kitsudaiki/ryokan" }
- { component: "sakura", regitry: "kitsudaiki/sakura" }
- { component: "torii", regitry: "kitsudaiki/torii" }
- { component: "omamori", regitry: "kitsudaiki/omamori" }
- { component: "onsen", regitry: "kitsudaiki/onsen" }
- { component: "dashboard", regitry: "kitsudaiki/ainari_dashboard" }
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-${{ matrix.builds.component }}-*
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: ${{ matrix.builds.regitry }}
-
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 ${{ matrix.builds.regitry }}:${{ env.BRANCH_NAME }} \
$(printf '${{ matrix.builds.regitry }}@sha256:%s ' *)
-
name: Inspect image
run: |
docker buildx imagetools inspect ${{ matrix.builds.regitry }}:${{ 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_30", name: "Kubernetes 1.30", version: "1.30.12"}
- { tag: "kubernetes-1_31", name: "Kubernetes 1.31", version: "1.31.8"}
- { tag: "kubernetes-1_32", name: "Kubernetes 1.32", version: "1.32.4"}
- { tag: "kubernetes-1_33", name: "Kubernetes 1.33", version: "1.33.0"}
name: "${{ matrix.kubernetes_version.name }}"
outputs:
kubernetes-1_30: ${{ steps.status.outputs.kubernetes-1_30 }}
kubernetes-1_31: ${{ steps.status.outputs.kubernetes-1_31 }}
kubernetes-1_32: ${{ steps.status.outputs.kubernetes-1_32 }}
kubernetes-1_33: ${{ steps.status.outputs.kubernetes-1_33 }}
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: ainari_python_build_result
path: /tmp/ainari_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/ainari_python_build_result
ls -l
pip3 install -U ainari_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: ainari_helm_build_result
path: /tmp/ainari_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: Create wireguard-configs
run: |
sudo apt-get install -y wireguard-tools
pip3 install jinja2
cd ${GITHUB_REPOSITORY#*/}/deploy/k8s
python3 wg_gen.py --namespace default
-
name: Label nodes
run: |
kubectl label nodes --all hanami-node=true
kubectl label nodes --all miko-node=true
kubectl label nodes --all ryokan-node=true
kubectl label nodes --all sakura-node=true
kubectl label nodes --all torii-node=true
kubectl label nodes --all omamori-node=true
kubectl label nodes --all onsen-node=true
kubectl label nodes --all dashboard-node=true
-
name: Install hanami
run: |
helm install --set docker.tag="${{ env.BRANCH_NAME }}" --set miko.user.id=asdf --set miko.user.name="test user" --set miko.user.passphrase="asdfasdf" --set miko.token.data="this is a test-token" ainari /tmp/ainari_helm_build_result/ainari-$HELM_VERSION.tgz
-
name: Sleep for 120 seconds
uses: jakejarvis/wait-action@919fc193e07906705e5b7a50f90ea9e74d20b2b0
with:
time: '120s'
-
name: Check kubernetes-resources
run: |
kubectl get pods
kubectl get configmaps
kubectl get deployments
kubectl get storageclass
kubectl describe $(kubectl get pod -o name | grep ^pod/hanami)
df -h
ls -l /mnt/
-
name: Update hosts-file
run: |
ingress_ip_hanami=$(kubectl get ingress hanami-ingress -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo "$ingress_ip_hanami local-hanami" | sudo tee -a /etc/hosts
ingress_ip_miko=$(kubectl get ingress miko-ingress -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo "$ingress_ip_miko local-miko" | sudo tee -a /etc/hosts
ingress_ip_ryokan=$(kubectl get ingress ryokan-ingress -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo "$ingress_ip_ryokan local-ryokan" | sudo tee -a /etc/hosts
ingress_ip_torii=$(kubectl get ingress torii-ingress -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo "$ingress_ip_torii local-torii" | sudo tee -a /etc/hosts
ingress_ip_omamori=$(kubectl get ingress omamori-ingress -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo "$ingress_ip_omamori local-omamori" | 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/ainari /etc/
sudo sed -i 's/address = http:\/\/127\.0\.0\.1:11418/address = https:\/\/local-hanami/g' /etc/ainari/hanami_testing.conf
sudo sed -i 's/address = http:\/\/127\.0\.0\.1:11417/address = https:\/\/local-miko/g' /etc/ainari/hanami_testing.conf
sudo sed -i 's/address = http:\/\/127\.0\.0\.1:11416/address = https:\/\/local-ryokan/g' /etc/ainari/hanami_testing.conf
sudo sed -i 's/address = http:\/\/127\.0\.0\.1:11416/address = https:\/\/local-sakura/g' /etc/ainari/hanami_testing.conf
sudo sed -i 's/address = http:\/\/127\.0\.0\.1:11416/address = https:\/\/local-torii/g' /etc/ainari/hanami_testing.conf
sudo sed -i 's/address = http:\/\/127\.0\.0\.1:11416/address = https:\/\/local-omamori/g' /etc/ainari/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/
cp csv_test.csv test_dir/
cd test_dir
/usr/bin/python3 sdk_api_test.py
-
name: Print logs of the hanami-pod to make debugging easier in case of an error
if: ${{ always() }}
run: kubectl logs -c hanami $(kubectl get pods --no-headers -o custom-columns=":metadata.name" | grep '^hanami-')
-
name: Print logs of the miko-pod to make debugging easier in case of an error
if: ${{ always() }}
run: kubectl logs -c miko $(kubectl get pods --no-headers -o custom-columns=":metadata.name" | grep '^miko-')
-
name: Print logs of the ryokan-pod to make debugging easier in case of an error
if: ${{ always() }}
run: kubectl logs -c ryokan $(kubectl get pods --no-headers -o custom-columns=":metadata.name" | grep '^ryokan-')
-
name: Print logs of the sakura-pod to make debugging easier in case of an error
if: ${{ always() }}
run: kubectl logs -c sakura $(kubectl get pods --no-headers -o custom-columns=":metadata.name" | grep '^sakura-')
-
name: Print logs of the torii-pod to make debugging easier in case of an error
if: ${{ always() }}
run: kubectl logs -c torii $(kubectl get pods --no-headers -o custom-columns=":metadata.name" | grep '^torii-')
-
name: Print logs of the omamori-pod to make debugging easier in case of an error
if: ${{ always() }}
run: kubectl logs -c omamori $(kubectl get pods --no-headers -o custom-columns=":metadata.name" | grep '^omamori-')
-
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 ]
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 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: [ docker_merge ]
runs-on: ubuntu-24.04
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@b81a8e082d9fae6174210cfc6e54bd2feb124d94
with:
version: "latest"
-
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: [ docker_merge ]
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: ainarictl_build_result
path: /tmp/ainarictl_build_result
-
name: Get helm-chart artifact
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16
with:
name: ainari_helm_build_result
path: /tmp/ainari_helm_build_result
-
name: Get artifact
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16
with:
name: ainari_python_build_result
path: /tmp/ainari_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 ~/ainari_file_share/$BRANCH_NAME"
ssh ${{ secrets.SHARE_SSH_ACCESS }} "mkdir -p ~/ainari_file_share/$BRANCH_NAME/helm-chart"
ssh ${{ secrets.SHARE_SSH_ACCESS }} "mkdir -p ~/ainari_file_share/$BRANCH_NAME/python-package"
ssh ${{ secrets.SHARE_SSH_ACCESS }} "mkdir -p ~/ainari_file_share/$BRANCH_NAME/client"
-
name: Upload ainarictl
run: |
cd /tmp/ainarictl_build_result
tar -czvf ainarictl_amd64_$BRANCH_NAME.tar.gz ainarictl
scp ainarictl_amd64_$BRANCH_NAME.tar.gz ${{ secrets.SHARE_SSH_ACCESS }}:~/ainari_file_share/$BRANCH_NAME/client/
-
name: Upload helm-chart
run: |
scp /tmp/ainari_helm_build_result/ainari-$HELM_VERSION.tgz ${{ secrets.SHARE_SSH_ACCESS }}:~/ainari_file_share/$BRANCH_NAME/helm-chart/
-
name: Upload pip-package
run: |
scp /tmp/ainari_python_build_result/ainari_sdk-$PYTHON_PACKAGE_VERSION-py2.py3-none-any.whl ${{ secrets.SHARE_SSH_ACCESS }}:~/ainari_file_share/$BRANCH_NAME/python-package/