Skip to content

Commit

Permalink
Add VOD deployment job to GitHub workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
gbryant-arm committed Mar 23, 2023
1 parent d1793d8 commit d8ac13b
Showing 1 changed file with 95 additions and 197 deletions.
292 changes: 95 additions & 197 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,210 +12,108 @@ on:
workflow_dispatch:

jobs:
check:
vod-full-deployment:
needs: []
runs-on: ubuntu-latest
steps:
- name: Install cosign
# https://github.com/sigstore/cosign-installer
uses: sigstore/cosign-installer@9becc617647dfa20ae7b1151972e9b3a2c338a2b # v2.8.1
with:
cosign-release: "v1.13.1"
- name: Check image signature
id: cosign-verify
run: |
COSIGN_EXPERIMENTAL=true cosign verify \
ghcr.io/veracruz-project/veracruz/ci@sha256:f9c1d079ce0fc404ec8a9c5f6c70a52fc5e52dc4866847d1b66260006207f67b
linux:
runs-on: ubuntu-latest
needs: [check]
outputs:
output: ${{ steps.check-diff.outputs.cargo-lock }}
container:
image: ghcr.io/veracruz-project/veracruz/ci@sha256:38add618b42f59a89fdd4c46831dcf9c9e73b159bc74c87251c8263a2ec6238a
volumes:
- ${{ github.workspace }}:/work/veracruz
steps:
- name: Check out the Veracruz repository
uses: actions/checkout@v3
with:
submodules: recursive
- name: Running linux test script
id: linux-build-and-test
run: |
make -C /work/veracruz/workspaces linux-tests
- name: Move back to veracruz root
run: |
cd /work/veracruz
git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Check modification to Cargo.lock
id: check-diff
run: |
# Find if any Cargo.lock changed, pad them into a line and trim leading and trailing whitespace.
file_changed=$(git diff --diff-filter=ACMUXTRD --name-only -- '**Cargo.lock' | tr '\n' ' ' | xargs)
echo "cargo-lock=$file_changed" >> $GITHUB_OUTPUT
if [ -n "$file_changed" ] ; then
echo "::warning::Cargo.lock files modified";
echo "::warning::Cargo.lock change list: ${{ steps.check-diff.outputs.cargo-lock }}";
fi
- name: Upload Cargo.lock files
id: upload-changed-cargo-lock
if: steps.check-diff.outputs.cargo-lock != ''
uses: actions/upload-artifact@v3
with:
name: linux
path: workspaces/**/Cargo.lock

nitro:
runs-on: ubuntu-latest
needs: [check]
outputs:
output: ${{ steps.check-diff.outputs.cargo-lock }}
container:
image: ghcr.io/veracruz-project/veracruz/ci@sha256:38add618b42f59a89fdd4c46831dcf9c9e73b159bc74c87251c8263a2ec6238a
volumes:
- ${{ github.workspace }}:/work/veracruz
- ${{ github.workspace }}:/work/video-object-detection
steps:
- name: Check out the Veracruz repository
- name: Check out the VOD repository
uses: actions/checkout@v3
with:
repository: 'veracruz-project/video-object-detection'
ref: 'main'
submodules: recursive
- name: add the GITHUB_WORKSPACE into git config
run: |
git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Running Nitro test script
id: nitro-build
set-safe-directory: true
- name: Install dependencies
run: |
make -C /work/veracruz/workspaces nitro
- name: Check modification to Cargo.lock
id: check-diff
run: |
file_changed=$(git diff --diff-filter=ACMUXTRD --name-only -- '**Cargo.lock' | tr '\n' ' ' | xargs)
echo "cargo-lock=$file_changed" >> $GITHUB_OUTPUT
if [ -n "$file_changed" ] ; then
echo "::warning::Cargo.lock files modified";
echo "::warning::Cargo.lock change list: ${{ steps.check-diff.outputs.cargo-lock }}";
fi
- name: Upload Cargo.lock files
id: upload-changed-cargo-lock
if: steps.check-diff.outputs.cargo-lock != ''
uses: actions/upload-artifact@v3
with:
name: nitro
path: workspaces/**/Cargo.lock

