Skip to content

[ci] Fix gvisor netlink unit test #236

[ci] Fix gvisor netlink unit test

[ci] Fix gvisor netlink unit test #236

name: Code Coverage
# Controls when the action will run. Triggers the workflow on push or pull request
on: [push]
env:
nap_time: 120
jobs:
Collect-code-coverage:
runs-on: ${{ matrix.self_runner }}
strategy:
matrix:
self_runner: [[self-hosted, SGX2-HW, EDMM, IO_Uring]]
os_ver: [ubuntu22.04]
steps:
- name: Clean before running
run: |
sudo chown -R ${{ secrets.CI_ADMIN }} "${{ github.workspace }}"
- uses: AutoModality/action-clean@v1
- uses: actions/checkout@v2
with:
submodules: true
- uses: ./.github/workflows/composite_action/hw
with:
container-name: ${{ github.job }}
build-envs: 'OCCLUM_RELEASE_BUILD=0' # code coverage test should use debug mode
# Build the source code with code coverage enabled
- name: Build source
run: docker exec ${{ env.CONTAINER_NAME }} bash -c "source /opt/intel/sgxsdk/environment; cd /root/occlum; make clean && OCCLUM_COV=1 make install"
# Udpate the test json file
# When there comes new features, the configuration should be enabled accordingly
- name: Configure Occlum features
run: |
docker exec ${{ env.CONTAINER_NAME }} bash -c "jq '.feature.enable_posix_shm = true | .feature.enable_edmm = true' /root/occlum/test/Occlum.json > /tmp.json && mv /tmp.json /root/occlum/test/Occlum.json"
shell: bash
- name: Integration test
run: docker exec ${{ env.CONTAINER_NAME }} bash -c "cd /root/occlum; make test"
- name: Integration test with Glibc
run: docker exec ${{ env.CONTAINER_NAME }} bash -c "cd /root/occlum; make test-glibc"
- name: C test
run: docker exec ${{ env.CONTAINER_NAME }} bash -c "cd /root/occlum/demos/hello_c && make;
occlum new occlum_instance;
cd occlum_instance && rm -rf image;
copy_bom -f ../hello.yaml --root image --include-dir /opt/occlum/etc/template;
occlum build;
occlum run /bin/hello_world"
- name: C with encrypted image test
run: docker exec ${{ env.CONTAINER_NAME }} bash -c "cd /root/occlum/demos/hello_c && make;
rm -rf occlum_instance && occlum new occlum_instance;
occlum gen-image-key occlum_instance/image_key;
cd occlum_instance && rm -rf image;
copy_bom -f ../hello.yaml --root image --include-dir /opt/occlum/etc/template;
occlum build --image-key ./image_key --buildin-image-key;
occlum run /bin/hello_world;
cd /root/occlum/demos && rm -rf ./hello_c"
- name: C++ test
run: docker exec ${{ env.CONTAINER_NAME }} bash -c "cd /root/occlum/demos/hello_cc && make;
occlum new occlum_instance;
cd occlum_instance && rm -rf image;
copy_bom -f ../hello.yaml --root image --include-dir /opt/occlum/etc/template;
occlum build;
occlum run /bin/hello_world;
cd /root/occlum/demos && rm -rf ./hello_cc"
- name: Rust test
run: docker exec ${{ env.CONTAINER_NAME }} bash -c "cd /root/occlum/demos/rust && ./run_rust_demo_on_occlum.sh;
cd /root/occlum/demos && rm -rf ./rust"
- name: Run Golang sqlite test
run: docker exec ${{ env.CONTAINER_NAME }} bash -c "cd /root/occlum/demos/golang/go_sqlite/ && ./run_go_sqlite_demo.sh;
cd /root/occlum/demos && rm -rf ./golang"
- name: Build Fish dependencies
run: docker exec ${{ env.CONTAINER_NAME }} bash -c "cd /root/occlum/demos/fish && ./download_and_build.sh"
- name: Run Fish test
run: docker exec ${{ env.CONTAINER_NAME }} bash -c "cd /root/occlum/demos/fish && ./run_fish_test.sh"
- name: Run Fish process rlimit test
run: docker exec ${{ env.CONTAINER_NAME }} bash -c "cd /root/occlum/demos/fish && ./run_per_process_config_test.sh;
cd /root/occlum/demos && rm -rf ./fish"
- name: Build LA dependencies
run: docker exec ${{ env.CONTAINER_NAME }} bash -c "cd /root/occlum/demos/local_attestation && ./download_src_and_build_deps.sh"
- name: Run LA test
run: docker exec ${{ env.CONTAINER_NAME }} bash -c "cd /root/occlum/demos/local_attestation && make;
make test;
cd /root/occlum/demos && rm -rf ./local_attestation"
- name: Build sqlite dependencies
run: docker exec ${{ env.CONTAINER_NAME }} bash -c "cd /root/occlum/demos/sqlite && ./download_and_build_sqlite.sh"
- name: Run sqlite test
run: docker exec ${{ env.CONTAINER_NAME }} bash -c "cd /root/occlum/demos/sqlite && ./run_sqlite_on_occlum.sh;
cd /root/occlum/demos && rm -rf ./sqlite"
- name: LTP test
run: docker exec ${{ env.CONTAINER_NAME }} bash -c "cd /root/occlum/demos/linux-ltp && ./dl_and_build_ltp.sh && ./prepare_ltp.sh;
cd occlum_instance;
occlum run /opt/ltp/run-ltp.sh -f syscalls-occlum;
cd /root/occlum/demos && rm -rf ./linux-ltp"
- name: Clean demos
run: docker exec ${{ env.CONTAINER_NAME }} bash -c "rm -rf /root/occlum/demos/"
- name : Gvisor syscall test
run: docker exec ${{ env.CONTAINER_NAME }} bash -c "git clone -b occlum-release-20200921.0 https://github.com/occlum/gvisor.git;
cd gvisor/occlum && ./prepare_bazel.sh && ./build_and_install_syscall_tests.sh && ./run_occlum_passed_tests.sh"
- name: Upload coverage report
run: docker exec ${{ env.CONTAINER_NAME }} bash -c "cd /root/occlum/build/internal/src/libos/cargo-target/debug/deps; export CODECOV_TOKEN="${{ secrets.COV_TOKEN }}"; bash <(curl -s https://codecov.io/bash)"
- name: Clean the environment
if: ${{ always() }}
run: docker stop ${{ env.CONTAINER_NAME }}