From 5fe54a30b1de37bd3adee923dbf6cfb4fd88bba0 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Wed, 1 Nov 2023 15:49:10 +1100 Subject: [PATCH 01/11] add tests workflow --- .github/workflows/rust-tests.yaml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/rust-tests.yaml diff --git a/.github/workflows/rust-tests.yaml b/.github/workflows/rust-tests.yaml new file mode 100644 index 00000000000..c4e2e0b47df --- /dev/null +++ b/.github/workflows/rust-tests.yaml @@ -0,0 +1,31 @@ +name: Rust tests + +on: + pull_request: + push: + branches: + - main + +concurrency: + group: ${{ github.ref }}-${{ github.workflow }} + cancel-in-progress: true + +jobs: + rust-checks: + runs-on: ubuntu-20.04 + steps: + - name: Checkout source code + uses: actions/checkout@v4 + + - name: Install Protoc + uses: arduino/setup-protoc@v1 + with: + version: "3.6.1" + + - name: Add wasm32-unknown-unknown target + run: rustup target add wasm32-unknown-unknown + + - name: Run Tests + uses: actions-rs/cargo@v1 + with: + command: test From ecaf38c5c08ab67a2334c24ed8bc8fb5694c372f Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Wed, 1 Nov 2023 15:50:32 +1100 Subject: [PATCH 02/11] typo --- .github/workflows/rust-tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust-tests.yaml b/.github/workflows/rust-tests.yaml index c4e2e0b47df..9203e4630fb 100644 --- a/.github/workflows/rust-tests.yaml +++ b/.github/workflows/rust-tests.yaml @@ -11,7 +11,7 @@ concurrency: cancel-in-progress: true jobs: - rust-checks: + rust-tests: runs-on: ubuntu-20.04 steps: - name: Checkout source code From f32ecbbbad405f967688dc15d30343da7475a0a0 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Wed, 1 Nov 2023 16:33:46 +1100 Subject: [PATCH 03/11] build before test --- .github/workflows/rust-tests.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/rust-tests.yaml b/.github/workflows/rust-tests.yaml index 9203e4630fb..14bd1e4ce92 100644 --- a/.github/workflows/rust-tests.yaml +++ b/.github/workflows/rust-tests.yaml @@ -25,6 +25,11 @@ jobs: - name: Add wasm32-unknown-unknown target run: rustup target add wasm32-unknown-unknown + - name: Build binary for test + uses: actions-rs/cargo@v1 + with: + command: build + - name: Run Tests uses: actions-rs/cargo@v1 with: From 59429e292762e595ae485177b433124e20d381f1 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Fri, 3 Nov 2023 11:29:03 +1100 Subject: [PATCH 04/11] try fix disk space issue --- .github/workflows/rust-tests.yaml | 38 +++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/.github/workflows/rust-tests.yaml b/.github/workflows/rust-tests.yaml index 14bd1e4ce92..ddbf106afdd 100644 --- a/.github/workflows/rust-tests.yaml +++ b/.github/workflows/rust-tests.yaml @@ -25,12 +25,50 @@ jobs: - name: Add wasm32-unknown-unknown target run: rustup target add wasm32-unknown-unknown + - name: Check disk space + run: df . -h + + - name: Free disk space + run: | + sudo docker rmi $(docker image ls -aq) >/dev/null 2>&1 || true + sudo rm -rf \ + /usr/share/dotnet /usr/local/lib/android /opt/ghc \ + /usr/local/share/powershell /usr/share/swift /usr/local/.ghcup \ + /usr/lib/jvm || true + sudo apt install aptitude -y >/dev/null 2>&1 + sudo aptitude purge aria2 ansible azure-cli shellcheck rpm xorriso zsync \ + esl-erlang firefox gfortran-8 gfortran-9 google-chrome-stable \ + google-cloud-sdk imagemagick \ + libmagickcore-dev libmagickwand-dev libmagic-dev ant ant-optional kubectl \ + mercurial apt-transport-https mono-complete libmysqlclient \ + unixodbc-dev yarn chrpath libssl-dev libxft-dev \ + libfreetype6 libfreetype6-dev libfontconfig1 libfontconfig1-dev \ + snmp pollinate libpq-dev postgresql-client powershell ruby-full \ + sphinxsearch subversion mongodb-org azure-cli microsoft-edge-stable \ + -y -f >/dev/null 2>&1 + sudo aptitude purge google-cloud-sdk -f -y >/dev/null 2>&1 + sudo aptitude purge microsoft-edge-stable -f -y >/dev/null 2>&1 || true + sudo apt purge microsoft-edge-stable -f -y >/dev/null 2>&1 || true + sudo aptitude purge '~n ^mysql' -f -y >/dev/null 2>&1 + sudo aptitude purge '~n ^php' -f -y >/dev/null 2>&1 + sudo aptitude purge '~n ^dotnet' -f -y >/dev/null 2>&1 + sudo apt-get autoremove -y >/dev/null 2>&1 + sudo apt-get autoclean -y >/dev/null 2>&1 + + - name: Check disk space + run: | + sudo dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -nr | head + df . -h + sudo du /usr/ -hx -d 4 --threshold=1G | sort -hr | head + - name: Build binary for test uses: actions-rs/cargo@v1 with: command: build + args: --release - name: Run Tests uses: actions-rs/cargo@v1 with: command: test + args: --release From 2e1c3e743b06c5b730bd860bbd14babbacf5f7ce Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Fri, 3 Nov 2023 13:51:45 +1100 Subject: [PATCH 05/11] fixes --- .github/workflows/rust-tests.yaml | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/.github/workflows/rust-tests.yaml b/.github/workflows/rust-tests.yaml index ddbf106afdd..12cddd78028 100644 --- a/.github/workflows/rust-tests.yaml +++ b/.github/workflows/rust-tests.yaml @@ -14,6 +14,7 @@ jobs: rust-tests: runs-on: ubuntu-20.04 steps: + - uses: actions-rust-lang/setup-rust-toolchain@v1 - name: Checkout source code uses: actions/checkout@v4 @@ -55,20 +56,8 @@ jobs: sudo apt-get autoremove -y >/dev/null 2>&1 sudo apt-get autoclean -y >/dev/null 2>&1 - - name: Check disk space - run: | - sudo dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -nr | head - df . -h - sudo du /usr/ -hx -d 4 --threshold=1G | sort -hr | head + - name: cargo build binary required for test + run: SKIP_WASM_BUILD=1 cargo build -p try-runtime-cli - - name: Build binary for test - uses: actions-rs/cargo@v1 - with: - command: build - args: --release - - - name: Run Tests - uses: actions-rs/cargo@v1 - with: - command: test - args: --release + - name: cargo test + run: SKIP_WASM_BUILD=1 cargo test From 07aab081800ee9e045ec5c840ada778c85cfcf88 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Fri, 3 Nov 2023 13:55:06 +1100 Subject: [PATCH 06/11] move tests into existing workflow file --- .github/workflows/rust-checks.yaml | 54 +++++++++++++++++++++++++ .github/workflows/rust-tests.yaml | 63 ------------------------------ 2 files changed, 54 insertions(+), 63 deletions(-) delete mode 100644 .github/workflows/rust-tests.yaml diff --git a/.github/workflows/rust-checks.yaml b/.github/workflows/rust-checks.yaml index db4b50ace0b..43cbd516f7c 100644 --- a/.github/workflows/rust-checks.yaml +++ b/.github/workflows/rust-checks.yaml @@ -21,6 +21,7 @@ jobs: toolchain: nightly components: rustfmt - uses: actions-rust-lang/rustfmt@v1 + clippy-lint: runs-on: ubuntu-20.04 steps: @@ -39,3 +40,56 @@ jobs: with: toolchain: stable args: --all-targets --all-features + + rust-tests: + runs-on: ubuntu-20.04 + steps: + - uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + toolchain: stable + - name: Checkout source code + uses: actions/checkout@v4 + + - name: Install Protoc + uses: arduino/setup-protoc@v1 + with: + version: "3.6.1" + + - name: Add wasm32-unknown-unknown target + run: rustup target add wasm32-unknown-unknown + + - name: Check disk space + run: df . -h + + - name: Free disk space + run: | + sudo docker rmi $(docker image ls -aq) >/dev/null 2>&1 || true + sudo rm -rf \ + /usr/share/dotnet /usr/local/lib/android /opt/ghc \ + /usr/local/share/powershell /usr/share/swift /usr/local/.ghcup \ + /usr/lib/jvm || true + sudo apt install aptitude -y >/dev/null 2>&1 + sudo aptitude purge aria2 ansible azure-cli shellcheck rpm xorriso zsync \ + esl-erlang firefox gfortran-8 gfortran-9 google-chrome-stable \ + google-cloud-sdk imagemagick \ + libmagickcore-dev libmagickwand-dev libmagic-dev ant ant-optional kubectl \ + mercurial apt-transport-https mono-complete libmysqlclient \ + unixodbc-dev yarn chrpath libssl-dev libxft-dev \ + libfreetype6 libfreetype6-dev libfontconfig1 libfontconfig1-dev \ + snmp pollinate libpq-dev postgresql-client powershell ruby-full \ + sphinxsearch subversion mongodb-org azure-cli microsoft-edge-stable \ + -y -f >/dev/null 2>&1 + sudo aptitude purge google-cloud-sdk -f -y >/dev/null 2>&1 + sudo aptitude purge microsoft-edge-stable -f -y >/dev/null 2>&1 || true + sudo apt purge microsoft-edge-stable -f -y >/dev/null 2>&1 || true + sudo aptitude purge '~n ^mysql' -f -y >/dev/null 2>&1 + sudo aptitude purge '~n ^php' -f -y >/dev/null 2>&1 + sudo aptitude purge '~n ^dotnet' -f -y >/dev/null 2>&1 + sudo apt-get autoremove -y >/dev/null 2>&1 + sudo apt-get autoclean -y >/dev/null 2>&1 + + - name: cargo build binary required for test + run: SKIP_WASM_BUILD=1 cargo build -p try-runtime-cli + + - name: cargo test + run: SKIP_WASM_BUILD=1 cargo test diff --git a/.github/workflows/rust-tests.yaml b/.github/workflows/rust-tests.yaml deleted file mode 100644 index 12cddd78028..00000000000 --- a/.github/workflows/rust-tests.yaml +++ /dev/null @@ -1,63 +0,0 @@ -name: Rust tests - -on: - pull_request: - push: - branches: - - main - -concurrency: - group: ${{ github.ref }}-${{ github.workflow }} - cancel-in-progress: true - -jobs: - rust-tests: - runs-on: ubuntu-20.04 - steps: - - uses: actions-rust-lang/setup-rust-toolchain@v1 - - name: Checkout source code - uses: actions/checkout@v4 - - - name: Install Protoc - uses: arduino/setup-protoc@v1 - with: - version: "3.6.1" - - - name: Add wasm32-unknown-unknown target - run: rustup target add wasm32-unknown-unknown - - - name: Check disk space - run: df . -h - - - name: Free disk space - run: | - sudo docker rmi $(docker image ls -aq) >/dev/null 2>&1 || true - sudo rm -rf \ - /usr/share/dotnet /usr/local/lib/android /opt/ghc \ - /usr/local/share/powershell /usr/share/swift /usr/local/.ghcup \ - /usr/lib/jvm || true - sudo apt install aptitude -y >/dev/null 2>&1 - sudo aptitude purge aria2 ansible azure-cli shellcheck rpm xorriso zsync \ - esl-erlang firefox gfortran-8 gfortran-9 google-chrome-stable \ - google-cloud-sdk imagemagick \ - libmagickcore-dev libmagickwand-dev libmagic-dev ant ant-optional kubectl \ - mercurial apt-transport-https mono-complete libmysqlclient \ - unixodbc-dev yarn chrpath libssl-dev libxft-dev \ - libfreetype6 libfreetype6-dev libfontconfig1 libfontconfig1-dev \ - snmp pollinate libpq-dev postgresql-client powershell ruby-full \ - sphinxsearch subversion mongodb-org azure-cli microsoft-edge-stable \ - -y -f >/dev/null 2>&1 - sudo aptitude purge google-cloud-sdk -f -y >/dev/null 2>&1 - sudo aptitude purge microsoft-edge-stable -f -y >/dev/null 2>&1 || true - sudo apt purge microsoft-edge-stable -f -y >/dev/null 2>&1 || true - sudo aptitude purge '~n ^mysql' -f -y >/dev/null 2>&1 - sudo aptitude purge '~n ^php' -f -y >/dev/null 2>&1 - sudo aptitude purge '~n ^dotnet' -f -y >/dev/null 2>&1 - sudo apt-get autoremove -y >/dev/null 2>&1 - sudo apt-get autoclean -y >/dev/null 2>&1 - - - name: cargo build binary required for test - run: SKIP_WASM_BUILD=1 cargo build -p try-runtime-cli - - - name: cargo test - run: SKIP_WASM_BUILD=1 cargo test From d5381a4a649d6d917ea5df5373bcc90162d5e588 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Fri, 3 Nov 2023 14:01:24 +1100 Subject: [PATCH 07/11] check disk space after --- .github/workflows/rust-checks.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/rust-checks.yaml b/.github/workflows/rust-checks.yaml index 43cbd516f7c..2c9db8720d8 100644 --- a/.github/workflows/rust-checks.yaml +++ b/.github/workflows/rust-checks.yaml @@ -87,6 +87,9 @@ jobs: sudo aptitude purge '~n ^dotnet' -f -y >/dev/null 2>&1 sudo apt-get autoremove -y >/dev/null 2>&1 sudo apt-get autoclean -y >/dev/null 2>&1 + + - name: Check disk space + run: df . -h - name: cargo build binary required for test run: SKIP_WASM_BUILD=1 cargo build -p try-runtime-cli From 6e3af8359a4b9b36928aff757db123825ab94383 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Fri, 3 Nov 2023 15:47:52 +1100 Subject: [PATCH 08/11] fix --- .github/workflows/rust-checks.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust-checks.yaml b/.github/workflows/rust-checks.yaml index 2c9db8720d8..2247f28dc00 100644 --- a/.github/workflows/rust-checks.yaml +++ b/.github/workflows/rust-checks.yaml @@ -92,7 +92,7 @@ jobs: run: df . -h - name: cargo build binary required for test - run: SKIP_WASM_BUILD=1 cargo build -p try-runtime-cli + run: cargo build -p try-runtime-cli - name: cargo test run: SKIP_WASM_BUILD=1 cargo test From d54cbced3803f201ff1cfa29b7ae161e06e02929 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Fri, 3 Nov 2023 16:03:41 +1100 Subject: [PATCH 09/11] fix --- .github/workflows/rust-checks.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust-checks.yaml b/.github/workflows/rust-checks.yaml index 2247f28dc00..483338c4f02 100644 --- a/.github/workflows/rust-checks.yaml +++ b/.github/workflows/rust-checks.yaml @@ -95,4 +95,4 @@ jobs: run: cargo build -p try-runtime-cli - name: cargo test - run: SKIP_WASM_BUILD=1 cargo test + run: cargo test From e207248e98681ffd46378d1ea12e98feefbaea0f Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Fri, 3 Nov 2023 16:13:58 +1100 Subject: [PATCH 10/11] optimise build --- .github/workflows/rust-checks.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust-checks.yaml b/.github/workflows/rust-checks.yaml index 483338c4f02..43c021fdf08 100644 --- a/.github/workflows/rust-checks.yaml +++ b/.github/workflows/rust-checks.yaml @@ -92,7 +92,7 @@ jobs: run: df . -h - name: cargo build binary required for test - run: cargo build -p try-runtime-cli + run: SKIP_WASM_BUILD=1 cargo build -p try-runtime-cli - name: cargo test run: cargo test From 712e22c31c1d6fc6e53d46965cb2c2cade3b667f Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Sat, 4 Nov 2023 09:10:52 +1100 Subject: [PATCH 11/11] build release --- .github/workflows/rust-checks.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rust-checks.yaml b/.github/workflows/rust-checks.yaml index 43c021fdf08..62e7ec1f794 100644 --- a/.github/workflows/rust-checks.yaml +++ b/.github/workflows/rust-checks.yaml @@ -92,7 +92,9 @@ jobs: run: df . -h - name: cargo build binary required for test - run: SKIP_WASM_BUILD=1 cargo build -p try-runtime-cli + # build --release or the execution time of the test is too long + run: cargo build --release -p try-runtime-cli - name: cargo test - run: cargo test + # build --release or the execution time of the test is too long + run: cargo test --release