icecap:
runs-on: ubuntu-latest
needs: [check]
outputs:
output: ${{ steps.check-diff.outputs.cargo-lock }}
container:
image: ghcr.io/veracruz-project/veracruz/ci@sha256:38add618b42f59a89fdd4c46831dcf9c9e73b159bc74c87251c8263a2ec6238a
volumes:
- ${{ github.workspace }}:/work/veracruz
steps:
- name: Check out the Veracruz repository
uses: actions/checkout@v3
with:
submodules: recursive
- name: add the GITHUB_WORKSPACE into git config
run: |
git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Running IceCap test script
id: icecap-build
run: |
VERACRUZ_TEST_TIMEOUT=2400 make -C /work/veracruz/workspaces icecap-tests PROFILE=release
- name: Check modification to Cargo.lock
id: check-diff
run: |
file_changed=$(git diff --diff-filter=ACMUXTRD --name-only -- '**Cargo.lock' | tr '\n' ' ' | xargs)
echo "cargo-lock=$file_changed" >> $GITHUB_OUTPUT
if [ -n "$file_changed" ] ; then
echo "::warning::Cargo.lock files modified";
echo "::warning::Cargo.lock change list: ${{ steps.check-diff.outputs.cargo-lock }}";
fi
- name: Upload Cargo.lock files
id: upload-changed-cargo-lock
if: steps.check-diff.outputs.cargo-lock != ''
uses: actions/upload-artifact@v3
with:
name: icecap
path: workspaces/**/Cargo.lock

# tests that the CLI_QUICKSTART.markdown is still up to date
quickstart:
runs-on: ubuntu-latest
needs: [check]
outputs:
output: ${{ steps.check-diff.outputs.cargo-lock }}
container:
image: ghcr.io/veracruz-project/veracruz/ci@sha256:38add618b42f59a89fdd4c46831dcf9c9e73b159bc74c87251c8263a2ec6238a
volumes:
- ${{ github.workspace }}:/work/veracruz
steps:
- name: Check out the Veracruz repository
uses: actions/checkout@v3
with:
submodules: recursive
- name: add the GITHUB_WORKSPACE into git config
run: |
git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Running CLI_QUICKSTART.markdown
id: quickstart-test
run: |
# grab every bash code block, remove line continuation, and only keep lines
# that start with '$' (of course removing that '$' in the process)
sed -n '/``` bash/,/```/{/```/d; p}' CLI_QUICKSTART.markdown \
# grab every bash code block for this step, remove line continuation,
# and only keep lines that start with '$' (of course removing that '$'
# in the process)
sed -n '/``` bash ci-step1/,/```/{/```/d; p}' README.md \
| sed ':a; /\\$/{N; s/\\\n//; ta}' \
| sed -n '/^\$/{s/^\$ \?//; p}' \
> CLI_QUICKSTART.markdown.sh
# run the quickstart
bash -euxo pipefail CLI_QUICKSTART.markdown.sh
- name: Running tlstest/README.md
id: tlstest
run: |
# Extract and execute bash code blocks from README.md:
cd tests/tlstest && \
sed -n '/``` bash/,/```/{/```/d; p}' README.md > README.md.sh && \
bash -euxo pipefail README.md.sh
- name: Check modification to Cargo.lock
id: check-diff
run: |
file_changed=$(git diff --diff-filter=ACMUXTRD --name-only -- '**Cargo.lock' | tr '\n' ' ' | xargs)
echo "cargo-lock=$file_changed" >> $GITHUB_OUTPUT
if [ -n "$file_changed" ] ; then
echo "::warning::Cargo.lock files modified";
echo "::warning::Cargo.lock change list: ${{ steps.check-diff.outputs.cargo-lock }}";
fi
- name: Upload Cargo.lock files
id: upload-changed-cargo-lock
if: steps.check-diff.outputs.cargo-lock != ''
uses: actions/upload-artifact@v3
with:
name: quickstart
path: workspaces/**/Cargo.lock

