Skip to content

Commit

Permalink
run test using nightly
Browse files Browse the repository at this point in the history
  • Loading branch information
b-yap committed May 14, 2024
1 parent ee26818 commit c2139da
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 48 deletions.
50 changes: 50 additions & 0 deletions .github/actions/shared/action.yml
Original file line number Diff line number Diff line change
@@ -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 }}
76 changes: 28 additions & 48 deletions .github/workflows/test-code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

0 comments on commit c2139da

Please sign in to comment.