# GitHub Actions
# https://help.github.com/en/articles/configuring-a-workflow
name: Unit tests

on: push

jobs:
  spec:
    name: Unit test
    runs-on: ubuntu-20.04
    steps:
      - uses: actions/checkout@v3

      # install a specific version of Node using
      # https://github.com/actions/setup-node
      - name: Use Node.js v18
        uses: actions/setup-node@v3
        with:
          node-version: 18

      # just so we learn about available environment variables GitHub provides
      - name: Print env variables
        run: |
          npm i -g @bahmutov/print-env
          print-env GITHUB

      # Install dependencies
      - name: Dependencies
        run: |
          npm install
      
      # Run tests
      - name: Spec test
        run: |
          npm run test