Skip to content

chore: Update API version #332

chore: Update API version

chore: Update API version #332

Workflow file for this run

name: DeployTest
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
versionning:
name: Versionning
runs-on: ubuntu-latest
outputs:
version: ${{ steps.genver.outputs.version }}
release: ${{ steps.genver.outputs.release }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
fetch-depth: 0
- name: Generate Version
id: genver
run: |
VERSION=$(docker run --rm -v $(pwd):/repo codacy/git-version /bin/git-version --folder=/repo --release-branch=${{ github.ref_name }}-pre --dev-branch=main)
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "VERSION : $VERSION"
RELEASE=$(docker run --rm -v $(pwd):/repo codacy/git-version /bin/git-version --folder=/repo --release-branch=${{ github.ref_name }} --dev-branch=main)
echo "release=$RELEASE" >> $GITHUB_OUTPUT
echo "RELEASE : $RELEASE"
echo "Version :" >> $GITHUB_STEP_SUMMARY
echo "$VERSION" >> $GITHUB_STEP_SUMMARY
echo "Release :" >> $GITHUB_STEP_SUMMARY
echo "$RELEASE" >> $GITHUB_STEP_SUMMARY
format:
name: Format C++
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
fetch-depth: 0
- name: Run clang-format
run: |
sudo apt-get update
sudo apt-get install -y clang-format
- name: Check Diff
id: check-diff
run: |
git ls-files *.{c,h,hpp,cpp,cc} | xargs clang-format -style=file:.clang-format -i
DIFF="$(git diff --name-only)"
if [ -z "$DIFF" ]; then
echo "OK: Format is clean"
else
echo "Error: Format was not clean"
echo "List of files:"
echo "$DIFF"
git diff
exit 1
fi
- name: Generate patch
if: ${{ failure() && steps.check-diff.conclusion == 'failure' }}
run: |
git diff > patch-cpp.diff
- uses: actions/upload-artifact@v3
if: ${{ failure() && steps.check-diff.conclusion == 'failure' }}
with:
name: patch-cpp
path: ./patch-cpp.diff
build-cpp-packages:
name: Build C++ Packages
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
dist: ["Alpine", "RedHat", "Ubuntu"]
needs: [versionning]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
- name: Install ArmoniK Dependencies
uses: aneoconsulting/ArmoniK.Action.Deploy/dependencies@main
with:
docker: true
terraform: true
k3s: true
aws: true
- name: Checkout Infra
uses: actions/checkout@v3
with:
repository: aneoconsulting/ArmoniK
path: infra
- name: Build C++ SDK
id: build
run: |
source ./tools/common.sh
export ARMONIK_SHARED_HOST_PATH=${{ github.workspace }}/infra/infrastructure/quick-deploy/localhost/all-in-one/data
export WORKER_IMG="dockerhubaneo/armonik-sdk-cpp-dynamicworker"
export CLIENT_IMG="dockerhubaneo/armonik-sdk-client-test"
export WORKER_TEST_IMG="dockerhubaneo/armonik-sdk-worker-test"
./tools/build-deploy-end2end.sh "${{ matrix.dist }}" "$WORKER_IMG" "${{ needs.versionning.outputs.version}}" "$ARMONIK_API_VERSION_DEFAULT" "$WORKER_TEST_IMG"
./tools/build-client.sh "$CLIENT_IMG" "${{ needs.versionning.outputs.version}}" "$API_VERSION"
export WORKER_VERSION="${{ needs.versionning.outputs.version}}-$(echo "${{ matrix.dist }}" | awk '{print tolower($0)}')"
docker save "$WORKER_IMG:$WORKER_VERSION" | sudo k3s ctr images import /dev/stdin
echo "worker_img=$WORKER_IMG" >> $GITHUB_OUTPUT
echo "worker_version=$WORKER_VERSION" >> $GITHUB_OUTPUT
echo "client_img=$CLIENT_IMG" >> $GITHUB_OUTPUT
echo "client_version=${{ needs.versionning.outputs.version}}" >> $GITHUB_OUTPUT
echo "worker_test_img=$WORKER_TEST_IMG" >> $GITHUB_OUTPUT
- name: Login Docker
run: echo ${{ secrets.DOCKER_HUB_TOKEN }} | docker login -u ${{ secrets.DOCKER_HUB_LOGIN }} --password-stdin
- name: Override parameters tfvars
run: |
cat ${{ github.workspace }}/infra/versions.tfvars.json | jq --arg worker "${{ steps.build.outputs.worker_img }}" --arg version "${{ steps.build.outputs.worker_version }}" '.armonik_versions.samples=$version | .armonik_images.samples+=[$worker]' > .versions.tfvars.json
mv .versions.tfvars.json ${{ github.workspace }}/infra/versions.tfvars.json
- id: deploy
name: Deploy
uses: aneoconsulting/ArmoniK.Action.Deploy/deploy@main
with:
working-directory: ${{ github.workspace }}/infra
type: localhost
core-version: 0.28.0
- name: Run Client tests
timeout-minutes: 5
run: |
set -ex
kubectl set image deployment/compute-plane-default -n armonik worker-0=${{ steps.build.outputs.worker_img}}:${{ steps.build.outputs.worker_version }}
export CPIP=$(kubectl get svc control-plane -n armonik -o custom-columns="IP:.spec.clusterIP" --no-headers=true)
export CPPort=$(kubectl get svc control-plane -n armonik -o custom-columns="PORT:.spec.ports[*].port" --no-headers=true)
docker run --rm -t --network host -e GrpcClient__Endpoint=http://$CPIP:$CPPort -e WorkerLib__Version="${{ needs.versionning.outputs.version}}" "${{ steps.build.outputs.client_img}}:${{ needs.versionning.outputs.version}}"
- name: Push Docker
run: |
docker push "${{ steps.build.outputs.worker_img}}:${{ steps.build.outputs.worker_version }}"
docker push "${{ steps.build.outputs.worker_test_img}}":"build-${{ matrix.dist }}"
docker push "${{ steps.build.outputs.client_img}}:${{ steps.build.outputs.client_version }}"
build-upload-artifact:
strategy:
fail-fast: false
matrix:
type: [tar.gz, deb, rpm]
name: Build C++ Packages [${{ matrix.type }}]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
with:
ref: ${{ github.ref }}
- name: Build and upload tgz, rpm and deb packages
run: |
cd tools/packaging
./make-${{ matrix.type }}.sh
- name: Publish package as artefact
uses: actions/upload-artifact@65d862660abb392b8c4a3d1195a2108db131dd05
with:
if-no-files-found: error
path: tools/packaging/*.${{ matrix.type }}
name: armoniksdk.${{ matrix.type }}