name: ci-build
on: [push, pull_request]

jobs:
  do-build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v4
        with:
          node-version: 20
      - uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
      - run: cargo check --package ulid-cli
      - run: cargo test
      - run: cargo test --all-features
      - run: cargo test --no-default-features --features=std
      - run: cargo test --no-default-features

      - name: Install wasm-pack
        run: cargo install wasm-pack

      - run: ~/.cargo/bin/wasm-pack test --node
        env:
          RUSTFLAGS: '--cfg getrandom_backend="wasm_js"'
