-
Notifications
You must be signed in to change notification settings - Fork 8
87 lines (70 loc) · 2.22 KB
/
rust.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
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