ci: compatibility check workflows concretelib/llvm

This commit is contained in:
youben11
2021-10-07 12:57:59 +01:00
committed by Ayoub Benaissa
parent bfc763144c
commit 8535ab797e
3 changed files with 187 additions and 0 deletions

View File

@@ -0,0 +1,73 @@
name: Concrete-lib Compatibility
on:
workflow_dispatch:
schedule:
- cron: '0 00 * * 1-5' # Everyday @ 00:00 from Monday to Friday
jobs:
build_publish:
name: Test the Docker image with latest concrete-ffi
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Compare image timestamps
continue-on-error: true
run: |
./.github/workflows/scripts/container_timestamp_check.sh \
--base_img_url \
https://api.github.com/orgs/zama-ai/packages/container/concrete-api-env/versions \
--env_img_url \
https://api.github.com/orgs/zama-ai/packages/container/zamalang-compiler/versions \
--token ${{ secrets.BOT_TOKEN }}
- name: Send Slack Notification
if: ${{ failure() }}
continue-on-error: true
uses: rtCamp/action-slack-notify@12e36fc18b0689399306c2e0b3e0f2978b7f1ee7
env:
SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL }}
SLACK_ICON: https://pbs.twimg.com/profile_images/1274014582265298945/OjBKP9kn_400x400.png
SLACK_COLOR: success
SLACK_MESSAGE: "No new update on Concrete-FFI, skipping compatibility check"
SLACK_USERNAME: ${{ secrets.BOT_USERNAME }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
- name: Get the concrete CAPI release
if: ${{ success() }}
uses: addnab/docker-run-action@v3
with:
registry: ghcr.io
image: ghcr.io/zama-ai/concrete-api-env:latest
username: ${{ secrets.GHCR_LOGIN }}
password: ${{ secrets.GHCR_PASSWORD }}
options: -v ${{ github.workspace }}:/workspace
run: mkdir -p /workspace/concrete/target && cp -r /target/release /workspace/concrete/target
- name: Test compiler with latest concrete-ffi
if: ${{ success() }}
uses: addnab/docker-run-action@v3
with:
image: ghcr.io/zama-ai/zamalang-compiler
options: -v /workspace/concrete:/concrete
run: |
cd /compiler
pip install pytest
export CONCRETE_PROJECT=/concrete
make -B BUILD_DIR=/build build
make BUILD_DIR=/build test
- name: Send Slack Notification
if: ${{ always() }}
continue-on-error: true
uses: rtCamp/action-slack-notify@12e36fc18b0689399306c2e0b3e0f2978b7f1ee7
env:
SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL }}
SLACK_ICON: https://pbs.twimg.com/profile_images/1274014582265298945/OjBKP9kn_400x400.png
SLACK_COLOR: ${{ job.status }}
SLACK_MESSAGE: "Compatibility check with Concrete-FFI finished with status ${{ job.status }} \
(${{ env.ACTION_RUN_URL }})"
SLACK_USERNAME: ${{ secrets.BOT_USERNAME }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}

View File

@@ -0,0 +1,47 @@
name: LLVM Compatibility
on:
workflow_dispatch:
schedule:
- cron: '0 00 * * 1-5' # Everyday @ 00:00 from Monday to Friday
jobs:
build_test:
name: Build & test the Docker image with latest LLVM
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Update LLVM
run: git submodule update --remote
- name: Log LLVM commit
run: echo "LLVM commit" && cd ${{ github.workspace }}/llvm-project && git log -1
- name: Build
run: docker image build --no-cache -t compiler-latest-llvm -f builders/Dockerfile.zamalang-env .
- name: Test compiler with latest LLVM
uses: addnab/docker-run-action@v3
with:
image: compiler-latest-llvm
run: |
cd /compiler
pip install pytest
make BUILD_DIR=/build test
- name: Send Slack Notification
if: ${{ always() }}
continue-on-error: true
uses: rtCamp/action-slack-notify@12e36fc18b0689399306c2e0b3e0f2978b7f1ee7
env:
SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL }}
SLACK_ICON: https://pbs.twimg.com/profile_images/1274014582265298945/OjBKP9kn_400x400.png
SLACK_COLOR: ${{ job.status }}
SLACK_MESSAGE: "Compatibility check with latest LLVM finished with status ${{ job.status }} \
(${{ env.ACTION_RUN_URL }})"
SLACK_USERNAME: ${{ secrets.BOT_USERNAME }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}

View File

@@ -0,0 +1,67 @@
#!/bin/bash -e
set -e
BASE_IMG_ENDPOINT_URL=
ENV_IMG_ENDPOINT_URL=
TOKEN=
while [ -n "$1" ]
do
case "$1" in
"--base_img_url" )
shift
BASE_IMG_ENDPOINT_URL="$1"
;;
"--env_img_url" )
shift
ENV_IMG_ENDPOINT_URL="$1"
;;
"--token" )
shift
TOKEN="$1"
;;
*)
echo "Unknown param : $1"
exit 1
;;
esac
shift
done
BASE_JSON=$(curl \
-X GET \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${TOKEN}" \
"${BASE_IMG_ENDPOINT_URL}")
BASE_IMG_TIMESTAMP=$(echo "${BASE_JSON}" | jq -r 'sort_by(.updated_at)[-1].updated_at')
ENV_JSON=$(curl \
-X GET \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${TOKEN}" \
"${ENV_IMG_ENDPOINT_URL}")
ENV_IMG_TIMESTAMP=$(echo "${ENV_JSON}" | \
jq -rc '.[] | select(.metadata.container.tags[] | contains("latest")).updated_at')
echo "Base timestamp: ${BASE_IMG_TIMESTAMP}"
echo "Env timestamp: ${ENV_IMG_TIMESTAMP}"
BASE_IMG_DATE=$(date -d "${BASE_IMG_TIMESTAMP}" +%s)
ENV_IMG_DATE=$(date -d "${ENV_IMG_TIMESTAMP}" +%s)
echo "Base epoch: ${BASE_IMG_DATE}"
echo "Env epoch: ${ENV_IMG_DATE}"
if [[ "${BASE_IMG_DATE}" -ge "${ENV_IMG_DATE}" ]]; then
echo "Env image out of date, sending rebuild request."
exit 0
else
echo "Image up to date, nothing to do."
exit 1
fi