Skip to content

Commit

Permalink
Merge pull request #64 from datachainlab/fix-ci
Browse files Browse the repository at this point in the history
Improve CI performance and remove unused dependencies

Signed-off-by: Jun Kimura <jun.kimura@datachain.jp>
  • Loading branch information
bluele committed Jun 11, 2023
2 parents e71425c + 2a54c47 commit 1d00807
Show file tree
Hide file tree
Showing 27 changed files with 59 additions and 205 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/cache-cleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: cleanup caches by a branch
on:
pull_request:
types:
- closed

jobs:
cleanup:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3

- name: Cleanup
run: |
gh extension install actions/gh-actions-cache
REPO=${{ github.repository }}
BRANCH="refs/pull/${{ github.event.pull_request.number }}/merge"
echo "Fetching list of cache key"
cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1 )
## Setting this to not fail the workflow while deleting cache keys.
set +e
echo "Deleting caches..."
for cacheKey in $cacheKeysForPR
do
gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm
done
echo "Done"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62 changes: 19 additions & 43 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
name: test
on: [push, pull_request]

on:
push:
branches:
- main
pull_request:

jobs:
lint:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
Expand All @@ -18,42 +24,19 @@ jobs:
- run: make lint-tools
- run: make lint

udeps:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
- uses: datachainlab/rust-cache@allow_registry_src_caching
with:
workspaces: |
.
./enclave
cache-directories: |
~/.cargo/registry/src/**/librocksdb-sys-*
- run: make lint-tools
- run: make udeps

relayer:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.18
- uses: actions/cache@v3
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- run: make yrly

sdk-test:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
env:
SGX_MODE: SW
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
Expand All @@ -66,17 +49,10 @@ jobs:
./enclave
cache-directories: |
~/.cargo/registry/src/**/librocksdb-sys-*
- run: |
docker run -w /root/lcp \
-v $(pwd):/root/lcp \
-v ${HOME}/.cargo/git:/root/.cargo/git \
-v ${HOME}/.cargo/registry:/root/.cargo/registry \
bluele/sgx-rust:2004-1.1.6 \
/bin/bash -c \
"source /opt/sgxsdk/environment && \
source /root/.cargo/env && \
export SGX_MODE=SW && \
sed -i -e 's#deb https://download.01.org/intel-sgx/sgx_repo/ubuntu.*##g' /etc/apt/sources.list && \
apt update -y && apt install -y libclang-dev && \
make && make test integration-test cgen"
- run: sudo chown -R runner:docker . ${HOME}/.cargo
- run: curl -LO https://download.01.org/intel-sgx/sgx-linux/2.19/distro/ubuntu22.04-server/sgx_linux_x64_sdk_2.19.100.3.bin
- run: chmod +x ./sgx_linux_x64_sdk_2.19.100.3.bin
- run: echo -e 'no\n/opt' | ./sgx_linux_x64_sdk_2.19.100.3.bin
- run: source /opt/sgxsdk/environment && make -B
- run: source /opt/sgxsdk/environment && make test
- run: source /opt/sgxsdk/environment && make integration-test
- run: source /opt/sgxsdk/environment && make cgen
41 changes: 0 additions & 41 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,11 @@ proto:

######## Lint ########

.PHONY: udeps-tools
lint-tools:
rustup component add rustfmt clippy
cargo install cargo-machete

.PHONY: fmt
fmt:
@cargo fmt --all $(CARGO_FMT_OPT) && cd ./enclave && cargo fmt --all $(CARGO_FMT_OPT)
Expand All @@ -196,14 +201,11 @@ fmt:
lint:
@$(MAKE) CARGO_FMT_OPT=--check fmt
@cargo clippy --locked --tests $(CARGO_TARGET) -- -D warnings

.PHONY: udeps-tools
lint-tools:
rustup component add rustfmt clippy
cargo +nightly install cargo-udeps --locked
@cargo machete

.PHONY: udeps
udeps:
@cargo +nightly install cargo-udeps --locked
@cargo +nightly udeps --locked --lib --tests $(CARGO_TARGET)

