Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(build): switch to github workflows for robot stack CI #6632

Merged
merged 21 commits into from
Oct 2, 2020

Conversation

sfoster1
Copy link
Member

@sfoster1 sfoster1 commented Sep 24, 2020

This PR switches robot stack check, test, build, and deploy workflows to Github Actions, implementing the CI tasks that were not previously covered in other PRs. This includes

  • Code for getting human-friendly ref slugs (e.g. chore_robot-stack-gh-workflows instead of refs/heads/chore_robot-stack-gh-workflows) is moved to an action
    • it uses js instead of sed, because, well, come on now
  • New workflow for testing, building, and deploying the runapp, cross-platform where necessary
    • This workflow is triggered by changes to what I understand of the runapp's dependencies; please verify
    • Signing and notarization is implemented
    • The new build workflows don't put the api wheel in the app build anymore because it is not used at all
  • Workflow for api and shared-data linting and testing now deploys as well to the appropriate pypi repository
    • This is implemented with a new action mostly because the makefile invocation was really long, and accepting upload failures on test pypi only was a pain
  • 📣 Appveyor CI configuration completely removed 📣
  • 📣 robot stack travis configuration for python lint/test and app build/deploy removed 📣

Please look it over and poke holes in it.

This DO NOT MERGE tag is here to remind us that we SHOULD NOT MERGE THIS until we switch the app deploy S3 prefix back to the standard one.

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 and shared-data-lint-test workflows now deploy to pypi when necessary
- 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 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
- New actions for deploying to pypi and setting up environment variables
and appveyor

That means removing appveyor entirely :O
@sfoster1 sfoster1 added the chore label Sep 24, 2020
@sfoster1 sfoster1 requested review from a team and mcous and removed request for a team September 24, 2020 17:49
@codecov
Copy link

codecov bot commented Sep 24, 2020

Codecov Report

❗ No coverage uploaded for pull request base (edge@6d3bcf8). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             edge    #6632   +/-   ##
=======================================
  Coverage        ?   73.78%           
=======================================
  Files           ?       10           
  Lines           ?      759           
  Branches        ?        0           
=======================================
  Hits            ?      560           
  Misses          ?      199           
  Partials        ?        0           
Impacted Files Coverage Δ
update-server/otupdate/buildroot/update.py 83.33% <0.00%> (ø)
update-server/otupdate/buildroot/config.py 92.50% <0.00%> (ø)
update-server/otupdate/buildroot/__main__.py 0.00% <0.00%> (ø)
...te-server/otupdate/buildroot/ssh_key_management.py 78.40% <0.00%> (ø)
update-server/otupdate/buildroot/constants.py 100.00% <0.00%> (ø)
...pdate-server/otupdate/buildroot/name_management.py 29.50% <0.00%> (ø)
update-server/otupdate/buildroot/update_session.py 95.06% <0.00%> (ø)
update-server/otupdate/buildroot/control.py 91.30% <0.00%> (ø)
update-server/otupdate/buildroot/file_actions.py 91.66% <0.00%> (ø)
update-server/otupdate/buildroot/__init__.py 85.29% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6d3bcf8...2a915f5. Read the comment docs.

@sfoster1 sfoster1 requested a review from a team as a code owner September 24, 2020 18:52
@sfoster1 sfoster1 added DO NOT MERGE Indicates a PR should not be merged, even if there's a shiny green merge button available ready for review labels Sep 24, 2020
This lets us avoid checking in a smooshed-together (Technical term)
output and instead take advantage of the github core packages installed
by default on the runner.
Comment on lines 58 to 72
- name: 'set complex environment variables and get yarn cache'
id: 'set-vars-get-cache'
uses: actions/github-script@v2
with:
script: |
const { buildComplexEnvVars, findYarnCacheDir } = require(`${process.env.GITHUB_WORKSPACE}/.github/workflows/utils.js`)
buildComplexEnvVars(core, context)
findYarnCacheDir(core, context)
- name: 'cache yarn cache'
uses: actions/cache@v2
with:
path: ${{ steps.set-vars-get-cache.outputs.yarnCacheDir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
Copy link
Member

@shlokamin shlokamin Sep 28, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity, instead of grabbing the global yarn cache from your util, why not just have a step that sets the cache directory like here?

Also, I don't see where behavior changes when there's a cache hit, you're still going to do a yarn from inside of setup-js even if there's a cache hit right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah but that should prevent yarn from redownloading everything shouldn't it?

In terms of why put it in a file, it accomplishes essentially the same thing and the file really had to be there for the custom env vars so I built it in anyway

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah but that should prevent yarn from redownloading everything shouldn't it?

Ah yeah that makes sense. Is it working as expected now? Speaking of which, how are you validating that this works? I assume just looking through the action logs and making sure yarn doesn't redownload everything?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sfoster1 sfoster1 removed the DO NOT MERGE Indicates a PR should not be merged, even if there's a shiny green merge button available label Oct 1, 2020
@shlokamin
Copy link
Member

It looks like these lines are being copied and pasted a few times (I'm going to be using them too in my e2e PR). Maybe it's worth having this be its own task or something?

- name: 'set complex environment variables and get yarn cache'
        id: 'set-vars-get-cache'
        uses: actions/github-script@v3
        with:
          script: |
            const { buildComplexEnvVars, findYarnCacheDir } = require(`${process.env.GITHUB_WORKSPACE}/.github/workflows/utils.js`)
            buildComplexEnvVars(core, context)
            findYarnCacheDir(core, context)
      - name: 'cache yarn cache'
        uses: actions/cache@v2
        with:
          path: ${{ steps.set-vars-get-cache.outputs.yarnCacheDir }}
          key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
          restore-keys: |
            ${{ runner.os }}-yarn-

Copy link
Contributor

@mcous mcous left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking really cool, and thanks for waiting for me to get this review in. I've got some questions in comments, as well as one extra one:

  • Should .github/workflows/api-lint-test.yaml be renamed to reflect that it is also deploying?

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prior to switching PD, we will need to confirm that this is successfully uploading dotfiles in distPath to S3, which is behavior PD relies on

.github/workflows/api-lint-test.yaml Outdated Show resolved Hide resolved
.github/workflows/api-lint-test.yaml Outdated Show resolved Hide resolved
.github/workflows/app-test-build.yaml Outdated Show resolved Hide resolved
.github/workflows/app-test-build.yaml Outdated Show resolved Hide resolved
.github/workflows/app-test-build.yaml Outdated Show resolved Hide resolved
.github/workflows/app-test-build.yaml Outdated Show resolved Hide resolved
.github/workflows/shared-data-lint-test.yaml Outdated Show resolved Hide resolved
.github/workflows/utils.js Outdated Show resolved Hide resolved
.github/workflows/app-test-build.yaml Outdated Show resolved Hide resolved
Copy link
Contributor

@mcous mcous left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sfoster1 sfoster1 merged commit b80706a into edge Oct 2, 2020
@sfoster1 sfoster1 deleted the chore_robot-stack-gh-workflows branch October 2, 2020 21:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants