steps:
# Install common dependencies.
- name: 'gcr.io/learnjs-174218/release'
  id: 'yarn-common'
  entrypoint: 'yarn'
  args: ['install']

# Install packages.
- name: 'gcr.io/learnjs-174218/release'
  dir: 'tfjs-node'
  entrypoint: 'yarn'
  id: 'yarn'
  args: ['install']
  waitFor: ['yarn-common']

# Build add-on.
- name: 'gcr.io/learnjs-174218/release'
  dir: 'tfjs-node'
  entrypoint: 'yarn'
  id: 'build-addon'
  args: ['build-addon-from-source']
  waitFor: ['yarn']

# Build deps.
- name: 'gcr.io/learnjs-174218/release'
  dir: 'tfjs-node'
  entrypoint: 'yarn'
  id: 'build-deps'
  args: ['build-deps-ci']
  waitFor: ['yarn-common']

# Build.
- name: 'gcr.io/learnjs-174218/release'
  dir: 'tfjs-node'
  entrypoint: 'yarn'
  id: 'build'
  args: ['build-ci']
  waitFor: ['yarn', 'build-deps']

# Lint.
- name: 'gcr.io/learnjs-174218/release'
  dir: 'tfjs-node'
  entrypoint: 'yarn'
  id: 'lint'
  args: ['lint']
  waitFor: ['yarn', 'build-deps']

# Unit tests.
- name: 'gcr.io/learnjs-174218/release'
  dir: 'tfjs-node'
  entrypoint: 'yarn'
  id: 'test'
  args: ['test-ci']
  waitFor: ['yarn', 'build-addon', 'build-deps', 'lint']

# CPU / GPU package alignment.
- name: 'gcr.io/learnjs-174218/release'
  dir: 'tfjs-node'
  entrypoint: 'yarn'
  id: 'ensure-cpu-gpu-packages-align'
  args: ['ensure-cpu-gpu-packages-align']
  waitFor: ['yarn-common']

timeout: 1800s
logsBucket: 'gs://tfjs-build-logs'
options:
  logStreamingOption: 'STREAM_ON'
  machineType: 'N1_HIGHCPU_8'
  substitution_option: 'ALLOW_LOOSE'
