napi-rs/.github/workflows/memory-test.yml
2022-12-09 17:29:03 +08:00

71 lines
1.9 KiB
YAML

name: Memory Leak Detect
env:
DEBUG: 'napi:*'
on:
push:
branches:
- main
pull_request:
jobs:
build_and_test:
name: Memory leak detect job
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 18
check-latest: true
cache: 'yarn'
- name: Install stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable-x86_64-unknown-linux-gnu
profile: minimal
override: true
- name: Cache cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
.cargo-cache/registry/index/
.cargo-cache/registry/cache/
.cargo-cache/git/db/
target/
key: stable-memory-leak-detect-cargo-cache
- name: 'Install dependencies'
run: yarn install --immutable
- name: 'Build TypeScript'
run: yarn build
- name: 'Pull docker image'
run: docker pull node:lts-slim
- name: Build in docker
uses: addnab/docker-run-action@v3
with:
image: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian
options: '--user 0:0 -v ${{ github.workspace }}/.cargo-cache/git/db:/usr/local/cargo/git/db -v ${{ github.workspace }}/.cargo/registry/cache:/usr/local/cargo/registry/cache -v ${{ github.workspace }}/.cargo/registry/index:/usr/local/cargo/registry/index -v ${{ github.workspace }}:/build -w /build'
run: yarn build:memory
- name: Memory leak tests
run: yarn test:memory
env:
RUST_BACKTRACE: 1
- name: Clear the cargo caches
run: |
cargo install cargo-cache --no-default-features --features ci-autoclean
cargo-cache