######## Tools ########
Expand Down
3 changes: 0 additions & 3 deletions app/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ description = """
"""

[dependencies]
sgx_types = { rev = "v1.1.6", git = "https://github.com/apache/incubator-teaclave-sgx-sdk" }
sgx_urts = { rev = "v1.1.6", git = "https://github.com/apache/incubator-teaclave-sgx-sdk" }

log = "0.4.8"
env_logger = "0.9.0"
hex = { version = "0.4", default-features = false, features = ["alloc"] }
Expand Down
6 changes: 0 additions & 6 deletions enclave-modules/ecall-handler/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,17 @@ edition = "2021"

[dependencies]
sgx_types = { rev = "v1.1.6", git = "https://github.com/apache/incubator-teaclave-sgx-sdk" }
prost-types = { version = "0.11", default-features = false }
serde = { version = "1.0", default-features = false, features = ["alloc"] }
hex = { version = "0.4", default-features = false, features = ["alloc"] }
log = { version = "0.4.8", default-features = false }
flex-error = { version = "0.4.4", default-features = false }

enclave-utils = { path = "../utils" }
enclave-remote-attestation = { path = "../remote-attestation" }
crypto = { path = "../../modules/crypto", default-features = false, features = ["sgx"] }
attestation-report = { path = "../../modules/attestation-report", default-features = false, features = ["sgx"] }
context = { path = "../../modules/context", default-features = false }
enclave-environment = { path = "../environment", default-features = false }
bincode = { git = "https://github.com/bluele/bincode-sgx", branch = "serde" }

lcp-types = { path = "../../modules/types", default-features = false }
light-client-registry = { path = "../../modules/light-client-registry", default-features = false }
settings = { path = "../../modules/settings", default-features = false }
ecall-commands = { path = "../../modules/ecall-commands", default-features = false }
commitments = { path = "../../modules/commitments", default-features = false, features = ["prover"] }
light-client = { path = "../../modules/light-client", default-features = false }
Expand Down
5 changes: 0 additions & 5 deletions enclave-modules/remote-attestation/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,19 @@ edition = "2021"
[dependencies]
sgx_types = { rev = "v1.1.6", git = "https://github.com/apache/incubator-teaclave-sgx-sdk" }
sgx_tstd = { rev = "v1.1.6", git = "https://github.com/apache/incubator-teaclave-sgx-sdk", features = ["net"] }
sgx_trts = { rev = "v1.1.6", git = "https://github.com/apache/incubator-teaclave-sgx-sdk" }
sgx_tse = { rev = "v1.1.6", git = "https://github.com/apache/incubator-teaclave-sgx-sdk" }
sgx_tcrypto = { rev = "v1.1.6", git = "https://github.com/apache/incubator-teaclave-sgx-sdk" }

serde = { version = "1.0", default-features = false, features = ["alloc"] }
serde_json = { version = "1.0", default-features = false, features = ["alloc"] }
itertools = { version = "0.8", default-features = false, features = [] }
log = { version = "0.4.8", default-features = false }
base64 = { git = "https://github.com/marshallpierce/rust-base64", default-features = false, features = ["alloc"] }
hex = { version = "0.4", default-features = false, features = ["alloc"] }
httparse = { version = "1.3", default-features = false }
chrono = { version = "0.4.19", default-features = false, features = ["alloc"]}
flex-error = { version = "0.4.4", default-features = false }

webpki = { git = "https://github.com/mesalock-linux/webpki", branch = "mesalock_sgx" }
webpki-roots = { git = "https://github.com/mesalock-linux/webpki-roots", rev = "6ff3be547ac13ccd46ae55605ad6506ce30688ef" }
rustls = { git = "https://github.com/mesalock-linux/rustls", branch = "mesalock_sgx" }
bincode = { git = "https://github.com/bluele/bincode-sgx", branch = "serde" }

host-api = { path = "../host-api" }

Expand Down
Loading

0 comments on commit 1d00807

Please sign in to comment.