From 6b0b76edf47d459902cbcd5ae9e5902e3a19674a Mon Sep 17 00:00:00 2001 From: Paul Hauner Date: Sat, 23 Nov 2019 10:14:26 +1100 Subject: [PATCH] Update docker file, use makefile in CI --- .dockerignore | 2 ++ .../workflows/{rust.yml => test-suite.yml} | 26 +++++++++++----- Dockerfile | 29 ++--------------- Makefile | 31 +++++++++++++------ 4 files changed, 44 insertions(+), 44 deletions(-) create mode 100644 .dockerignore rename .github/workflows/{rust.yml => test-suite.yml} (62%) diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000000..f5e4c0356f --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +tests/ef_tests/eth2.0-spec-tests +target/ diff --git a/.github/workflows/rust.yml b/.github/workflows/test-suite.yml similarity index 62% rename from .github/workflows/rust.yml rename to .github/workflows/test-suite.yml index bcff2c3020..afd9d734c3 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/test-suite.yml @@ -10,7 +10,7 @@ jobs: - name: Get latest version of stable Rust run: rustup update stable - name: Check formatting with cargo fmt - run: cargo fmt --all -- --check + run: make cargo-fmt release-tests-ubuntu: runs-on: ubuntu-latest needs: cargo-fmt @@ -19,7 +19,7 @@ jobs: - name: Install ganache-cli run: sudo npm install -g ganache-cli - name: Run tests in release - run: cargo test --release --all + run: make test-release debug-tests-ubuntu: runs-on: ubuntu-latest needs: cargo-fmt @@ -34,9 +34,19 @@ jobs: needs: cargo-fmt steps: - uses: actions/checkout@v1 - - name: Download test vectors - run: make make-ef-tests - - name: Run eth2.0-spec-tests without fake_crypto - run: cargo test --manifest-path tests/ef_tests/Cargo.toml --release --features ef_tests - - name: Run eth2.0-spec-tests with fake_crypto - run: cargo test --manifest-path tests/ef_tests/Cargo.toml --release --features ef_tests,fake_crypto + - name: Run eth2.0-spec-tests with and without fake_crypto + run: make test-ef + dockerfile-ubuntu: + runs-on: ubuntu-latest + needs: cargo-fmt + steps: + - uses: actions/checkout@v1 + - name: Build the root Dockerfile + run: docker build . + install-ubuntu: + runs-on: ubuntu-latest + needs: cargo-fmt + steps: + - uses: actions/checkout@v1 + - name: Build using the root Makefile + run: make diff --git a/Dockerfile b/Dockerfile index 0aa5582066..0bbaa66d94 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,29 +1,4 @@ FROM rust:latest -RUN apt-get update && apt-get install -y clang libclang-dev cmake build-essential git unzip autoconf libtool awscli software-properties-common - -RUN add-apt-repository -y ppa:git-core/ppa - -RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash - -RUN apt-get install -y git-lfs - -RUN git clone https://github.com/google/protobuf.git && \ - cd protobuf && \ - ./autogen.sh && \ - ./configure && \ - make && \ - make install && \ - ldconfig && \ - make clean && \ - cd .. && \ - rm -r protobuf - -RUN apt-get install -y nodejs npm -RUN npm install -g ganache-cli --unsafe-perm - -RUN mkdir -p /cache/cargocache && chmod -R ugo+rwX /cache/cargocache - -ENV CARGO_HOME /cache/cargocache - -RUN rustup component add rustfmt clippy +COPY . lighthouse +RUN cd lighthouse && cargo install --path lighthouse diff --git a/Makefile b/Makefile index 1f111b3c11..8a93fef0f5 100644 --- a/Makefile +++ b/Makefile @@ -5,24 +5,37 @@ EF_TESTS = "tests/ef_tests" # Builds the entire workspace in release (optimized). # # Binaries will most likely be found in `./target/release` -release: - cargo build --release --all +install: + cargo install --path lighthouse --force -# Runs the full workspace tests, without downloading any additional test +# Runs the full workspace tests in **release**, without downloading any additional +# test vectors. +test-release: + cargo test --all --release --exclude ef_tests + +# Runs the full workspace tests in **debug**, without downloading any additional test # vectors. -test: - cargo test --all --all-features --release --exclude ef_tests +test-debug: + cargo test --all --exclude ef_tests +# Runs cargo-fmt (linter). +cargo-fmt: + cargo fmt --all -- --check -# only run the ef-test vectors -run-ef-tests: +# Runs only the ef-test vectors. +run-ef-tests: cargo test --release --manifest-path=$(EF_TESTS)/Cargo.toml --features "ef_tests" + cargo test --release --manifest-path=$(EF_TESTS)/Cargo.toml --features "ef_tests,fake_crypto" +# Downloads and runs the EF test vectors. test-ef: make-ef-tests run-ef-tests -# Runs the entire test suite, downloading test vectors if required. -test-full: test test-ef +# Runs the full workspace tests in release, without downloading any additional +# test vectors. +test: test-release +# Runs the entire test suite, downloading test vectors if required. +test-full: cargo-fmt test-release test-debug test-ef # Runs the makefile in the `ef_tests` repo. #