Skip to content

Commit

Permalink
Merge pull request #10 from ChainSafe/fix/optimize-binary-rust
Browse files Browse the repository at this point in the history
Fix: Optimize Binary Rust For Storage
  • Loading branch information
willemolding authored Sep 6, 2023
2 parents 0ff0d8a + 3d38474 commit 691a0e9
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 60 deletions.
54 changes: 45 additions & 9 deletions .github/workflows/mips.yml
Original file line number Diff line number Diff line change
@@ -1,58 +1,94 @@
name: MIPS

on:
workflow_call:

workflow_dispatch:
push:
branches:
- main
pull_request:
branches:
- main
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
CC_mips_unknown_none: mips-linux-gnu-gcc
CXX_mips_unknown_none: mips-linux-gnu-g++
CARGO_TARGET_MIPS_UNKNOWN_NONE_LINKER: mips-linux-gnu-gcc
RUSTFLAGS: "-Clink-arg=-e_start"

jobs:
build-release:
build-mips:
runs-on: ubuntu-latest
steps:
- name: Checkout Source
uses: actions/checkout@v3
with:
lfs: true

- uses: Swatinem/rust-cache@v2

- name: Run sccache-cache
uses: mozilla-actions/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Apt Dependencies
uses: nick-fields/retry@v2
with:
timeout_minutes: 5
max_attempts: 3
command: sudo make -C zipline-state-transition-mips ci_install_deps

- uses: actions/setup-python@v4
with:
python-version: '3.9'
cache: 'pip' # caching pip dependencies

- name: Install python related deps
working-directory: zipline-state-transition-mips
run: pip install wheel
pip install -r requirements.txt

- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly-2023-05-03
default: true
override: true
components: rust-src

- name: Build Release Mainnet
working-directory: zipline-state-transition-mips
run: ./build.sh

- name: Build Release Spec Test
working-directory: zipline-state-transition-mips
run: SPEC=spec_test ./build.sh
- uses: actions/upload-artifact@v3

- name: Install development tools
uses: taiki-e/[email protected]
with:
name: mainnet_out.bin
path: zipline-state-transition-mips/build/mainnet_out.bin
- uses: actions/upload-artifact@v3
tool: cargo-nextest,just

- name: Install `rust` toolchain
run: |
rustup toolchain install nightly-2023-05-03 --no-self-update --profile minimal
rustup default nightly-2023-05-03
- name: Setup protoc
uses: arduino/[email protected]

- name: Download consensus-spec-tests
run: just download-integration-tests

- name: Build the zipline tests (slow)
run: just cache-zipline-tests

- uses: actions-rs/cargo@v1
with:
name: spec_test_out.bin
path: zipline-state-transition-mips/build/spec_test_out.bin
command: test
args: --release -p crypto -p preimage-oracle -p zipline-finality-client -p zipline-spec -p cannon-emulator

test-rust:
uses: ChainSafe/Zipline-Casper/.github/workflows/rust.yml@main
needs: build-mips
54 changes: 3 additions & 51 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -1,60 +1,12 @@
name: Rust

on:
workflow_dispatch:
push:
branches:
- main
pull_request:
branches:
- main
on:
workflow_call:

env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"

jobs:
build-mips:
uses: ./.github/workflows/mips.yml
secrets: inherit
test:
runs-on: ubuntu-latest
needs: build-mips
steps:
- name: Checkout Source
uses: actions/checkout@v3
with:
lfs: true
- uses: Swatinem/rust-cache@v2
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Install development tools
uses: taiki-e/[email protected]
with:
tool: cargo-nextest,just
- name: Install `rust` toolchain
run: |
rustup toolchain install nightly-2023-05-03 --no-self-update --profile minimal
rustup default nightly-2023-05-03
- name: Setup protoc
uses: arduino/[email protected]
- name: Download consensus-spec-tests
run: just download-integration-tests
- name: Build the zipline tests (slow)
run: just cache-zipline-tests
- uses: actions/download-artifact@v3 # download the cached binary
with:
name: spec_test_out.bin
path: zipline-state-transition-mips/build/
- uses: actions/download-artifact@v3 # download the cached binary
with:
name: mainnet_out.bin
path: zipline-state-transition-mips/build/
- uses: actions-rs/cargo@v1
with:
command: test
args: --release -p crypto -p preimage-oracle -p zipline-finality-client -p zipline-spec -p cannon-emulator
build-release:
runs-on: ubuntu-latest
steps:
Expand Down

0 comments on commit 691a0e9

Please sign in to comment.