refactor stats #606
Workflow file for this run
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: Backend | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
paths: | |
- 'service/**' | |
- '.github/workflows/backend.yml' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
env: | |
DFX_VERSION: 0.14.3 | |
IC_REPL_VERSION: 0.4.1 | |
MOC_VERSION: 0.9.8 | |
steps: | |
- name: Setup Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
target: wasm32-unknown-unknown | |
- name: Cache cargo build | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
service/wasm-utils/target | |
key: cargo-${{ hashFiles('**/Cargo.lock') }} | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Install dfx | |
run: | | |
echo y | DFX_VERSION=$DFX_VERSION bash -ci "$(curl -fsSL https://sdk.dfinity.org/install.sh)" | |
wget https://github.com/chenyan2002/ic-repl/releases/download/$IC_REPL_VERSION/ic-repl-linux64 | |
cp ./ic-repl-linux64 /usr/local/bin/ic-repl | |
chmod a+x /usr/local/bin/ic-repl | |
npm i -g ic-mops | |
dfx cache install | |
cd $(dfx cache show) | |
wget https://github.com/dfinity/motoko/releases/download/$MOC_VERSION/motoko-Linux-x86_64-$MOC_VERSION.tar.gz | |
tar zxvf motoko-Linux-x86_64-$MOC_VERSION.tar.gz | |
- name: Start dfx | |
run: | | |
dfx start --background | |
- name: Checkout base branch | |
if: github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'breaking_changes') | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.base_ref }} | |
- name: Deploy main branch | |
if: github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'breaking_changes') | |
run: | | |
dfx deploy backend | |
- uses: actions/checkout@v3 | |
- name: Deploy current branch | |
run: dfx deploy backend | |
- name: CanisterPool test | |
run: | | |
(for f in service/pool/tests/*.test.sh; do | |
echo "==== Run test $f ====" | |
ic-repl "$f" || exit | |
done) | |
- name: Actor class test | |
run: | | |
cd ./service/pool/tests/actor_class | |
dfx canister create --all | |
dfx build | |
ic-repl ./test.sh | |
- name: Stop dfx | |
run: dfx stop |