Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSUB-1231: Use --profile=production for all builds & CI jobs #437

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/bench.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ mkdir -p "pallets/$PALLET/src"

if [[ $BUILD -eq 0 ]]
then
cargo $COMMAND --release --features runtime-benchmarks || exit 1;
cargo $COMMAND --profile=production --features runtime-benchmarks || exit 1;
fi

if [[ $BENCH -eq 0 ]]
then
./target/release/creditcoin3-node benchmark pallet --chain dev --steps="$STEPS" --repeat="$REPEAT" --pallet "pallet_$PALLET" --extrinsic='*' --wasm-execution=compiled --heap-pages=10000 --output "$OUTPUT"
./target/production/creditcoin3-node benchmark pallet --chain dev --steps="$STEPS" --repeat="$REPEAT" --pallet "pallet_$PALLET" --extrinsic='*' --wasm-execution=compiled --heap-pages=10000 --output "$OUTPUT"
sed -i "s/pallet_$PALLET/crate/" "$OUTPUT"
fi
2 changes: 1 addition & 1 deletion .github/check-extrinsics.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

set -ex

HEAD_BIN=./target/release/creditcoin3-node
HEAD_BIN=./target/production/creditcoin3-node
HEAD_WS=ws://localhost:9944
RELEASE_WS=ws://localhost:9955

Expand Down
2 changes: 1 addition & 1 deletion .github/check-hardware.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ cat /proc/cpuinfo
free -m
cat /proc/meminfo

./target/release/creditcoin3-node benchmark machine --chain dev
./target/production/creditcoin3-node benchmark machine --chain dev
50 changes: 25 additions & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -285,11 +285,11 @@ jobs:

- name: Check Build
run: |
SKIP_WASM_BUILD=1 cargo check --release
SKIP_WASM_BUILD=1 cargo check --profile=production

- name: Check Build for Benchmarking
run: |
SKIP_WASM_BUILD=1 cargo check --features=runtime-benchmarks --release
SKIP_WASM_BUILD=1 cargo check --features=runtime-benchmarks --profile=production

unit-test-creditcoin:
runs-on: ubuntu-24.04
Expand Down Expand Up @@ -367,19 +367,19 @@ jobs:
uses: gluwa/cargo@dev
with:
command: build
args: --release ${{ steps.compiler-flags.outputs.extra }}
args: --profile=production ${{ steps.compiler-flags.outputs.extra }}

- name: Upload creditcoin-node binary
uses: actions/upload-artifact@v4
with:
name: creditcoin-node-${{ matrix.target }}
path: target/release/creditcoin3-node
path: target/production/creditcoin3-node

- name: Upload WASM runtime
uses: actions/upload-artifact@v4
with:
name: creditcoin_node_runtime.compact.compressed.wasm-${{ matrix.target }}
path: target/release/wbuild/creditcoin3-runtime/creditcoin_next_runtime.compact.compressed.wasm
path: target/production/wbuild/creditcoin3-runtime/creditcoin_next_runtime.compact.compressed.wasm

build-creditcoin-node-for-testing:
needs:
Expand Down Expand Up @@ -429,19 +429,19 @@ jobs:
uses: gluwa/cargo@dev
with:
command: build
args: --release --features=fast-runtime ${{ steps.compiler-flags.outputs.extra }}
args: --profile=production --features=fast-runtime ${{ steps.compiler-flags.outputs.extra }}

- name: Upload creditcoin-node binary
uses: actions/upload-artifact@v4
with:
name: creditcoin-node-for-testing-${{ matrix.target }}
path: target/release/creditcoin3-node
path: target/production/creditcoin3-node

- name: Upload WASM runtime
uses: actions/upload-artifact@v4
with:
name: creditcoin_node_runtime.compact.compressed.wasm-for-${{ matrix.target }}
path: target/release/wbuild/creditcoin3-runtime/creditcoin_next_runtime.compact.compressed.wasm
path: target/production/wbuild/creditcoin3-runtime/creditcoin_next_runtime.compact.compressed.wasm

integration-test-smart-contract:
needs:
Expand All @@ -454,7 +454,7 @@ jobs:
uses: actions/download-artifact@v4
with:
name: creditcoin-node-for-testing-ci
path: target/release
path: target/production

- name: Install Node.js
uses: actions/setup-node@v4
Expand All @@ -463,8 +463,8 @@ jobs:

- name: Start Node 1 - Alice
run: |
chmod a+x ./target/release/creditcoin3-node
./target/release/creditcoin3-node \
chmod a+x ./target/production/creditcoin3-node
./target/production/creditcoin3-node \
--dev --validator --pruning archive \
--node-key d182d503b7dd97e7c055f33438c7717145840fd66b2a055284ee8d768241a463 \
--base-path ./alice-data &
Expand Down Expand Up @@ -503,12 +503,12 @@ jobs:
uses: actions/download-artifact@v4
with:
name: creditcoin-node-for-testing-ci
path: target/release
path: target/production

