version: 2
jobs:
  build:
    machine: true
    steps:
      - checkout
      - run:
          name: Build Environment
          command: docker build -t build_image .
      - run:
          name: Start Build Environment
          command: docker run --volume "$(pwd):$(pwd)" --workdir "$(pwd)" --tty --detach build_image bash > container_id
      - run:
          name: Build
          command: docker exec $(cat container_id) make
      - run:
          name: Test
          command: docker exec $(cat container_id) make check
      - run:
          command: docker stop $(cat container_id)
          when: always
      - store_artifacts:
          path: output.pdf
      - store_artifacts:
          path: pdfgen.h
      - store_artifacts:
          path: pdfgen.o

version: 2
jobs:
  build:
    machine: true
    steps:
      - checkout
      - run:
          name: Construct Build Environment
          command: docker build -t build_image .
      - run:
          name: Start Build Environment
          command: docker run --volume "$(pwd):$(pwd)" --workdir "$(pwd)" --tty --detach build_image bash > container_id
      - run:
          name: Build
          command: docker exec $(cat container_id) make
      - run:
          name: Test
          command: docker exec $(cat container_id) make check
      - run:
          name: Stop Build Environment
          command: docker stop $(cat container_id)
          when: always
      - store_artifacts:
          path: output.pdf
      - store_artifacts:
          path: pdfgen.h
      - store_artifacts:
          path: pdfgen.o

Fix up build step names
circleci: Fix up build step names
