Skip to content

Commit

Permalink
chore(labware-library): build, deploy lablib in gh actions (#7182)
Browse files Browse the repository at this point in the history
Moves builds and deploys of labware-library from TravisCI to Github Workflows
  • Loading branch information
sfoster1 authored Jan 6, 2021
1 parent 1c44453 commit c9300fc
Show file tree
Hide file tree
Showing 3 changed files with 150 additions and 7 deletions.
148 changes: 148 additions & 0 deletions .github/workflows/ll-test-build-deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
# 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/**'
- 'webpack-config/**'
- 'package.json'
- '.github/workflows/ll-test-build-deploy.yaml'
push:
paths:
- 'labware-library/**'
- 'shared-data/labware/**'
- 'components/**'
- 'webpack-config/**'
- 'package.json'
- '.github/workflows/ll-test-build-deploy.yaml'
branches:
- '*'
tags:
- 'labware-library*'

defaults:
run:
shell: bash

env:
CI: true

jobs:
js-unit-test:
name: 'labware library unit tests'
runs-on: 'ubuntu-latest'
steps:
- uses: 'actions/checkout@v2'
- uses: 'actions/setup-node@v1'
with:
node-version: '12'
- name: 'cache yarn cache'
uses: actions/cache@v2
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: |
yarn jest --coverage=true --ci=true labware-library/
e2e-test:
name: 'labware library e2e tests on ${{ matrix.os }}'
strategy:
matrix:
os: ['ubuntu-latest', 'macos-latest']
runs-on: '${{ matrix.os }}'
steps:
- uses: 'actions/checkout@v2'
- uses: 'actions/setup-node@v1'
with:
node-version: '12'
- name: 'cache yarn cache'
uses: actions/cache@v2
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'
run: make -C labware-library test-e2e
build-ll:
name: 'build labware library artifact'
runs-on: 'ubuntu-latest'
if: github.event_name != 'pull_request'
steps:
- uses: 'actions/checkout@v2'
- uses: 'actions/setup-node@v1'
with:
node-version: '12'
- name: 'cache yarn cache'
uses: actions/cache@v2
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'
run: |
make -C labware-library
- name: 'upload github artifact'
uses: actions/upload-artifact@v2
with:
name: 'll-artifact'
path: labware-library/dist
deploy-ll:
name: 'deploy LL artifact to S3'
runs-on: 'ubuntu-latest'
needs: ["js-unit-test", "e2e-test", "build-ll"]
if: github.event_name != 'pull_request'
steps:
- uses: 'actions/checkout@v2'
- uses: 'actions/setup-node@v1'
with:
node-version: '12'
- name: 'set complex environment variables'
id: 'set-vars'
uses: actions/[email protected]
with:
script: |
const { buildComplexEnvVars } = require(`${process.env.GITHUB_WORKSPACE}/.github/workflows/utils.js`)
buildComplexEnvVars(core, context)
- name: 'download LL build'
uses: 'actions/download-artifact@v2'
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 }}
uses: './.github/actions/webstack/deploy-to-sandbox'
with:
domain: 'labware.opentrons.com'
distPath: './dist'
destPrefix: ${{ env.OT_BRANCH }}
2 changes: 1 addition & 1 deletion .github/workflows/shared-data-test-lint-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
buildComplexEnvVars(core, context)
- name: Test
run: make -C shared-data/python test
deploy:
python-deploy:
name: 'shared-data package deploy'
needs: [python-test]
runs-on: 'ubuntu-latest'
Expand Down
7 changes: 1 addition & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
include:
# test, build, and upload for JavaScript projects
- stage: test
name: 'JS unit tests; build Protocol Designer, Labware Library, Components Library'
name: 'JS unit tests; build Components Library'
# node version pulled from .nvmrc
language: node_js
install:
Expand All @@ -40,11 +40,6 @@ jobs:
after_success:
- make coverage
deploy:
- # upload labware library artifacts to S3
<<: *deploy_s3
local-dir: labware-library/dist
bucket: $OT_LL_DEPLOY_BUCKET
upload-dir: $TRAVIS_BRANCH

- # upload components library artifacts to S3
<<: *deploy_s3
Expand Down

0 comments on commit c9300fc

Please sign in to comment.