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'
  entrypoint: 'yarn'
  id: 'yarn'
  args: ['install']
  waitFor: ['yarn-common']

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

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

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

# Run tfjs tests.
- name: 'gcr.io/learnjs-174218/release'
  dir: 'tfjs'
  entrypoint: 'yarn'
  id: 'test'
  args: ['test-ci']
  waitFor: ['yarn', 'build-deps', 'lint']
  env: ['BROWSERSTACK_USERNAME=deeplearnjs1', 'NIGHTLY=$_NIGHTLY']
  secretEnv: ['BROWSERSTACK_KEY', 'FIREBASE_KEY']

secrets:
- kmsKeyName: projects/learnjs-174218/locations/global/keyRings/tfjs/cryptoKeys/enc
  secretEnv:
    BROWSERSTACK_KEY: CiQAkwyoIW0LcnxymzotLwaH4udVTQFBEN4AEA5CA+a3+yflL2ASPQAD8BdZnGARf78MhH5T9rQqyz9HNODwVjVIj64CTkFlUCGrP1B2HX9LXHWHLmtKutEGTeFFX9XhuBzNExA=
    FIREBASE_KEY: CiQAkwyoIXmET39jOD3ywloCIa6+WUpu3w49twpMmkMqy0vS+YsSUAAD8BdZQGOL8FKEBxr/1jl0G78OigwlNVHjD3usZobNtlOp8tV/9iacb8zPFqy0SwIO1gvz3HRr+VU7c7LS2qqaTCdacZF+dx3VJNewvdZu
timeout: 1800s
logsBucket: 'gs://tfjs-build-logs'
substitutions:
  _NIGHTLY: ''
options:
  logStreamingOption: 'STREAM_ON'
  machineType: 'N1_HIGHCPU_8'
  substitution_option: 'ALLOW_LOOSE'
