Feat ICP Context contract #1280
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Rust | |
on: | |
push: | |
branches: ['master'] | |
pull_request: | |
branches: ['master'] | |
env: | |
CARGO_TERM_COLOR: always | |
CARGO_HOME: | |
RUSTUP_HOME: | |
PNPM_HOME: | |
ALT_HOME: | |
STAGE_DIR: | |
jobs: | |
setup: | |
name: Project setup | |
runs-on: ubuntu-latest | |
steps: | |
- name: Prepare | |
run: | | |
export STAGE_DIR="$(dirname $GITHUB_WORKSPACE)" | |
echo "STAGE_DIR=$STAGE_DIR" >> $GITHUB_ENV | |
export ALT_HOME="$STAGE_DIR/.home" | |
echo "ALT_HOME=$ALT_HOME" >> $GITHUB_ENV | |
- name: Maximize build space | |
uses: easimon/maximize-build-space@v10 | |
with: | |
build-mount-path: ${{ env.STAGE_DIR }} | |
root-reserve-mb: 8192 | |
- name: Relocate environment | |
run: | | |
echo "CARGO_HOME=$ALT_HOME/.cargo" >> $GITHUB_ENV | |
echo "RUSTUP_HOME=$ALT_HOME/.rustup" >> $GITHUB_ENV | |
echo "PNPM_HOME=$ALT_HOME/.pnpm" >> $GITHUB_ENV | |
mkdir $ALT_HOME | |
mv ~/.cargo $ALT_HOME | |
mv ~/.rustup $ALT_HOME | |
echo "$ALT_HOME/.cargo/bin" | cat - $GITHUB_PATH > temp && mv temp $GITHUB_PATH | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
# Install Node.js (version 20) and pnpm | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '20' | |
- name: Install pnpm | |
run: npm install -g pnpm | |
# Install and build node-ui | |
- name: Install node-ui dependencies with pnpm | |
run: pnpm install --prefix ./node-ui | |
- name: Build node-ui | |
run: pnpm --filter ./node-ui run build | |
- name: Setup rust toolchain | |
run: rustup toolchain install stable --profile minimal | |
- name: Setup rust cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Run code style checks | |
uses: ./.github/actions/style | |
- name: Build | |
run: cargo build --verbose | |
# Install pocket-ic for ICP Contract tests | |
- name: Install PocketIC server | |
uses: dfinity/pocketic@main | |
with: | |
pocket-ic-server-version: "7.0.0" | |
- name: Run tests | |
run: | | |
chmod +x $GITHUB_WORKSPACE/scripts/build-all-apps.sh | |
chmod +x $GITHUB_WORKSPACE/scripts/test.sh | |
$GITHUB_WORKSPACE/scripts/test.sh |