Skip to content

Merge branch 'edge' into abr-scale-googlesheet #8651

Merge branch 'edge' into abr-scale-googlesheet

Merge branch 'edge' into abr-scale-googlesheet #8651

# Run tests, build labware library, and deploy it to sandbox
name: 'Labware Library test, build, and deploy'
on:
pull_request:
paths:
- 'labware-library/**'
- 'shared-data/labware/**'
- 'components/**'
- 'package.json'
- '.github/workflows/ll-test-build-deploy.yaml'
- '.github/actions/webstack/deploy-to-sandbox/**'
- '.github/workflows/utils.js'
push:
paths:
- 'labware-library/**'
- 'shared-data/labware/**'
- 'components/**'
- 'package.json'
- '.github/workflows/ll-test-build-deploy.yaml'
branches:
- '**'
tags:
- 'labware-library*'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{ github.ref_name != 'edge' || github.run_id}}-${{ github.ref_type != 'tag' || github.run_id }}
cancel-in-progress: true
defaults:
run:
shell: bash
env:
CI: true
jobs:
js-unit-test:
name: 'labware library unit tests'
timeout-minutes: 20
runs-on: 'ubuntu-20.04'
steps:
- uses: 'actions/checkout@v3'
- uses: 'actions/setup-node@v3'
with:
node-version: '18.19.0'
# https://github.com/actions/checkout/issues/290
- name: 'Fix actions/checkout odd handling of tags'
if: startsWith(github.ref, 'refs/tags')
run: |
git fetch -f origin ${{ github.ref }}:${{ github.ref }}
git checkout ${{ github.ref }}
- name: 'install libudev for usb-detection'
run: sudo apt-get update && sudo apt-get install libudev-dev
- name: 'cache yarn cache'
uses: actions/cache@v3
with:
path: |
${{ github.workspace }}/.yarn-cache
${{ github.workspace }}/.npm-cache
key: js-${{ secrets.GH_CACHE_VERSION }}-${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
restore-keys: |
js-${{ secrets.GH_CACHE_VERSION }}-${{ runner.os }}-yarn-
- name: 'setup-js'
run: |
npm config set cache ./.npm-cache
yarn config set cache-folder ./.yarn-cache
make setup-js
- name: 'run labware library unit tests'
run: make -C labware-library test-cov
- name: 'Upload coverage report'
uses: codecov/codecov-action@v3
with:
files: ./coverage/lcov.info
flags: labware-library
e2e-test:
name: 'labware library e2e tests'
needs: ['js-unit-test']
timeout-minutes: 30
runs-on: 'ubuntu-20.04'
steps:
- uses: 'actions/checkout@v3'
# https://github.com/actions/checkout/issues/290
- name: 'Fix actions/checkout odd handling of tags'
if: startsWith(github.ref, 'refs/tags')
run: |
git fetch -f origin ${{ github.ref }}:${{ github.ref }}
git checkout ${{ github.ref }}
- uses: 'actions/setup-node@v3'
with:
node-version: '18.19.0'
- name: 'install libudev for usb-detection'
run: sudo apt-get update && sudo apt-get install libudev-dev
- name: 'cache yarn cache'
uses: actions/cache@v3
with:
path: |
${{ github.workspace }}/.yarn-cache
${{ github.workspace }}/.npm-cache
key: js-${{ secrets.GH_CACHE_VERSION }}-${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
restore-keys: |
js-${{ secrets.GH_CACHE_VERSION }}-${{ runner.os }}-yarn-
- name: 'setup-js'
run: |
npm config set cache ./.npm-cache
yarn config set cache-folder ./.yarn-cache
make setup-js
- name: 'test-e2e'
env:
OT_LL_MIXPANEL_ID: ${{ secrets.OT_LL_MIXPANEL_ID }}
OT_LL_MIXPANEL_DEV_ID: ${{ secrets.OT_LL_MIXPANEL_DEV_ID }}
run: make -C labware-library test-e2e
build-ll:
name: 'build labware library artifact'
needs: ['js-unit-test']
timeout-minutes: 30
runs-on: 'ubuntu-20.04'
if: github.event_name != 'pull_request'
steps:
- uses: 'actions/checkout@v3'
with:
fetch-depth: 0
# https://github.com/actions/checkout/issues/290
- name: 'Fix actions/checkout odd handling of tags'
if: startsWith(github.ref, 'refs/tags')
run: |
git fetch -f origin ${{ github.ref }}:${{ github.ref }}
git checkout ${{ github.ref }}
- uses: 'actions/setup-node@v3'
with:
node-version: '18.19.0'
- name: 'install libudev for usb-detection'
run: sudo apt-get update && sudo apt-get install libudev-dev
- name: 'cache yarn cache'
uses: actions/cache@v3
with:
path: |
${{ github.workspace }}/.yarn-cache
${{ github.workspace }}/.npm-cache
key: js-${{ secrets.GH_CACHE_VERSION }}-${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
restore-keys: |
js-${{ secrets.GH_CACHE_VERSION }}-${{ runner.os }}-yarn-
- name: 'setup-js'
run: |
npm config set cache ./.npm-cache
yarn config set cache-folder ./.yarn-cache
make setup-js
- name: 'build LL'
env:
OT_LL_MIXPANEL_ID: ${{ secrets.OT_LL_MIXPANEL_ID }}
OT_LL_MIXPANEL_DEV_ID: ${{ secrets.OT_LL_MIXPANEL_DEV_ID }}
run: |
make -C labware-library
- name: 'upload github artifact'
uses: actions/upload-artifact@v3
with:
name: 'll-artifact'
path: labware-library/dist
deploy-ll:
name: 'deploy LL artifact to S3'
runs-on: 'ubuntu-20.04'
needs: ['js-unit-test', 'e2e-test', 'build-ll']
if: github.event_name != 'pull_request'
steps:
- uses: 'actions/checkout@v3'
# https://github.com/actions/checkout/issues/290
- name: 'Fix actions/checkout odd handling of tags'
if: startsWith(github.ref, 'refs/tags')
run: |
git fetch -f origin ${{ github.ref }}:${{ github.ref }}
git checkout ${{ github.ref }}
- uses: 'actions/setup-node@v3'
with:
node-version: '18.19.0'
- name: 'install udev for usb-detection'
run: sudo apt-get update && sudo apt-get install libudev-dev
- name: 'set complex environment variables'
id: 'set-vars'
uses: actions/github-script@v6
with:
script: |
const { buildComplexEnvVars } = require(`${process.env.GITHUB_WORKSPACE}/.github/workflows/utils.js`)
buildComplexEnvVars(core, context)
- name: 'download LL build'
uses: 'actions/download-artifact@v3'
with:
name: ll-artifact
path: ./dist
- name: 'deploy builds to s3'
env:
AWS_ACCESS_KEY_ID: ${{ secrets.S3_SANDBOX_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_SANDBOX_SECRET }}
AWS_DEFAULT_REGION: us-east-2
uses: './.github/actions/webstack/deploy-to-sandbox'
with:
domain: 'labware.opentrons.com'
distPath: './dist'
destPrefix: ${{ env.OT_BRANCH }}