occlum/.github/workflows/composite_action/hw/action.yml
2022-07-17 17:12:14 +08:00

75 lines
3.0 KiB
YAML

name: 'Occlum HW composite action'
description: 'Occlum HW mode container run and source build/install'
inputs:
container-name:
description: 'Occlum container name'
required: true
build-envs:
description: 'Occlum build environments'
required: false
default: 'OCCLUM_RELEASE_BUILD=1'
os:
description: 'Occlum docker image base OS'
required: false
default: 'ubuntu20.04'
runs:
using: "composite"
steps:
- name: Print info
run: echo Occlum build environment ${{ inputs.build-envs }}
shell: bash
- name: Get Occlum version
run: echo "OCCLUM_VERSION=$(grep 'Version =' src/pal/include/occlum_version.h | awk '{print $4}')" >> $GITHUB_ENV;
shell: bash
- name: Set container name
run: echo "CONTAINER_NAME=${{ inputs.container-name }}_$RANDOM" >> $GITHUB_ENV
shell: bash
- name: Create container
run: |
if [[ "${{ matrix.self_runner[1] }}" == "SGX1-HW" ]]; then
docker run -itd --name=${{ env.CONTAINER_NAME }} --privileged --rm --env CARGO_HTTP_MULTIPLEXING=false --net host --device /dev/isgx -v $GITHUB_WORKSPACE:/root/occlum occlum/occlum:${{ env.OCCLUM_VERSION }}-${{ inputs.os }};
elif [[ "${{ matrix.self_runner[1] }}" == "SGX2-HW" ]]; then
docker run -itd --name=${{ env.CONTAINER_NAME }} --privileged --rm --env CARGO_HTTP_MULTIPLEXING=false --net host -v /dev/sgx:/dev/sgx -v $GITHUB_WORKSPACE:/root/occlum occlum/occlum:${{ env.OCCLUM_VERSION }}-${{ inputs.os }};
else
echo "Unsupported Hardware"
fi;
shell: bash
- name: Update PCCS server
run: |
docker exec ${{ env.CONTAINER_NAME }} bash -c "sed -r -i 's/\"pccs_url\": \"https:\/\/localhost:8081\/sgx\/certification\/v3\/\"/\"pccs_url\": \"https:\/\/sgx-dcap-server.cn-hongkong.aliyuncs.com\/sgx\/certification\/v3\/\"/g' /etc/sgx_default_qcnl.conf"
shell: bash
# - name: Change download source of crates.io
# run: |
# docker exec ${{ env.CONTAINER_NAME }} bash -c "cat <<- EOF >/root/.cargo/config
# [source.crates-io]
# registry = \"https://github.com/rust-lang/crates.io-index\"
# replace-with = 'ustc'
# [source.ustc]
# registry = \"git://mirrors.ustc.edu.cn/crates.io-index\"
# EOF"
# shell: bash
# - name: Config git proxy
# run: |
# docker exec ${{ env.CONTAINER_NAME }} bash -c "git config --global http.proxy socks5://localhost:5432"
# docker exec ${{ env.CONTAINER_NAME }} bash -c "git config --global https.proxy socks5://localhost:5432"
# shell: bash
- uses: ./.github/workflows/composite_action/prebuild
with:
container-name: ${{ env.CONTAINER_NAME }}
- name: Build dependencies
run: docker exec ${{ env.CONTAINER_NAME }} bash -c "cargo uninstall sccache || true; cd /root/occlum; make submodule"
shell: bash
- name: Build source
run: docker exec ${{ env.CONTAINER_NAME }} bash -c "source /opt/intel/sgxsdk/environment; cd /root/occlum; ${{ inputs.build-envs}} make install"
shell: bash