steps:
- name: docker.io/library/python:3.7
  args: ['pip3', 'install', '-r', 'requirements.txt', '--user']
  id: Install dependencies
- name: docker.io/library/python:3.7
  args: ['pip3', 'install', '-r', 'requirements-dev.txt', '--user']
  id: Install dev dependencies
- name: gcr.io/cloud-builders/git
  entrypoint: bash
  id: Clone Emboss
  args: ['-c', 'git clone https://github.com/google/emboss.git']
- name: docker.io/library/python:3.7
  entrypoint: bash
  args: ['-c', 'python3 -m pylint --rcfile=test/pylintrc ./cyanobyte/*.py']
  id: Lint source code
  waitFor: ['Install dependencies']
- name: docker.io/library/python:3.7
  entrypoint: bash
  args: ['-c', 'python3 -m pylint --rcfile=test/pylintrc ./test/sampleData/raspberrypi/*.py']
  id: Lint autogenerated files
  waitFor: ['Install dependencies', 'Install dev dependencies']
- name: docker.io/library/python:3.7
  entrypoint: python
  args: ['-m', 'unittest', 'discover', 'test']
  id: Run unit tests
  waitFor: ['Lint source code', 'Lint autogenerated files', 'Install dev dependencies']
- name: docker.io/library/python:3.7
  entrypoint: python3
  args:
    - 'cyanobyte/codegen.py'
    - '-t'
    - 'raspberrypi'
    - '-t'
    - 'arduino'
    - '-t'
    - 'templates/kubos.c'
    - '-t'
    - 'cmsis'
    - '-t'
    - 'datasheet'
    - '-e'
    - '/workspace/emboss'
    - '-o'
    - './build'
    - 'peripherals/ADS1015.yaml'
    - 'peripherals/BH1750FVI.yaml'
    - 'peripherals/BMP180.yaml'
    - 'peripherals/BMP280.yaml'
    - 'peripherals/LSM303D.yaml'
    - 'peripherals/MCP4725.yaml'
    - 'peripherals/MCP9808.yaml'
    - 'peripherals/TCS3472.yaml'
    - 'peripherals/examplespi-emboss.yaml'
  id: Sample codegen
- name: wokwi/arduino-cli
  args: ['arduino-cli', 'compile', '-o', '/home/wokwi/ci.hex', '-b', 'arduino:avr:uno', 'test/sampleData/arduino']
  id: Arduino CI
  waitFor: ['Sample codegen']
  env:
    - 'HOME=/home/wokwi'
artifacts:
  objects:
    # Store generated files in a Cloud Storage bucket with the commit hash as directory
    location: 'gs://cyanobyte-235018-githubci/$SHORT_SHA'
    paths: ['build/com/cyanobyte/*']
