From 913786995bfa20accbb449020647117b3150844c Mon Sep 17 00:00:00 2001 From: octaviansima <34696537+octaviansima@users.noreply.github.com> Date: Wed, 10 Feb 2021 11:48:18 -0800 Subject: [PATCH 01/13] Create main.yml --- .github/workflows/main.yml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000000..10cc28daa7 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,36 @@ +name: CI + +# Controls when the action will run. +on: + # Triggers the workflow on push or pull request events but only for the master branch + push: + branches: [ master ] + pull_request: + branches: [ master ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + build: + # Define the OS to run on + runs-on: ubuntu-18.04 + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v2 + # Run the build script + - name: Install dependencies, set environment variables, and build the package + - run: ./.github/scripts/build.sh + - shell: bash + + test: + runs-on: ubuntu-18.04 + # Specify that the build job is a prerequisite + needs: build + steps: + - uses: actions/checkout@v2 + # Run tests + - name: Run tests + - run: ./build/sbt test From 081f03d3857399518e61b6fd0f2f9c99378b9e84 Mon Sep 17 00:00:00 2001 From: Octavian Sima Date: Wed, 10 Feb 2021 20:02:04 +0000 Subject: [PATCH 02/13] build.sh --- .github/scripts/build.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/scripts/build.sh diff --git a/.github/scripts/build.sh b/.github/scripts/build.sh new file mode 100644 index 0000000000..67d9fab380 --- /dev/null +++ b/.github/scripts/build.sh @@ -0,0 +1,27 @@ +# Install OpenEnclave 0.9.0 +echo 'deb [arch=amd64] https://download.01.org/intel-sgx/sgx_repo/ubuntu bionic main' | sudo tee /etc/apt/sources.list.d/intel-sgx.list +wget -qO - https://download.01.org/intel-sgx/sgx_repo/ubuntu/intel-sgx-deb.key | sudo apt-key add - +echo "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-7 main" | sudo tee /etc/apt/sources.list.d/llvm-toolchain-bionic-7.list +wget -qO - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - +echo "deb [arch=amd64] https://packages.microsoft.com/ubuntu/18.04/prod bionic main" | sudo tee /etc/apt/sources.list.d/msprod.list +wget -qO - https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add - + +sudo apt update +sudo apt -y install clang-7 libssl-dev gdb libsgx-enclave-common libsgx-enclave-common-dev libprotobuf10 libsgx-dcap-ql libsgx-dcap-ql-dev az-dcap-client open-enclave=0.9.0 + +# Install Opaque Dependencies +sudo apt -y install wget build-essential openjdk-8-jdk python libssl-dev + +wget https://github.com/Kitware/CMake/releases/download/v3.15.6/cmake-3.15.6-Linux-x86_64.sh +sudo bash cmake-3.15.6-Linux-x86_64.sh --skip-license --prefix=/usr/local + +# Generate keypair for attestation +openssl genrsa -out private_key.pem -3 3072 + +# Set up environment variables +source opaqueenv +source /opt/openenclave/share/openenclave/openenclaverc +export MODE=SIMULATE + +# Build package +./build/sbt package From fb823122945bd0be480190115bd42befad66bcf2 Mon Sep 17 00:00:00 2001 From: octaviansima <34696537+octaviansima@users.noreply.github.com> Date: Wed, 10 Feb 2021 12:12:48 -0800 Subject: [PATCH 03/13] Update main.yml --- .github/workflows/main.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 10cc28daa7..1604db5df3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -22,8 +22,8 @@ jobs: - uses: actions/checkout@v2 # Run the build script - name: Install dependencies, set environment variables, and build the package - - run: ./.github/scripts/build.sh - - shell: bash + run: ./.github/scripts/build.sh + shell: bash test: runs-on: ubuntu-18.04 @@ -33,4 +33,5 @@ jobs: - uses: actions/checkout@v2 # Run tests - name: Run tests - - run: ./build/sbt test + run: ./build/sbt test + shell: bash From 0e22f0ac2c24805f8c1cb33a35e52e2832bb84df Mon Sep 17 00:00:00 2001 From: Octavian Sima Date: Wed, 10 Feb 2021 20:24:05 +0000 Subject: [PATCH 04/13] make executable --- .github/scripts/build.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 .github/scripts/build.sh diff --git a/.github/scripts/build.sh b/.github/scripts/build.sh old mode 100644 new mode 100755 From c3282d87a35b30547314d12a6fab00b5180e07f2 Mon Sep 17 00:00:00 2001 From: Octavian Sima Date: Wed, 10 Feb 2021 20:36:34 +0000 Subject: [PATCH 05/13] specify version of java --- .github/workflows/main.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1604db5df3..1f14e3ae42 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -20,6 +20,10 @@ jobs: steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v2 + # Specify the version of Java that is installed + - uses: actions/setup-java@v1 + with: + java-version: '8' # Run the build script - name: Install dependencies, set environment variables, and build the package run: ./.github/scripts/build.sh @@ -31,7 +35,10 @@ jobs: needs: build steps: - uses: actions/checkout@v2 - # Run tests + - uses: actions/setup-java@v1 + with: + java-version: '8' + # Run sbt tests - name: Run tests run: ./build/sbt test - shell: bash + From 286e6aae2944e5dcb8a6874e88f2273f36d28cbd Mon Sep 17 00:00:00 2001 From: Octavian Sima Date: Wed, 10 Feb 2021 20:46:15 +0000 Subject: [PATCH 06/13] split up script --- .github/scripts/{build.sh => install-deps.sh} | 8 -------- .github/scripts/setup-env.sh | 2 ++ .github/workflows/main.yml | 18 ++++++++++-------- 3 files changed, 12 insertions(+), 16 deletions(-) rename .github/scripts/{build.sh => install-deps.sh} (88%) create mode 100755 .github/scripts/setup-env.sh diff --git a/.github/scripts/build.sh b/.github/scripts/install-deps.sh similarity index 88% rename from .github/scripts/build.sh rename to .github/scripts/install-deps.sh index 67d9fab380..3f9bdc079b 100755 --- a/.github/scripts/build.sh +++ b/.github/scripts/install-deps.sh @@ -17,11 +17,3 @@ sudo bash cmake-3.15.6-Linux-x86_64.sh --skip-license --prefix=/usr/local # Generate keypair for attestation openssl genrsa -out private_key.pem -3 3072 - -# Set up environment variables -source opaqueenv -source /opt/openenclave/share/openenclave/openenclaverc -export MODE=SIMULATE - -# Build package -./build/sbt package diff --git a/.github/scripts/setup-env.sh b/.github/scripts/setup-env.sh new file mode 100755 index 0000000000..7238c60ba3 --- /dev/null +++ b/.github/scripts/setup-env.sh @@ -0,0 +1,2 @@ +source opaqueenv +source /opt/openenclave/share/openenclave/openenclaverc diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1f14e3ae42..82e50c6401 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -24,21 +24,23 @@ jobs: - uses: actions/setup-java@v1 with: java-version: '8' - # Run the build script + # Run the test - name: Install dependencies, set environment variables, and build the package - run: ./.github/scripts/build.sh - shell: bash + run: | + ./.github/scripts/install-deps.sh + ./.github/scripts/setup-env.sh + ./build/sbt package test: runs-on: ubuntu-18.04 - # Specify that the build job is a prerequisite + # Build job is a prerequisite needs: build steps: - uses: actions/checkout@v2 - uses: actions/setup-java@v1 with: java-version: '8' - # Run sbt tests - - name: Run tests - run: ./build/sbt test - + - name: Run sbt tests + run: | + ./.github/scripts/setup-env.sh + ./build/sbt test From c266e4ab485dacec8a2919712ea1614efb1e2cf8 Mon Sep 17 00:00:00 2001 From: Octavian Sima Date: Wed, 10 Feb 2021 21:02:19 +0000 Subject: [PATCH 07/13] set envs --- .github/scripts/install-deps.sh | 2 +- .github/scripts/setup-env.sh | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/scripts/install-deps.sh b/.github/scripts/install-deps.sh index 3f9bdc079b..afcfa46e9c 100755 --- a/.github/scripts/install-deps.sh +++ b/.github/scripts/install-deps.sh @@ -16,4 +16,4 @@ wget https://github.com/Kitware/CMake/releases/download/v3.15.6/cmake-3.15.6-Lin sudo bash cmake-3.15.6-Linux-x86_64.sh --skip-license --prefix=/usr/local # Generate keypair for attestation -openssl genrsa -out private_key.pem -3 3072 +openssl genrsa -out ./private_key.pem -3 3072 diff --git a/.github/scripts/setup-env.sh b/.github/scripts/setup-env.sh index 7238c60ba3..b2fb066f36 100755 --- a/.github/scripts/setup-env.sh +++ b/.github/scripts/setup-env.sh @@ -1,2 +1,3 @@ source opaqueenv source /opt/openenclave/share/openenclave/openenclaverc +export MODE=SIMULATE From d63fca25325311a9959f5c82c8c2891856a1e84c Mon Sep 17 00:00:00 2001 From: Octavian Sima Date: Wed, 10 Feb 2021 21:19:57 +0000 Subject: [PATCH 08/13] individual scripts --- .github/scripts/{install-deps.sh => build.sh} | 6 ++++++ .github/scripts/test.sh | 5 +++++ .github/workflows/main.yml | 11 ++++------- 3 files changed, 15 insertions(+), 7 deletions(-) rename .github/scripts/{install-deps.sh => build.sh} (91%) create mode 100644 .github/scripts/test.sh diff --git a/.github/scripts/install-deps.sh b/.github/scripts/build.sh similarity index 91% rename from .github/scripts/install-deps.sh rename to .github/scripts/build.sh index afcfa46e9c..4c3d22537b 100755 --- a/.github/scripts/install-deps.sh +++ b/.github/scripts/build.sh @@ -17,3 +17,9 @@ sudo bash cmake-3.15.6-Linux-x86_64.sh --skip-license --prefix=/usr/local # Generate keypair for attestation openssl genrsa -out ./private_key.pem -3 3072 + +source opaqueenv +source /opt/openenclave/share/openenclave/openenclaverc +export MODE=SIMULATE + +build/sbt package diff --git a/.github/scripts/test.sh b/.github/scripts/test.sh new file mode 100644 index 0000000000..ac792eca85 --- /dev/null +++ b/.github/scripts/test.sh @@ -0,0 +1,5 @@ +source opaqueenv +source /opt/openenclave/share/openenclave/openenclaverc +export MODE=SIMULATE + +build/sbt test diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 82e50c6401..013bacfb69 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -26,10 +26,8 @@ jobs: java-version: '8' # Run the test - name: Install dependencies, set environment variables, and build the package - run: | - ./.github/scripts/install-deps.sh - ./.github/scripts/setup-env.sh - ./build/sbt package + run: ./github/scripts/build.sh + shell: bash test: runs-on: ubuntu-18.04 @@ -41,6 +39,5 @@ jobs: with: java-version: '8' - name: Run sbt tests - run: | - ./.github/scripts/setup-env.sh - ./build/sbt test + run: ./github/scripts/test.sh + shell: bash From b2539f02c566a29a965925f382c727c46529c595 Mon Sep 17 00:00:00 2001 From: octaviansima <34696537+octaviansima@users.noreply.github.com> Date: Wed, 10 Feb 2021 13:24:42 -0800 Subject: [PATCH 09/13] Delete setup-env.sh --- .github/scripts/setup-env.sh | 3 --- .github/workflows/main.yml | 4 ++-- 2 files changed, 2 insertions(+), 5 deletions(-) delete mode 100755 .github/scripts/setup-env.sh diff --git a/.github/scripts/setup-env.sh b/.github/scripts/setup-env.sh deleted file mode 100755 index b2fb066f36..0000000000 --- a/.github/scripts/setup-env.sh +++ /dev/null @@ -1,3 +0,0 @@ -source opaqueenv -source /opt/openenclave/share/openenclave/openenclaverc -export MODE=SIMULATE diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 013bacfb69..ba605e0593 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -26,7 +26,7 @@ jobs: java-version: '8' # Run the test - name: Install dependencies, set environment variables, and build the package - run: ./github/scripts/build.sh + run: ./.github/scripts/build.sh shell: bash test: @@ -39,5 +39,5 @@ jobs: with: java-version: '8' - name: Run sbt tests - run: ./github/scripts/test.sh + run: ./.github/scripts/test.sh shell: bash From 02a4bdaab210a80c0cccadb96651c94558a86f38 Mon Sep 17 00:00:00 2001 From: Octavian Sima Date: Wed, 10 Feb 2021 21:35:51 +0000 Subject: [PATCH 10/13] caching --- .github/scripts/test.sh | 0 .github/workflows/main.yml | 9 +++++++++ 2 files changed, 9 insertions(+) mode change 100644 => 100755 .github/scripts/test.sh diff --git a/.github/scripts/test.sh b/.github/scripts/test.sh old mode 100644 new mode 100755 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ba605e0593..aeed786aa8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -24,9 +24,14 @@ jobs: - uses: actions/setup-java@v1 with: java-version: '8' + # Caching + - uses: coursier/cache-action@v5 # Run the test - name: Install dependencies, set environment variables, and build the package run: ./.github/scripts/build.sh + run: | + find $HOME/.ivy2/cache -name "ivydata-*.properties" -delete || true + find $HOME/.sbt -name "*.lock" -delete || true shell: bash test: @@ -38,6 +43,10 @@ jobs: - uses: actions/setup-java@v1 with: java-version: '8' + - uses: coursier/cache-action@v5 - name: Run sbt tests run: ./.github/scripts/test.sh + run: | + find $HOME/.ivy2/cache -name "ivydata-*.properties" -delete || true + find $HOME/.sbt -name "*.lock" -delete || true shell: bash From 93b3778dcd79263f19ae96286beb8a9bef41ca29 Mon Sep 17 00:00:00 2001 From: Octavian Sima Date: Wed, 10 Feb 2021 21:40:03 +0000 Subject: [PATCH 11/13] only one run --- .github/workflows/main.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index aeed786aa8..55ec0b4f2b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -29,9 +29,6 @@ jobs: # Run the test - name: Install dependencies, set environment variables, and build the package run: ./.github/scripts/build.sh - run: | - find $HOME/.ivy2/cache -name "ivydata-*.properties" -delete || true - find $HOME/.sbt -name "*.lock" -delete || true shell: bash test: @@ -45,8 +42,13 @@ jobs: java-version: '8' - uses: coursier/cache-action@v5 - name: Run sbt tests - run: ./.github/scripts/test.sh run: | + ./.github/scripts/test.sh + + # From https://www.scala-sbt.org/1.x/docs/GitHub-Actions-with-sbt.html + rm -rf "$HOME/.ivy2/local" || true + find $HOME/Library/Caches/Coursier/v1 -name "ivydata-*.properties" -delete || true find $HOME/.ivy2/cache -name "ivydata-*.properties" -delete || true + find $HOME/.cache/coursier/v1 -name "ivydata-*.properties" -delete || true find $HOME/.sbt -name "*.lock" -delete || true shell: bash From 3b6b12f5fe582c76521da2e381eb35dfbab9e4a8 Mon Sep 17 00:00:00 2001 From: Octavian Sima Date: Wed, 10 Feb 2021 21:41:18 +0000 Subject: [PATCH 12/13] formatting --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 55ec0b4f2b..f9484dc966 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -43,9 +43,9 @@ jobs: - uses: coursier/cache-action@v5 - name: Run sbt tests run: | - ./.github/scripts/test.sh + ./.github/scripts/test.sh - # From https://www.scala-sbt.org/1.x/docs/GitHub-Actions-with-sbt.html + # From https://www.scala-sbt.org/1.x/docs/GitHub-Actions-with-sbt.html rm -rf "$HOME/.ivy2/local" || true find $HOME/Library/Caches/Coursier/v1 -name "ivydata-*.properties" -delete || true find $HOME/.ivy2/cache -name "ivydata-*.properties" -delete || true From 14bf63a3e7ee4339e7007401ed94d5cd7e4589a3 Mon Sep 17 00:00:00 2001 From: Octavian Sima Date: Wed, 10 Feb 2021 21:55:31 +0000 Subject: [PATCH 13/13] only one test --- .github/scripts/build.sh | 2 +- .github/scripts/test.sh | 5 ----- .github/workflows/main.yml | 22 ++++------------------ 3 files changed, 5 insertions(+), 24 deletions(-) delete mode 100755 .github/scripts/test.sh diff --git a/.github/scripts/build.sh b/.github/scripts/build.sh index 4c3d22537b..c0f92b2cab 100755 --- a/.github/scripts/build.sh +++ b/.github/scripts/build.sh @@ -22,4 +22,4 @@ source opaqueenv source /opt/openenclave/share/openenclave/openenclaverc export MODE=SIMULATE -build/sbt package +build/sbt test diff --git a/.github/scripts/test.sh b/.github/scripts/test.sh deleted file mode 100755 index ac792eca85..0000000000 --- a/.github/scripts/test.sh +++ /dev/null @@ -1,5 +0,0 @@ -source opaqueenv -source /opt/openenclave/share/openenclave/openenclaverc -export MODE=SIMULATE - -build/sbt test diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f9484dc966..f4695ac8b8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -24,31 +24,17 @@ jobs: - uses: actions/setup-java@v1 with: java-version: '8' - # Caching + # Caching (from https://www.scala-sbt.org/1.x/docs/GitHub-Actions-with-sbt.html) - uses: coursier/cache-action@v5 # Run the test - - name: Install dependencies, set environment variables, and build the package - run: ./.github/scripts/build.sh - shell: bash - - test: - runs-on: ubuntu-18.04 - # Build job is a prerequisite - needs: build - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-java@v1 - with: - java-version: '8' - - uses: coursier/cache-action@v5 - - name: Run sbt tests + - name: Install dependencies, set environment variables, and run sbt tests run: | - ./.github/scripts/test.sh + ./.github/scripts/build.sh - # From https://www.scala-sbt.org/1.x/docs/GitHub-Actions-with-sbt.html rm -rf "$HOME/.ivy2/local" || true find $HOME/Library/Caches/Coursier/v1 -name "ivydata-*.properties" -delete || true find $HOME/.ivy2/cache -name "ivydata-*.properties" -delete || true find $HOME/.cache/coursier/v1 -name "ivydata-*.properties" -delete || true find $HOME/.sbt -name "*.lock" -delete || true shell: bash +