cargo-lock-check:
needs: [linux, nitro, icecap, quickstart]
runs-on: ubuntu-latest
steps:
- name: linux
if: needs.linux.outputs.output != ''
run: |
echo "::warning:: linux Cargo.lock change list: ${{ needs.linux.outputs.output }}"
exit 1
- name: nitro
if: needs.nitro.outputs.output != ''
run: |
echo "::warning:: nitro Cargo.lock change list: ${{ needs.nitro.outputs.output }}"
exit 1
- name: icecap
if: needs.icecap.outputs.output != ''
run: |
echo "::warning:: icecap Cargo.lock change list: ${{ needs.icecap.outputs.output }}"
exit 1
- name: quickstart
if: needs.quickstart.outputs.output != ''
run: |
echo "::warning:: quickstart Cargo.lock change list: ${{ needs.quickstart.outputs.output }}"
exit 1
| sed -n '/^ *\$/{s/^ *\$ \?//; p}' \
> README.md.ci-step1.sh
# run the script
#bash -euxo pipefail README.md.ci-step1.sh
export WASI_VERSION=14 && \
export WASI_VERSION_FULL=${WASI_VERSION}.0 && \
wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_VERSION}/wasi-sdk-${WASI_VERSION_FULL}-linux.tar.gz && \
tar xvf wasi-sdk-${WASI_VERSION_FULL}-linux.tar.gz && \
echo "export WASI_SDK_ROOT=\"${PWD}/wasi-sdk-${WASI_VERSION_FULL}\"" >> ~/.bashrc
apt-get update && apt-get install -y imagemagick nasm
cat ~/.bashrc # TODO
- name: Build video-object-detection
run: |
# grab every bash code block for this step, remove line continuation,
# and only keep lines that start with '$' (of course removing that '$'
# in the process)
sed -n '/``` bash ci-step2/,/```/{/```/d; p}' README.md \
| sed ':a; /\\$/{N; s/\\\n//; ta}' \
| sed -n '/^ *\$/{s/^ *\$ \?//; p}' \
> README.md.ci-step2.sh
# run the script
#bash -euxo pipefail README.md.ci-step1.sh
cat ~/.bashrc # TODO
echo $WASI_SDK_ROOT
make
make -f Makefile_native
make yolo_detection
- name: Download and install binaries from build
run: |
mkdir -p $PWD/linux-host/target/debug $PWD/linux-runtime/target/debug
wget -P $PWD/linux-host/target/debug \
https://github.com/veracruz-project/video-object-detection/releases/download/iotex-demo-v1.3.3/generate-policy \
https://github.com/veracruz-project/video-object-detection/releases/download/iotex-demo-v1.3.3/veracruz-client \
https://github.com/veracruz-project/video-object-detection/releases/download/iotex-demo-v1.3.3/veracruz-server
wget -P $PWD/linux-runtime/target/debug \
https://github.com/veracruz-project/video-object-detection/releases/download/iotex-demo-v1.3.3/runtime_manager_enclave
echo "export PATH=\"$PWD/linux-host/target/debug/:$PATH\"" >> ~/.bashrc
echo "export PATH=\"$PWD/linux-runtime/target/debug/:$PATH\"" >> ~/.bashrc
- name: Download video # TODO remove this step
run: |
mkdir -p $PWD/video_input && \
wget -P $PWD/video_input https://github.com/veracruz-project/video-object-detection/releases/download/iotex-demo-v1.3.3/in.h264
- name: Run video-object-detection as standalone binary
run: |
# grab every bash code block for this step, remove line continuation,
# and only keep lines that start with '$' (of course removing that '$'
# in the process)
sed -n '/``` bash ci-step3/,/```/{/```/d; p}' README.md \
| sed ':a; /\\$/{N; s/\\\n//; ta}' \
| sed -n '/^ *\$/{s/^ *\$ \?//; p}' \
> README.md.ci-step3.sh
# run the script
#bash -euxo pipefail README.md.ci-step2.sh
mkdir output && ./detector
# Verify result
file output/prediction.0.jpg | grep "JPEG image data"
- name: Run video-object-detection in wasmtime
run: |
# grab every bash code block for this step, remove line continuation,
# and only keep lines that start with '$' (of course removing that '$'
# in the process)
sed -n '/``` bash ci-step4/,/```/{/```/d; p}' README.md \
| sed ':a; /\\$/{N; s/\\\n//; ta}' \
| sed -n '/^ *\$/{s/^ *\$ \?//; p}' \
> README.md.ci-step4.sh
# run the script
#bash -euxo pipefail README.md.ci-step3.sh
curl https://wasmtime.dev/install.sh -sSf | bash && . ~/.bashrc
mkdir output && wasmtime --dir=. ./detector.wasm
file output/prediction.0.jpg | grep "JPEG image data"
- name: Run video-object-detection in Freestanding Execution Engine
run: |
# grab every bash code block for this step, remove line continuation,
# and only keep lines that start with '$' (of course removing that '$'
# in the process)
sed -n '/``` bash ci-step5/,/```/{/```/d; p}' README.md \
| sed ':a; /\\$/{N; s/\\\n//; ta}' \
| sed -n '/^ *\$/{s/^ *\$ \?//; p}' \
> README.md.ci-step5.sh
# run the script
#bash -euxo pipefail README.md.ci-step4.sh
#- name: Run video-object-detection in Veracruz-Linux
# run: |

0 comments on commit d8ac13b

Please sign in to comment.