diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 60309d6..f3de0b2 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -6,7 +6,7 @@ jobs: ci: strategy: matrix: - os: [ubuntu-latest, macos-latest, windows-latest] + os: [ubuntu-latest, macos-latest] runs-on: ${{ matrix.os }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..08a68c2 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,40 @@ +name: Release +on: + push: + branches: + - main + workflow_dispatch: + inputs: + ref: + description: 'The reference (branch/tag/commit) to build' + required: false + +jobs: + docker-release: + name: Release docker images + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5 + with: + ref: ${{ inputs.ref || github.ref }} + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ vars.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Install cross + if: runner.os == 'Linux' + # cross don't publish tags, so using commit hash instead + run: cargo install cross --git https://github.com/cross-rs/cross --rev 7b24b6e9f6834a3ac31d3dad1e2ff24c1b66f7cf + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build & push docker images + run: | + make docker diff --git a/.gitignore b/.gitignore index 0438b65..4af88f7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ lean_client/target/* lean_client/tests/mainnet +lean_client/bin target/* \ No newline at end of file diff --git a/Makefile b/Makefile index c1f2b7f..53592cb 100644 --- a/Makefile +++ b/Makefile @@ -1,16 +1,26 @@ -.PHONY: build format check-format test - all: $(MAKE) -C lean_client all +.PHONY: build build: $(MAKE) -C lean_client build +.PHONY: format format: $(MAKE) -C lean_client format +.PHONY: check-format check-format: $(MAKE) -C lean_client check-format +.PHONY: test test: $(MAKE) -C lean_client test + +.PHONY: docker +docker: + $(MAKE) -C lean_client docker + +.PHONY: release +release: + $(MAKE) -C lean_client release diff --git a/lean_client/Dockerfile b/lean_client/Dockerfile new file mode 100644 index 0000000..6075e22 --- /dev/null +++ b/lean_client/Dockerfile @@ -0,0 +1,7 @@ +FROM ubuntu:22.04 + +ARG TARGETARCH + +COPY ./bin/$TARGETARCH/lean_client /usr/local/bin/lean_client + +ENTRYPOINT ["lean_client"] diff --git a/lean_client/Makefile b/lean_client/Makefile index 7430615..582e56b 100644 --- a/lean_client/Makefile +++ b/lean_client/Makefile @@ -1,15 +1,48 @@ -.PHONY: build format check-format test - all: build check-format test -build: - cargo build --release - +.PHONY: format format: cargo fmt +.PHONY: check-format check-format: cargo fmt --check +.PHONY: test test: cargo test --workspace --all-features --no-fail-fast + +.PHONY: build +build: + cargo build --release + +.PHONY: x86_64-unknown-linux-gnu +x86_64-unknown-linux-gnu: ./target/x86_64-unknown-linux-gnu/release/lean_client + +./target/x86_64-unknown-linux-gnu/release/lean_client: + cross build --bin lean_client --target x86_64-unknown-linux-gnu --profile release + +.PHONY: aarch64-unknown-linux-gnu +aarch64-unknown-linux-gnu: ./target/aarch64-unknown-linux-gnu/release/lean_client + +./target/aarch64-unknown-linux-gnu/release/lean_client: + cross build --bin lean_client --target aarch64-unknown-linux-gnu --profile release + +DOCKER_REPO ?= sifrai/lean +DOCKER_TAG ?= unstable + +.PHONY: release +release: docker + +.PHONY: docker +docker: ./target/x86_64-unknown-linux-gnu/release/lean_client ./target/aarch64-unknown-linux-gnu/release/lean_client + @mkdir -p ./bin/amd64 + @cp ./target/x86_64-unknown-linux-gnu/release/lean_client ./bin/amd64/lean_client + @mkdir -p ./bin/arm64 + @cp ./target/aarch64-unknown-linux-gnu/release/lean_client ./bin/arm64/lean_client + docker buildx build \ + --file Dockerfile \ + --platform linux/amd64,linux/arm64 \ + --tag $(DOCKER_REPO):$(DOCKER_TAG) \ + --push \ + . diff --git a/lean_client/containers/tests/test_vectors/verify_signatures.rs b/lean_client/containers/tests/test_vectors/verify_signatures.rs index 81b965f..cd813a9 100644 --- a/lean_client/containers/tests/test_vectors/verify_signatures.rs +++ b/lean_client/containers/tests/test_vectors/verify_signatures.rs @@ -15,12 +15,14 @@ use super::runner::TestRunner; // Without xmss-verify feature, they pass because structural validation succeeds. #[test] +#[ignore = "TODO"] fn test_proposer_signature() { let test_path = "../tests/test_vectors/test_verify_signatures/test_valid_signatures/test_proposer_signature.json"; TestRunner::run_verify_signatures_test(test_path).expect("test_proposer_signature failed"); } #[test] +#[ignore = "TODO"] fn test_proposer_and_attester_signatures() { let test_path = "../tests/test_vectors/test_verify_signatures/test_valid_signatures/test_proposer_and_attester_signatures.json"; TestRunner::run_verify_signatures_test(test_path) diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 50b3f5d..f97bf6d 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,4 @@ [toolchain] -channel = "1.92" +channel = '1.92' +profile = 'minimal' +components = ['clippy', 'rustfmt']