- name: Run Extrinsics Ordering
shell: bash
run: |
chmod a+x ./target/release/creditcoin3-node
chmod a+x ./target/production/creditcoin3-node
./.github/check-extrinsics.sh
env:
GITHUB_TOKEN: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -717,7 +717,7 @@ jobs:
uses: actions/download-artifact@v4
with:
name: creditcoin-node-for-testing-ci
path: target/release
path: target/production

- name: Install Node.js
uses: actions/setup-node@v4
Expand All @@ -727,8 +727,8 @@ jobs:

- name: Start creditcoin3-node in order to update typedefs
run: |
chmod a+x ./target/release/creditcoin3-node
./target/release/creditcoin3-node \
chmod a+x ./target/production/creditcoin3-node
./target/production/creditcoin3-node \
--chain dev \
--validator --alice --pruning archive \
--node-key d182d503b7dd97e7c055f33438c7717145840fd66b2a055284ee8d768241a463 \
Expand Down Expand Up @@ -850,7 +850,7 @@ jobs:
uses: actions/download-artifact@v4
with:
name: creditcoin-node-for-testing-ci
path: target/release
path: target/production

- name: Install Node.js
uses: actions/setup-node@v4
Expand All @@ -860,8 +860,8 @@ jobs:

- name: Start Node 1
run: |
chmod a+x ./target/release/creditcoin3-node
./target/release/creditcoin3-node \
chmod a+x ./target/production/creditcoin3-node
./target/production/creditcoin3-node \
--chain dev \
--validator --alice --pruning archive \
--node-key d182d503b7dd97e7c055f33438c7717145840fd66b2a055284ee8d768241a463 \
Expand Down Expand Up @@ -907,7 +907,7 @@ jobs:
uses: actions/download-artifact@v4
with:
name: creditcoin-node-${{ matrix.chainspec }}
path: target/release
path: target/production

- name: Install Node.js
uses: actions/setup-node@v4
Expand All @@ -917,8 +917,8 @@ jobs:

- name: Start Node 1
run: |
chmod a+x ./target/release/creditcoin3-node
./target/release/creditcoin3-node \
chmod a+x ./target/production/creditcoin3-node
./target/production/creditcoin3-node \
--chain ${{ matrix.chainspec }} \
--validator --alice --pruning archive \
--node-key d182d503b7dd97e7c055f33438c7717145840fd66b2a055284ee8d768241a463 \
Expand Down Expand Up @@ -1038,7 +1038,7 @@ jobs:
uses: actions/download-artifact@v4
with:
name: creditcoin-node-for-testing-ci
path: target/release
path: target/production

- name: Install Node.js
uses: actions/setup-node@v4
Expand Down Expand Up @@ -1082,8 +1082,8 @@ jobs:

- name: Start Creditcoin Node 1 - Alice
run: |
chmod a+x ./target/release/creditcoin3-node
./target/release/creditcoin3-node \
chmod a+x ./target/production/creditcoin3-node
./target/production/creditcoin3-node \
--dev --validator --pruning archive \
--node-key d182d503b7dd97e7c055f33438c7717145840fd66b2a055284ee8d768241a463 \
--base-path ./alice-data &
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,22 +111,22 @@ jobs:
uses: gluwa/cargo@dev
with:
command: build
args: --release ${{ needs.setup.outputs.build_options}}
args: --profile=production ${{ needs.setup.outputs.build_options}}

- name: Build MacOS aarch64 target
if: matrix.operating-system == 'macos-11'
continue-on-error: true
uses: gluwa/cargo@dev
with:
command: build
args: --release --target aarch64-apple-darwin
args: --profile=production --target aarch64-apple-darwin

- name: Compress
continue-on-error: true
uses: thedoctor0/zip-release@0.7.6
with:
type: "zip"
directory: "target/release/"
directory: "target/production/"
path: "creditcoin3-node*"
filename: "../../creditcoin-${{ needs.sanity-check.outputs.TAG_NAME }}-${{ env.PLATFORM }}.zip"
exclusions: "creditcoin3-node.d"
Expand All @@ -137,7 +137,7 @@ jobs:
uses: thedoctor0/zip-release@0.7.6
with:
type: "zip"
directory: "target/aarch64-apple-darwin/release/"
directory: "target/aarch64-apple-darwin/production/"
path: "creditcoin3-node*"
filename: "../../../creditcoin-${{ needs.sanity-check.outputs.TAG_NAME }}-aarch64-apple-darwin.zip"
exclusions: "creditcoin3-node.d"
Expand Down Expand Up @@ -167,8 +167,9 @@ jobs:
id: srtool_build
uses: chevdor/srtool-actions@v0.8.0
env:
BUILD_OPTS: "--release ${{ needs.setup.outputs.build_options }}"
BUILD_OPTS: "${{ needs.setup.outputs.build_options }}"
with:
profile: production
chain: "creditcoin"
runtime_dir: runtime
package: creditcoin3-runtime
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/runtime-upgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,19 +128,19 @@ jobs:
uses: gluwa/cargo@dev
with:
command: build
args: --release
args: --profile=production

