Skip to content

Commit

Permalink
Customize cargo profiles (#401)
Browse files Browse the repository at this point in the history
* Move rustc flags to cargo profile

* Add msrv=1.57 to cargo.toml

* Use build subcommand
  • Loading branch information
Dengjianping authored and dziabko committed Mar 8, 2022
1 parent 11e1a6c commit a3d7f30
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 14 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/generate_calamari_weights_files.yml
Expand Up @@ -84,7 +84,7 @@ jobs:
CARGO_TERM_COLOR: always
run: |
source ${HOME}/.cargo/env
CARGO_PROFILE_RELEASE_LTO=true RUSTFLAGS="-C codegen-units=1" cargo build --release --verbose --features=runtime-benchmarks
cargo build --profile production --verbose --features=runtime-benchmarks
-
name: stop sccache server
run: sccache --stop-server || true
Expand All @@ -93,7 +93,7 @@ jobs:
uses: actions/upload-artifact@v2
with:
name: manta
path: target/release/manta
path: target/production/manta

run-benchmark:
name: benchmark (${{ matrix.benchmark.pallet.name }} ${{ matrix.benchmark.extrinsic.name }})
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/generate_manta_weights_files.yml
Expand Up @@ -84,7 +84,7 @@ jobs:
CARGO_TERM_COLOR: always
run: |
source ${HOME}/.cargo/env
CARGO_PROFILE_RELEASE_LTO=true RUSTFLAGS="-C codegen-units=1" cargo build --release --verbose --features=runtime-benchmarks
cargo build --profile production --verbose --features=runtime-benchmarks
-
name: stop sccache server
run: sccache --stop-server || true
Expand All @@ -93,7 +93,7 @@ jobs:
uses: actions/upload-artifact@v2
with:
name: manta
path: target/release/manta
path: target/production/manta

run-benchmark:
name: benchmark (${{ matrix.benchmark.pallet.name }} ${{ matrix.benchmark.extrinsic.name }})
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/publish-draft-releases.yml
Expand Up @@ -155,20 +155,20 @@ jobs:
SCCACHE_DIR: /home/runner/.cache/sccache
run: |
source ${HOME}/.cargo/env
CARGO_PROFILE_RELEASE_LTO=true RUSTFLAGS="-C codegen-units=1" cargo build --release --verbose
cargo build --profile production --verbose
-
name: stop sccache server
run: sccache --stop-server || true
-
name: strip
run: |
strip target/release/manta
strip target/production/manta
-
name: upload
uses: actions/upload-artifact@v2
with:
name: manta
path: target/release/manta
path: target/production/manta
-
name: upload
uses: actions/upload-artifact@v2
Expand Down Expand Up @@ -250,7 +250,7 @@ jobs:
SCCACHE_DIR: /home/runner/.cache/sccache
run: |
source ${HOME}/.cargo/env
cargo build --verbose --release
cargo build --profile production --verbose
-
if: ${{ needs.check-for-runtime-upgrade.outputs.do-versions-match == 'false' }}
name: stop sccache server
Expand All @@ -259,14 +259,14 @@ jobs:
if: ${{ needs.check-for-runtime-upgrade.outputs.do-versions-match == 'false' }}
name: strip
run: |
strip target/release/manta
strip target/production/manta
-
if: ${{ needs.check-for-runtime-upgrade.outputs.do-versions-match == 'false' }}
name: upload
uses: actions/upload-artifact@v2
with:
name: manta-base
path: target/release/manta
path: target/production/manta
-
name: upload
uses: actions/upload-artifact@v2
Expand Down
10 changes: 9 additions & 1 deletion Cargo.toml
Expand Up @@ -8,5 +8,13 @@ members = [
'runtime/dolphin',
]

[profile.production]
inherits = "release"
codegen-units = 1
lto = true

[profile.release]
panic = "unwind"
panic = "unwind"

[profile.test]
debug = true
7 changes: 4 additions & 3 deletions README.md
Expand Up @@ -12,11 +12,12 @@
Manta is a privacy preserving DeFi stack on Polkadot/Substrate. The code currently hasn't been properly security audited (work in progress), use it at your own risk.

## Build Manta/Calamari Node
```
```bash
chmod u+x ./scripts/init.sh
./scripts/init.sh
cargo build --release
cargo b --profile production
```
> Tips: The binary will be generated under `target/production/manta`.
## Manta Developement
Currently, there are two developing branches:
Expand Down Expand Up @@ -73,4 +74,4 @@ now you can watch the ci build your awesome feature and publish your draft relea

## Minimum supported rust compiler

This project's MSRV is `rustc 1.56`
This project's MSRV is `rustc 1.57`
1 change: 1 addition & 0 deletions node/Cargo.toml
Expand Up @@ -3,6 +3,7 @@ authors = ['Manta Network']
build = 'build.rs'
description = 'Manta Parachain Node.'
edition = '2021'
rust-version = '1.57'
homepage = 'https://manta.network'
license = 'GPL-3.0'
name = 'manta'
Expand Down

0 comments on commit a3d7f30

Please sign in to comment.