version: 2
aliases:
  - &envinfo
    name: Run envinfo
    command: |
      npx envinfo

jobs:
  ubuntu-test:
    working_directory: ~/repo
    docker:
      - image: ubuntu
    steps:
      - checkout
      - run: apt update
      - run: bash deb/setup_16.x
      - run: apt install nodejs -y
      - run: *envinfo
  debian-test:
    working_directory: ~/repo
    docker:
      - image: debian
    steps:
      - checkout
      - run: apt update
      - run: bash deb/setup_16.x
      - run: apt install nodejs -y
      - run: *envinfo
  centos-test:
    working_directory: ~/repo
    docker:
      - image: centos
    steps:
      - checkout
      - run: bash rpm/setup_16.x
      - run: yum install nodejs -y
      - run: *envinfo
  fedora-test:
    working_directory: ~/repo
    docker:
      - image: fedora:34
    steps:
      - checkout
      - run: bash rpm/setup_16.x
      - run: dnf install nodejs -y
      - run: *envinfo

workflows:
  version: 2
  build_and_test:
    jobs:
      - ubuntu-test
      - debian-test
      - centos-test
      - fedora-test
