From 363b49fcb3162e5ed2255e89fea0019b9e0c68f3 Mon Sep 17 00:00:00 2001 From: Flouse <1297478+Flouse@users.noreply.github.com> Date: Fri, 27 Oct 2023 14:59:44 +0800 Subject: [PATCH] chore(CI): build a portable binary in CI for different CPU architectures (#1504) * chore(CI): RocksDB uses `-march=native`, Axon uses it too * chore(CI): build a portable binary in CI for different CPU architectures --- .../workflows/axon-start-with-short-genesis.yml | 14 ++++++++++++-- .github/workflows/hardfork_test.yml | 7 ++++++- .github/workflows/openzeppelin_test_11.yml | 7 ++++++- .github/workflows/openzeppelin_test_16_19.yml | 7 ++++++- .../workflows/openzeppelin_test_1_5_and_12_15.yml | 7 ++++++- .github/workflows/openzeppelin_test_6_10.yml | 7 ++++++- .github/workflows/v3_core_test.yml | 7 ++++++- .github/workflows/web3_compatible.yml | 7 ++++++- 8 files changed, 54 insertions(+), 9 deletions(-) diff --git a/.github/workflows/axon-start-with-short-genesis.yml b/.github/workflows/axon-start-with-short-genesis.yml index e160b59af..89c3fd8c6 100644 --- a/.github/workflows/axon-start-with-short-genesis.yml +++ b/.github/workflows/axon-start-with-short-genesis.yml @@ -32,7 +32,12 @@ jobs: restore-keys: | ${{ matrix.os }}-${{ runner.os }}-${{ runner.arch }}-cargo-build - name: Build Axon in the development profile - run: cargo build + run: | + # check for AVX2 support by inspecting `/proc/cpuinfo` or running `lscpu` + # related issue: https://github.com/axonweb3/axon/issues/1387 + lscpu + # PORTABLE=1 USE_SSE=1 tell rocksdb to target AVX2 + PORTABLE=1 USE_SSE=1 cargo build - name: Start a single Axon node env: @@ -87,7 +92,12 @@ jobs: restore-keys: | ${{ matrix.os }}-${{ runner.os }}-${{ runner.arch }}-cargo-build - name: Build Axon in the development profile - run: cargo build + run: | + # check for AVX2 support by inspecting `/proc/cpuinfo` or running `lscpu` + # related issue: https://github.com/axonweb3/axon/issues/1387 + lscpu + # PORTABLE=1 USE_SSE=1 tell rocksdb to target AVX2 + PORTABLE=1 USE_SSE=1 cargo build - name: Start multiple Axon nodes env: diff --git a/.github/workflows/hardfork_test.yml b/.github/workflows/hardfork_test.yml index 04f690363..b82397151 100644 --- a/.github/workflows/hardfork_test.yml +++ b/.github/workflows/hardfork_test.yml @@ -31,7 +31,12 @@ jobs: restore-keys: | ${{ matrix.os }}-${{ runner.os }}-${{ runner.arch }}-cargo-build - name: Build Axon in the development profile - run: cargo build + run: | + # check for AVX2 support by inspecting `/proc/cpuinfo` or running `lscpu` + # related issue: https://github.com/axonweb3/axon/issues/1387 + lscpu + # PORTABLE=1 USE_SSE=1 tell rocksdb to target AVX2 + PORTABLE=1 USE_SSE=1 cargo build - name: Start multiple Axon nodes env: diff --git a/.github/workflows/openzeppelin_test_11.yml b/.github/workflows/openzeppelin_test_11.yml index e964dd81a..0aee91c19 100644 --- a/.github/workflows/openzeppelin_test_11.yml +++ b/.github/workflows/openzeppelin_test_11.yml @@ -105,7 +105,12 @@ jobs: restore-keys: | ${{ matrix.os }}-${{ runner.os }}-${{ runner.arch }}-cargo-build - name: Build Axon in the development profile - run: cargo build + run: | + # check for AVX2 support by inspecting `/proc/cpuinfo` or running `lscpu` + # related issue: https://github.com/axonweb3/axon/issues/1387 + lscpu + # PORTABLE=1 USE_SSE=1 tell rocksdb to target AVX2 + PORTABLE=1 USE_SSE=1 cargo build - name: Deploy Local Network of Axon run: | diff --git a/.github/workflows/openzeppelin_test_16_19.yml b/.github/workflows/openzeppelin_test_16_19.yml index 1b66ca28d..63116b9a5 100644 --- a/.github/workflows/openzeppelin_test_16_19.yml +++ b/.github/workflows/openzeppelin_test_16_19.yml @@ -105,7 +105,12 @@ jobs: restore-keys: | ${{ matrix.os }}-${{ runner.os }}-${{ runner.arch }}-cargo-build - name: Build Axon in the development profile - run: cargo build + run: | + # check for AVX2 support by inspecting `/proc/cpuinfo` or running `lscpu` + # related issue: https://github.com/axonweb3/axon/issues/1387 + lscpu + # PORTABLE=1 USE_SSE=1 tell rocksdb to target AVX2 + PORTABLE=1 USE_SSE=1 cargo build - name: Deploy Local Network of Axon run: | diff --git a/.github/workflows/openzeppelin_test_1_5_and_12_15.yml b/.github/workflows/openzeppelin_test_1_5_and_12_15.yml index 094957c87..ff882c0e4 100644 --- a/.github/workflows/openzeppelin_test_1_5_and_12_15.yml +++ b/.github/workflows/openzeppelin_test_1_5_and_12_15.yml @@ -106,7 +106,12 @@ jobs: restore-keys: | ${{ matrix.os }}-${{ runner.os }}-${{ runner.arch }}-cargo-build - name: Build Axon in the development profile - run: cargo build + run: | + # check for AVX2 support by inspecting `/proc/cpuinfo` or running `lscpu` + # related issue: https://github.com/axonweb3/axon/issues/1387 + lscpu + # PORTABLE=1 USE_SSE=1 tell rocksdb to target AVX2 + PORTABLE=1 USE_SSE=1 cargo build - name: Deploy Local Network of Axon run: | diff --git a/.github/workflows/openzeppelin_test_6_10.yml b/.github/workflows/openzeppelin_test_6_10.yml index 0dd1ef4b9..2dbee05d7 100644 --- a/.github/workflows/openzeppelin_test_6_10.yml +++ b/.github/workflows/openzeppelin_test_6_10.yml @@ -105,7 +105,12 @@ jobs: restore-keys: | ${{ matrix.os }}-${{ runner.os }}-${{ runner.arch }}-cargo-build - name: Build Axon in the development profile - run: cargo build + run: | + # check for AVX2 support by inspecting `/proc/cpuinfo` or running `lscpu` + # related issue: https://github.com/axonweb3/axon/issues/1387 + lscpu + # PORTABLE=1 USE_SSE=1 tell rocksdb to target AVX2 + PORTABLE=1 USE_SSE=1 cargo build - name: Deploy Local Network of Axon run: | diff --git a/.github/workflows/v3_core_test.yml b/.github/workflows/v3_core_test.yml index b66e86277..d488b3f7b 100644 --- a/.github/workflows/v3_core_test.yml +++ b/.github/workflows/v3_core_test.yml @@ -93,7 +93,12 @@ jobs: restore-keys: | ${{ matrix.os }}-${{ runner.os }}-${{ runner.arch }}-cargo-build - name: Build Axon in the development profile - run: cargo build + run: | + # check for AVX2 support by inspecting `/proc/cpuinfo` or running `lscpu` + # related issue: https://github.com/axonweb3/axon/issues/1387 + lscpu + # PORTABLE=1 USE_SSE=1 tell rocksdb to target AVX2 + PORTABLE=1 USE_SSE=1 cargo build - name: Deploy Local Network of Axon run: | diff --git a/.github/workflows/web3_compatible.yml b/.github/workflows/web3_compatible.yml index c0113e8be..dbb6545e8 100644 --- a/.github/workflows/web3_compatible.yml +++ b/.github/workflows/web3_compatible.yml @@ -65,7 +65,12 @@ jobs: restore-keys: | ${{ matrix.os }}-${{ runner.os }}-${{ runner.arch }}-cargo-build - name: Build Axon in the development profile - run: cargo build + run: | + # check for AVX2 support by inspecting `/proc/cpuinfo` or running `lscpu` + # related issue: https://github.com/axonweb3/axon/issues/1387 + lscpu + # PORTABLE=1 USE_SSE=1 tell rocksdb to target AVX2 + PORTABLE=1 USE_SSE=1 cargo build - name: Deploy Local Network of Axon run: | ./target/debug/axon init \