From c2139da85f6baaea335792c882f1476961262a98 Mon Sep 17 00:00:00 2001 From: b-yap <2826165+b-yap@users.noreply.github.com> Date: Tue, 14 May 2024 16:02:46 +0800 Subject: [PATCH] run test using nightly --- .github/actions/shared/action.yml | 50 ++++++++++++++++++++ .github/workflows/test-code.yml | 76 ++++++++++++------------------- 2 files changed, 78 insertions(+), 48 deletions(-) create mode 100644 .github/actions/shared/action.yml diff --git a/.github/actions/shared/action.yml b/.github/actions/shared/action.yml new file mode 100644 index 000000000..9b1943e1f --- /dev/null +++ b/.github/actions/shared/action.yml @@ -0,0 +1,50 @@ +name: Shared action +runs: composite +steps: + - name: Freeing up more disk space + - run: | + sudo swapoff -a + sudo rm -f /mnt/swapfile + free -h + docker rmi $(docker image ls -aq) + sudo rm -rf /usr/local/lib/android # will release about 10 GB if you don't need Android + sudo rm -rf /usr/share/dotnet # will release about 20GB if you don't need .NET + sudo rm -rf /opt/ghc + sudo rm -rf /usr/local/share/boost + sudo rm -rf /opt/hostedtoolcache + sudo rm -rf "$AGENT_TOOLSDIRECTORY" + sudo apt-get remove -y 'php.*' --fix-missing + sudo apt-get remove -y '^mongodb-.*' --fix-missing + sudo apt-get remove -y '^mysql-.*' --fix-missing + sudo apt-get remove -y azure-cli google-chrome-stable firefox powershell mono-devel libgl1-mesa-dri --fix-missing + sudo apt-get remove -y google-cloud-sdk --fix-missing + sudo apt-get remove -y google-cloud-cli --fix-missing + sudo apt-get autoremove -y + sudo apt-get clean + df -h + shell: bash + + - name: Install package + run: | + echo 'APT::Get::Always-Include-Phased-Updates "false";' | sudo tee /etc/apt/apt.conf.d/99-phased-updates + sudo apt-get update && sudo apt-get upgrade -y + sudo apt-get install -y protobuf-compiler libprotobuf-dev + shell: bash + + - name: Checkout Code + uses: actions/checkout@v3 + + # Steps taken from https://github.com/actions/cache/blob/master/examples.md#rust---cargo + - name: Cache cargo registry + uses: actions/cache@v4 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} + + - name: Install Protoc + uses: arduino/setup-protoc@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/test-code.yml b/.github/workflows/test-code.yml index fbc54f046..e68e29e03 100644 --- a/.github/workflows/test-code.yml +++ b/.github/workflows/test-code.yml @@ -9,50 +9,11 @@ on: - main jobs: - test-code: + build-check: runs-on: ubuntu-latest steps: - - name: Freeing up more disk space - run: | - sudo swapoff -a - sudo rm -f /mnt/swapfile - free -h - docker rmi $(docker image ls -aq) - sudo rm -rf /usr/local/lib/android # will release about 10 GB if you don't need Android - sudo rm -rf /usr/share/dotnet # will release about 20GB if you don't need .NET - sudo rm -rf /opt/ghc - sudo rm -rf /usr/local/share/boost - sudo rm -rf /opt/hostedtoolcache - sudo rm -rf "$AGENT_TOOLSDIRECTORY" - sudo apt-get remove -y 'php.*' --fix-missing - sudo apt-get remove -y '^mongodb-.*' --fix-missing - sudo apt-get remove -y '^mysql-.*' --fix-missing - sudo apt-get remove -y azure-cli google-chrome-stable firefox powershell mono-devel libgl1-mesa-dri --fix-missing - sudo apt-get remove -y google-cloud-sdk --fix-missing - sudo apt-get remove -y google-cloud-cli --fix-missing - sudo apt-get autoremove -y - sudo apt-get clean - df -h - - - name: Install package - run: | - echo 'APT::Get::Always-Include-Phased-Updates "false";' | sudo tee /etc/apt/apt.conf.d/99-phased-updates - sudo apt-get update && sudo apt-get upgrade -y - sudo apt-get install -y protobuf-compiler libprotobuf-dev - - - name: Checkout Code - uses: actions/checkout@v3 - - # Steps taken from https://github.com/actions/cache/blob/master/examples.md#rust---cargo - - name: Cache cargo registry - uses: actions/cache@v4 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - target - key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} + - uses: ./.github/actions/my-shared-steps - name: Install toolchain # Call `rustup show` as a hack so that the toolchain defined in rust-toolchain.toml is installed @@ -62,13 +23,32 @@ jobs: # - name: Check and Lint Code # run: cargo +nightly-2021-12-01 clippy -- -D warnings - - name: Install Protoc - uses: arduino/setup-protoc@v1 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - - name: Check Code run: cargo check - - name: Test Code - run: cargo test + test-code: + runs-on: ubuntu-latest + + steps: + - uses: ./.github/actions/my-shared-steps + + - name: Remove rust-toolchain.toml + # To make sure that the nightly version will be used all throughout + run: | + rm /home/runner/work/pendulum/pendulum/rust-toolchain + + - name: Setup nightly Rust toolchain + uses: dtolnay/rust-toolchain@nightly + with: + toolchain: nightly-2024-02-09 + components: rustfmt, clippy + target: wasm32-unknown-unknown + + - name: Setup nightly Rust as default + run: rustup default nightly-2024-02-09 + + - name: Test + uses: actions-rs/cargo@v1 + with: + toolchain: nightly-2024-02-09 + command: test