Skip to content

feat(cli): add mops deployed post-deploy hook + init bootstrap (#… #1544

feat(cli): add mops deployed post-deploy hook + init bootstrap (#…

feat(cli): add mops deployed post-deploy hook + init bootstrap (#… #1544

Workflow file for this run

name: CI
on:
push:
branches:
- main
- master
pull_request:
permissions:
contents: read
jobs:
build:
strategy:
matrix:
moc-version: [0.14.13]
node-version: [22]
include:
- mops-version: ic-mops@1.0.0
test-global: false
- mops-version: ./cli/dist
test-global: false
- mops-version: ./cli/dist
test-global: true
runs-on: ubuntu-latest
name: node ${{ matrix.node-version }}, moc ${{ matrix.moc-version }}, ${{ matrix.mops-version }}
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
- uses: dfinity/setup-dfx@e50c04f104ee4285ec010f10609483cf41e4d365 # main
- uses: ./.github/actions/cache-rust-wasm
- name: Cache mops packages
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
key: mops-packages-${{ runner.os }}-${{ hashFiles('mops.toml') }}
restore-keys: |
mops-packages-${{ runner.os }}-${{ hashFiles('mops.toml') }}
mops-packages-${{ runner.os }}
path: |
~/.cache/mops
~/Library/Caches/mops
- name: Install npm packages
run: |
npm ci --ignore-scripts
npm run ci:postinstall
- name: Install mops
run: npm i -g ${{ matrix.mops-version }}
- name: Install mops packages
run: mops install
- name: Select moc version
run: mops toolchain use moc ${{ matrix.moc-version }}
- name: Run replica
run: npm run replica
- name: Deploy backend
run: npm run deploy-local
- name: Build frontend
run: npm run build-frontend
- name: Build docs
run: npm run build-docs
- name: Build blog
run: npm run build-blog
- name: Build CLI releases
run: npm run build-cli-releases
# Jest runs test suites in parallel. Toolchain binaries and package
# dependencies used by test fixtures must be pre-installed here so
# parallel workers don't race on the same downloads.
# When adding a new fixture with [toolchain] or [dependencies],
# add the corresponding download/install command below.
- name: Pre-cache moc 1.3.0 and test fixture dependencies
run: |
mops toolchain use moc 1.3.0 && mops toolchain use moc ${{ matrix.moc-version }}
(cd cli/tests/check/fix && mops install)
(cd cli/tests/build/success && mops install)
(cd cli/tests/build/error && mops install)
- name: Run CLI tests
if: ${{ !matrix.test-global }}
run: cd cli && npm test
- name: Run CLI tests (global)
if: ${{ matrix.test-global }}
env:
MOPS_TEST_GLOBAL: 1
run: cd cli && npm test
bundle-smoke-test:
runs-on: ubuntu-latest
name: bundle build smoke test
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 22
cache: "npm"
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
- uses: ./.github/actions/cache-rust-wasm
- name: Install npm packages
run: |
npm ci --ignore-scripts
npm run ci:postinstall
- name: Build and install bundle
run: |
cd cli && npm run bundle
npm i -g ./bundle
- name: Test mops build with bundle
run: |
cd cli/tests/build/no-dfx
mops install
mops build
ci-ok:
if: always()
needs: [build, bundle-smoke-test]
runs-on: ubuntu-latest
steps:
- if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
run: exit 1