Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
jonlamb-gh committed Feb 13, 2024
1 parent cf34b05 commit 1f8dd48
Show file tree
Hide file tree
Showing 51 changed files with 4,126 additions and 0 deletions.
138 changes: 138 additions & 0 deletions .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
name: Integration Tests
#on: [workflow_dispatch]
on: [push]

env:
MODALITY_URL: "http://localhost:14181/v1"
MODALITY_WORKSPACE: "ci-tests"
RENODE_CI_MODE: YES

jobs:
demo:
name: Run, collect, and test
timeout-minutes: 30
runs-on: ubuntu-22.04
steps:
- name: Print Environment
run: |
echo "GITHUB_WORKFLOW=$GITHUB_WORKFLOW"
echo "GITHUB_RUN_ID=$GITHUB_RUN_ID"
echo "GITHUB_RUN_NUMBER=$GITHUB_RUN_NUMBER"
echo "GITHUB_JOB=$GITHUB_JOB"
echo "GITHUB_ACTION=$GITHUB_ACTION"
echo "GITHUB_ACTOR=$GITHUB_ACTOR"
echo "GITHUB_REF=$GITHUB_REF"
echo "GITHUB_SHA=$GITHUB_SHA"
docker --version
- name: Checkout Sources
uses: actions/checkout@v4

- name: Install system packages
run: |
sudo apt-get update
sudo apt-get install -y libusb-1.0-0-dev libftdi1-dev libudev-dev bridge-utils gcc-arm-none-eabi binutils-arm-none-eabi
- name: Install renode (latest)
run: |
cd /opt
sudo wget --quiet --output-document renode.tar.gz https://builds.renode.io/renode-latest.linux-portable.tar.gz
sudo mkdir renode
sudo tar xf renode.tar.gz -C renode --strip-components 1
sudo pip install -r /opt/renode/tests/requirements.txt
echo "PATH=/opt/renode:${PATH}" >> $GITHUB_ENV
- name: Install toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
toolchain: stable

- name: Build release binary
run: cargo build --release

- name: Install Auxon packages
env:
DEBIAN_FRONTEND: noninteractive
run: |
wget --no-verbose --quiet https://get.keygen.sh/auxon-io/auxon.deb -O /tmp/auxon.deb
sudo apt-get install -y /tmp/auxon.deb
sudo apt-get update
sudo apt-get install -y --no-install-recommends modalityd modality-client modality-reflector conform deviant
- name: Setup Modality server
run: |
sudo systemctl stop modalityd
echo 'license-key = "'"${{secrets.MODALITY_LICENSE_KEY}}"'"' | sudo tee -a /etc/modalityd/config.toml
sudo systemctl start modalityd
sudo systemctl status modalityd --no-pager --full
curl --retry-max-time 30 --retry 10 --retry-connrefused ${{env.MODALITY_URL}}/alive
- name: Setup initial Modality configuration
run: |
modality --version
modality config --modalityd ${{env.MODALITY_URL}}
modality user create --use ci
echo "MODALITY_AUTH_TOKEN=$(modality user auth-token)" >> $GITHUB_ENV
modality workspace create --use ${{env.MODALITY_WORKSPACE}} test_system/workspace.toml
- name: Update reflector plugins
run: |
sudo cp target/release/modality-trace-recorder-importer /usr/lib/modality-reflector-plugins/importers/
sudo cp target/release/modality-trace-recorder-tcp-collector /usr/lib/modality-reflector-plugins/collectors/
sudo cp target/release/modality-trace-recorder-itm-collector /usr/lib/modality-reflector-plugins/collectors/
- name: Create specs
run: |
conform spec create --file test_system/specs/device.speqtr device-specs
- name: Setup test network
working-directory: test_system
run: sudo ./scripts/setup-network.sh &

- name: Build test system
working-directory: test_system
run: ./scripts/build.sh

- name: Run the system
working-directory: test_system
env:
MODALITY_AUTH_TOKEN: ${{env.MODALITY_AUTH_TOKEN}}
run: ./scripts/run.sh

- name: Inspect data
env:
MODALITY_AUTH_TOKEN: ${{env.MODALITY_AUTH_TOKEN}}
run: |
modality workspace list
modality workspace inspect ${{env.MODALITY_WORKSPACE}}
modality segment list
- name: Evaluate specs
continue-on-error: true
env:
MODALITY_AUTH_TOKEN: ${{env.MODALITY_AUTH_TOKEN}}
run: |
conform spec eval --name device-specs
- name: Export Data
env:
MODALITY_AUTH_TOKEN: ${{env.MODALITY_AUTH_TOKEN}}
run: |
datetime=$(date +'%Y-%m-%dT%H-%M-%SZ')
tarfile=modality_demo_system_data_${datetime}.tar.gz
echo TARBALL_NAME=${tarfile} >> $GITHUB_ENV
sudo systemctl stop modalityd
modality user auth-token | sudo tee /var/lib/modality/user_auth_token
cd /tmp && sudo tar czvf ${tarfile} -C /var/lib modality
- name: Upload Modality data
uses: actions/upload-artifact@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: ${{ env.TARBALL_NAME }}
path: /tmp/${{ env.TARBALL_NAME }}
retention-days: 2
if-no-files-found: error
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ description = "A Modality reflector plugin suite and ingest adapter library for
license = "Apache-2.0"
repository = "https://github.com/auxoncorp/modality-trace-recorder-plugin"
documentation = "https://docs.rs/modality-trace-recorder-plugin"
exclude = ["test_system/"]

[lib]
name = "modality_trace_recorder_plugin"
Expand Down
1 change: 1 addition & 0 deletions test_system/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build
3 changes: 3 additions & 0 deletions test_system/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
build
.gdb_history
tags
Loading

0 comments on commit 1f8dd48

Please sign in to comment.