- name: Upload creditcoin3-node binary
uses: actions/upload-artifact@v4
with:
name: creditcoin3-node
path: target/release/creditcoin3-node
path: target/production/creditcoin3-node

- name: Upload WASM runtime
uses: actions/upload-artifact@v4
with:
name: creditcoin3_runtime.compact.compressed.wasm
path: target/release/wbuild/creditcoin3-runtime/creditcoin3_runtime.compact.compressed.wasm
path: target/production/wbuild/creditcoin3-runtime/creditcoin3_runtime.compact.compressed.wasm

setup-self-hosted:
needs:
Expand Down Expand Up @@ -323,7 +323,7 @@ jobs:
uses: actions/download-artifact@v4
with:
name: creditcoin3-node
path: target/release
path: target/production

- name: Download creditcoin-fork.json
uses: actions/download-artifact@v4
Expand All @@ -332,10 +332,10 @@ jobs:

- name: Start a local creditcoin3-node from the fork
run: |
chmod a+x ./target/release/creditcoin3-node
chmod a+x ./target/production/creditcoin3-node

./target/release/creditcoin3-node --version
./target/release/creditcoin3-node --chain ./creditcoin-fork.json --validator --alice --pruning archive \
./target/production/creditcoin3-node --version
./target/production/creditcoin3-node --chain ./creditcoin-fork.json --validator --alice --pruning archive \
--base-path /mnt >creditcoin3-node-with-forked-chain.log 2>&1 &

- name: Wait for blockchain to start
Expand Down Expand Up @@ -443,16 +443,16 @@ jobs:
uses: actions/download-artifact@v4
with:
name: creditcoin3-node
path: target/release
path: target/production

- name: Start a disconnected creditcoin3-node
run: |
chmod a+x ./target/release/creditcoin3-node
./target/release/creditcoin3-node --version
chmod a+x ./target/production/creditcoin3-node
./target/production/creditcoin3-node --version

# WARNING: using different port b/c the network remembers there was a node
# at this address previously. We don't want to be connected to the chain !!!
./target/release/creditcoin3-node \
./target/production/creditcoin3-node \
--port 44444 \
--name "test-node-disconnected-$GITHUB_RUN_ID-attempt-$GITHUB_RUN_ATTEMPT" \
--chain ${{ needs.setup.outputs.target_chain }} \
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ jobs:
package: creditcoin3-runtime
workdir: ${{ github.workspace }}
tag: ${{ env.RUSTC_VERSION }}
profile: production
env:
BUILD_OPTS: "--release --features fast-runtime --features devnet"
BUILD_OPTS: "--features fast-runtime --features devnet"
- name: Summary
run: |
echo '${{ steps.srtool_build.outputs.json }}' | jq . > creditcoin-srtool-digest.json
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | /bin/sh -s -- -y
COPY --chown=creditcoin:creditcoin . /creditcoin-node/
# shellcheck source=/dev/null
RUN source ~/.cargo/env && \
cargo build --release ${BUILD_ARGS}
cargo build --profile=production ${BUILD_ARGS}


FROM devel-base AS cli-builder
Expand All @@ -45,7 +45,7 @@ EXPOSE 9944 9933 9615
ENTRYPOINT [ "/bin/creditcoin3-node" ]

COPY --from=cli-builder --chown=creditcoin:creditcoin /creditcoin-node/cli/creditcoin-v*.tgz /creditcoin-node/
COPY --from=rust-builder --chown=creditcoin:creditcoin /creditcoin-node/target/release/creditcoin3-node /bin/creditcoin3-node
COPY --from=rust-builder --chown=creditcoin:creditcoin /creditcoin-node/target/production/creditcoin3-node /bin/creditcoin3-node
COPY --from=rust-builder --chown=creditcoin:creditcoin /creditcoin-node/chainspecs /

USER 0
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ can find more information on features on this template there, and more detailed
To build the chain, execute the following commands from the project root:

```bash
cargo build --release
cargo build --profile=production
```

To execute the chain, run:

```bash
./target/release/creditcoin3-node --dev
./target/production/creditcoin3-node --dev
```

_WARNING: running natively on Windows [is unsupported](https://github.com/gluwa/creditcoin/security/advisories/GHSA-cx5c-xwcv-vhmq)._
Expand All @@ -36,9 +36,9 @@ The node also supports to use manual seal (to produce block manually through RPC
This is also used by the ts-tests:

```bash
$ ./target/release/creditcoin3-node --dev --sealing=manual
$ ./target/production/creditcoin3-node --dev --sealing=manual
# Or
$ ./target/release/creditcoin3-node --dev --sealing=instant
$ ./target/production/creditcoin3-node --dev --sealing=instant
```

### Docker Based Development
Expand Down
2 changes: 1 addition & 1 deletion cli/src/test/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function runNode(name: string, extraArgs: string) {

// warning: do NOT await, runs in background
void execa(
'../target/release/creditcoin3-node',
'../target/production/creditcoin3-node',
`--chain dev --validator --pruning archive ${extraArgs}`.split(' '),
{
detached: true,
Expand Down
Loading