chore: use npx
to run ic-mops
#910
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 | |
env: | |
DFX_VERSION: 0.24.3 | |
IC_REPL_VERSION: 0.7.5 | |
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@v4 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
service/wasm-utils/target | |
key: cargo-${{ hashFiles('**/Cargo.lock') }} | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Install dfx | |
uses: dfinity/setup-dfx@main | |
with: | |
dfx-version: ${{ env.DFX_VERSION }} | |
- name: Install dfx dependencies | |
run: | | |
wget https://github.com/chenyan2002/ic-repl/releases/download/$IC_REPL_VERSION/ic-repl-linux64 | |
chmod a+x ./ic-repl-linux64 | |
ln ./ic-repl-linux64 /usr/local/bin/ic-repl | |
dfx cache install | |
cd $(dfx cache show) | |
- 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@v4 | |
# 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: | | |
# (npm install) | |
# dfx deploy backend | |
- uses: actions/checkout@v4 | |
- name: Deploy current branch | |
run: | | |
ls -l ${HOME}/.*rc | |
cat ${HOME}/.*rc | |
rm -f ${HOME}/.bashrc | |
touch ./GH_JUNK | |
env GITHUB_ENV=$(pwd)/GH_JUNK npm install | |
echo before dfx deploy backend | |
cat ./GH_JUNK | |
env GITHUB_ENV=$(pwd)/GH_JUNK dfx deploy backend | |
echo after dfx deploy backend | |
cat ./GH_JUNK | |
- name: CanisterPool test | |
run: | | |
(for f in service/pool/tests/*.test.sh; do | |
echo "==== Run test $f ====" | |
ic-repl -v "$f" || exit | |
done) | |
- name: Actor class test | |
run: | | |
cd ./service/pool/tests/actor_class | |
dfx canister create --all | |
dfx build | |
echo "==== Run Actor Class test (32) ====" | |
ic-repl -v test32.sh | |
echo "==== Run Actor Class test (64) ====" | |
ic-repl -v test64.sh | |
- name: Stop dfx | |
run: dfx stop |