From d86e058370854641f989d2a7cd49b104e26f4e3c Mon Sep 17 00:00:00 2001 From: Seth Foster Date: Wed, 6 Jan 2021 13:01:21 -0500 Subject: [PATCH] chore(components): build/deploy components on gh (#7183) And finally remove monorepo travis integration. --- .../components-test-build-deploy.yaml | 114 ++++++++++++++++++ .travis.yml | 69 ----------- 2 files changed, 114 insertions(+), 69 deletions(-) create mode 100644 .github/workflows/components-test-build-deploy.yaml delete mode 100644 .travis.yml diff --git a/.github/workflows/components-test-build-deploy.yaml b/.github/workflows/components-test-build-deploy.yaml new file mode 100644 index 00000000000..249af4c36aa --- /dev/null +++ b/.github/workflows/components-test-build-deploy.yaml @@ -0,0 +1,114 @@ +# Run tests, build components bundle, and deploy it to sandbox + +name: 'Components test, build, and deploy' + +on: + pull_request: + paths: + - 'components/**' + - 'webpack-config/**' + - 'package.json' + - '.github/workflows/components-test-build-deploy.yaml' + push: + paths: + - 'components/**' + - 'webpack-config/**' + - 'package.json' + - '.github/workflows/components-test-build-deploy.yaml' + branches: + - '*' + tags: + - 'components*' + +defaults: + run: + shell: bash + +env: + CI: true + +jobs: + js-unit-test: + name: 'components 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 components unit tests' + run: | + yarn jest --coverage=true --ci=true components/ + build-components: + name: 'build components 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 components' + run: | + make -C components + - name: 'upload github artifact' + uses: actions/upload-artifact@v2 + with: + name: 'components-artifact' + path: components/dist + deploy-components: + name: 'deploy components artifact to S3' + runs-on: 'ubuntu-latest' + needs: ["js-unit-test", "build-components"] + 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/github-script@v3.1 + with: + script: | + const { buildComplexEnvVars } = require(`${process.env.GITHUB_WORKSPACE}/.github/workflows/utils.js`) + buildComplexEnvVars(core, context) + - name: 'download components build' + uses: 'actions/download-artifact@v2' + with: + name: components-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 }} + run: | + aws s3 sync ./dist s3://opentrons-components/${{ env.OT_BRANCH}} --acl public-read diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 20560c02052..00000000000 --- a/.travis.yml +++ /dev/null @@ -1,69 +0,0 @@ -# opentrons platform travis config -cache: false - -addons: - chrome: stable - -stages: - - test - -# base configs -_deploy_s3: &deploy_s3 - provider: s3 - skip_cleanup: true - access_key_id: $AWS_ACCESS_KEY_ID - secret_access_key: $AWS_SECRET_ACCESS_KEY - region: us-east-2 - acl: public_read - on: - repo: Opentrons/opentrons - all_branches: true - -jobs: - include: - # test, build, and upload for JavaScript projects - - stage: test - name: 'JS unit tests; build Components Library' - # node version pulled from .nvmrc - language: node_js - install: - - make setup-js - script: - - make test-js - - make lint-js - - make circular-dependencies-js - - make lint-css - - make format - - make -C components - - make -C protocol-designer - - make -C labware-library - after_success: - - make coverage - deploy: - - - # upload components library artifacts to S3 - <<: *deploy_s3 - region: us-west-2 - local-dir: components/dist - bucket: opentrons-components - upload-dir: $TRAVIS_BRANCH - -env: - global: - # include $HOME/.local/bin for `aws` - - - OT_BUILD: $TRAVIS_BUILD_NUMBER - - OT_BRANCH: $TRAVIS_BRANCH - - OT_TAG: $TRAVIS_TAG - - OT_PD_COMMIT_HASH: $TRAVIS_COMMIT - - # TODO(mc, 2019-03-13): move to Travis settings - - OT_CI_TEMP_S3_PATH: s3://opentrons-ci/temp/$OT_BUILD - - # GITHUB_TOKEN - # TODO(mc, 2019-03-13): move to Travis settings - - secure: f/W7kN4gOvVpIanTQh9QtCwiXOk5UrRnUPo2ZU1Qk8zaFVbNj2za2A1xGKMqSyfZKw7guqIwTjWgc/aF9lxRtfU+5fkedJQdxDi5r7jZFxpqmpZOlhyXVY8WAWNqavEkefQInPlpHVAL8M2eV+Pi1cO9FsMhdyy/Wk7qA2nOiA8//9pFRB+0jgSbe1yqIF5DPyL0kbibd3EwmQvuQtnn25qqJXjneenhL6spflLCrnUjq1N/iOlcGd94eBUtk8RaBtMEjOb2D0Mb0DWKMsppoXg4/mZDus6s/PlmBwUJKNCuRtDiEUn5brE14q3OQh/FkDoXMRl69VND2mYp1LOeh5fgLSu6P+YToyHrh4lhXaRAul6l3JmXuoDC3k8hOAr8rPbtiwH7wGY2eRNv59vUejdXof4KHbAN6FTIH934tTe4uvBH79hRMoFY51pHRe6UiC39e/3hwl0pVKLjkV/40wfdEeYA7xhTZQVux+FAfk2krmggokxGEhbAQhWoyRX/wlH2XfEgassGskJ9SbuumNPNOLmEV9OOISFaXoYqVn+SPXy8mN1Pl2sLfaPFtnmmiY20t6yWsHsmfwi+41lv8n0vwCOGq521suDeNyiFhOH2AqG7xm6nHbIv+CiWt2ntKXgV233J17usvfr1zSK07PMDMlV2lvJx3CXj3hA4Yb4= - - # OT_PD_FULLSTORY_ORG - # TODO(mc, 2019-03-13): move to Travis settings - - secure: 'N/WWTWYdEPF7UfWIefSnOIKYVj9/q8ti7kCiB9DNfeKIsjJwsmg6S5yrwn6N4B/9ZMSp0yswo442n09CvH4jMG99BodXdYxg3JhuJ5dxWReAUTWO0PTiyihWeFhd2sbQ3VZa+o85OoFWFHO8UCXqcG//iUZ4l05t9DY5CGUBsPnyJTptsjPCb+CFUc+xkckv9RBfhLeyGBDWodJVfjU4xb124f5MBVF67OlHJ20HmbuH/kRNLDXSiRW4BD9UIXyWrIaPZHW612dX6inETz0vhUOJbUftgn8kdpjjBqa1394TjnjW5fey1n73KH4KpaDPZeGJ5GnYRpk9Wvw7uQkWH7xjkXbFq6cqd0vIWWS5uYmdsMsNDjUtTyELqG01rj813jbmcItuzK2tAcuQ5kBPwikLsHYeQY/68GKlws9POd444YQXXiTYgCoHgYq8O3nxaLoMZBgabFq6Rtz0xJb3Hu99PkU6flI4hgT82RZGf32PgYSKznaGps9DGf2as8FU+wui/So89eQwkDyhirzGvC31OlRHdZitjWYvI27nGgiPWheuZR5zAtf6tJeZaZ1N/PZGBwJW6ykfjG+vyRep/IIW5r0ujnBcmgxT7USVpW0E45QolZBS75t29kkTxP0/EHLMavv7QqP3LNpDJpptPrMQ8mLINxlB7FCQ2AQLbDY='