Skip to content

Commit

Permalink
chore(build): switch to github workflows for robot stack CI (#6632)
Browse files Browse the repository at this point in the history
Add github workflow definitions for all tasks related to robot stack
checks, tests, builds, and deploys that were not previously configured.

Specifically,
- The api-lint-test-build and shared-data-lint-test-build workflows now deploy to pypi when necessary (and were renamed)
- New workflow js-checks run javascript check actions on any javascript
change, since the checkers do not reasonably work on project subsets
- New workflow app-test-build-deploy runs js tests for the app and its
dependencies, cross-platform when necessary; it also builds the app,
with full signing support, and deploys it as travis does

In addition, appveyor has been fully removed and travis now only handles non-robot-stack workflows.
  • Loading branch information
sfoster1 authored Oct 2, 2020
1 parent 304ce8d commit b80706a
Show file tree
Hide file tree
Showing 15 changed files with 498 additions and 312 deletions.
40 changes: 40 additions & 0 deletions .github/actions/python/pypi-deploy/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: 'Deploy wheel to pypi'
description: 'Deploy a python wheel to pypi or test pypi, depending on configuration. The python environment for the subproject must be set up already, and the complex environment variables must be defined.'
inputs:
project:
description: 'Which project to run make deploy in'
required: true
repository_url:
description: 'The repository url to upload to. Creds will be determined based on this'
required: true
password:
description: 'The repository password'
runs:
using: 'composite'
steps:
- shell: bash
run: |
echo "::add-mask::${{ inputs.password }}"
if [[ ${{ inputs.repository_url }} =~ "test" ]]; then
echo '::set-env name=SWALLOW_FAILURE::|| echo "Duplicate upload allowed on test"'
echo "Uploading to test pypi"
else if [[ ${{ inputs.repository_url }} =~ "upload.pypi.org" ]]; then
echo "Uploading to prod pypi"
# this needs to be cleared otherwise the makefiles append a dev tag
echo ::set-env name=OT_BUILD::""
else
echo "::error ::Invalid repository url ${{ inputs.repository_url }}"
exit 1
fi
fi
- shell: bash
run: |
status=0
QUIET=1 BUILD_NUMBER=${OT_BUILD} make -C ${{ inputs.project }} clean deploy twine_repository_url=${{ inputs.repository_url }} pypi_username=opentrons pypi_password=${{ inputs.password }} || status=$?
if [[ ${status} != 0 ]] && [[ ${{ inputs.repository_url }} =~ "test.pypi.org" ]]; then
echo "upload failures allowed to test pypi"
exit 0
fi
exit ${status}
7 changes: 4 additions & 3 deletions .github/actions/webstack/deploy-to-sandbox/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ inputs:
distPath:
description: 'The path to the compiled distribution to upload'
required: true
destPrefix:
description: 'The path prefix to deploy to (usually the current branch)'
required: true
runs:
using: 'composite'
steps:
- shell: bash
run: |
SHORTSLUG=`echo ${{ github.ref }} | sed -e "s/^\/\?refs\/\(?:tags\|heads\)\///"`
echo "Found ref slug ${SHORTSLUG} from ref ${{ github.ref }}"
aws s3 sync ${{ inputs.distPath }} s3://sandbox.${{ inputs.domain }}/${SHORTSLUG} --acl=public-read
aws s3 sync ${{ inputs.distPath }} s3://sandbox.${{ inputs.domain }}/${{ inputs.destPrefix }} --acl=public-read
71 changes: 0 additions & 71 deletions .github/workflows/api-lint-test.yaml

This file was deleted.

118 changes: 118 additions & 0 deletions .github/workflows/api-test-lint-deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
# This workflow runs tests and lint on pull requests that touch the api/
# project or its CI configuration.

name: 'API test/lint/deploy'

on:
# Most of the time, we run on pull requests, which lets us handle external PRs
pull_request:
paths:
- 'api/**'
- 'Makefile'
- 'shared-data/*/**'
- '!shared-data/js/**'
push:
paths:
- 'api/**'
- 'Makefile'
- 'shared-data/*/**'
- '!shared-data/js/**'
- '.github/workflows/api-test-lint-deploy.yaml'
- '.github/actions/python/**/*'
- '.github/workflows/utils.js'
branches:
- '*'
tags:
- 'v*'
workflow_dispatch:


defaults:
run:
shell: bash

jobs:
lint:
name: 'opentrons package linting'
runs-on: 'ubuntu-latest'
steps:
- uses: 'actions/checkout@v2'
- uses: 'actions/setup-node@v1'
with:
node-version: '12'
- uses: 'actions/setup-python@v2'
with:
python-version: '3.7'

- uses: './.github/actions/python/setup'
with:
project: 'api'
- name: Lint
run: make -C api lint
test:
name: 'opentrons package tests'
needs: [lint]
strategy:
matrix:
os: ['windows-latest', 'ubuntu-latest', 'macos-latest']
runs-on: '${{ matrix.os }}'
steps:
- uses: 'actions/checkout@v2'
- uses: 'actions/setup-node@v1'
with:
node-version: '12'
- uses: 'actions/setup-python@v2'
with:
python-version: '3.7'
- name: 'set complex environment variables'
uses: actions/github-script@v3
with:
script: |
const { buildComplexEnvVars, } = require(`${process.env.GITHUB_WORKSPACE}/.github/workflows/utils.js`)
buildComplexEnvVars(core, context)
- uses: './.github/actions/python/setup'
with:
project: 'api'
- name: Test
run: make -C api test
- uses: 'codecov/codecov-action@v1'
with:
file: ./api/coverage.xml

deploy:
name: 'deploy opentrons package'
needs: [test]
runs-on: 'ubuntu-latest'
if: github.event_name == 'push'
steps:
- uses: 'actions/checkout@v2'
- uses: 'actions/setup-node@v1'
with:
node-version: '12'
- uses: 'actions/setup-python@v2'
with:
python-version: '3.7'
- name: 'set complex environment variables'
uses: actions/github-script@v3
with:
script: |
const { buildComplexEnvVars, } = require(`${process.env.GITHUB_WORKSPACE}/.github/workflows/utils.js`)
buildComplexEnvVars(core, context)
- uses: './.github/actions/python/setup'
with:
project: 'api'
# creds and repository configuration for deploying python wheels
- if: ${{ !env.OT_TAG }}
name: 'upload to test pypi'
uses: './.github/actions/python/pypi-deploy'
with:
project: 'api'
repository_url: 'https://test.pypi.org/legacy/'
password: '${{ secrets.OT_TEST_PYPI_PASSWORD }}'
- if: startsWith(env.OT_TAG, 'v')
name: 'upload to real pypi'
uses: './.github/actions/python/pypi-deploy'
with:
project: 'api'
repository_url: 'https://upload.pypi.org/legacy/'
password: '${{ secrets.OT_PYPI_PASSWORD }}'
Loading

0 comments on commit b80706a

Please sign in to comment.