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

Add GH workflow #54

Merged
merged 6 commits into from
Sep 18, 2020
Merged

Conversation

tschaffter
Copy link
Collaborator

Tasks to perform in this workflow:

  • lint
  • build
  • test
  • coverage
  • publish to npmjs

@tschaffter tschaffter marked this pull request as draft September 9, 2020 00:20
@tschaffter
Copy link
Collaborator Author

tschaffter commented Sep 9, 2020

This PR is ready for review. This PR aims to resolve #24 and #53.

The GitHub workflow ci.yml should be self explanatory. A high level description and motivations for the choices made are given below.

  • The workflow has 3 jobs: lint, test and publish. I'm actually going to comment lint until we decide to lint files in this repo.
  • The job test is executed when pushing to master and develop and when pushing to the base branch of a PR.
  • The job test includes a step to push the coverage report to Coveralls.
  • The job publish is only run when creating a GitHub release.
    • The name and version fields in the package.json are used to publish the release to npmjs
    • This job requires to set the GitHub secret NPM_TOKEN
    • The option --access public for npm publish makes the release public
  • This workflow replaces the travis workflow (.travis.yml has been removed)

Release process

From past discussions, it sounds like we agree to use Gitflow / Hubflow for this repo. Here is what the release protocol could be:

  1. Create a release branch from the branch develop, for example named release-<version>
  2. Update the version of this node package in package.json
  3. When ready, merge the release branch into master and develop
  4. Create a GitHub tag that points to the branch master
  5. Create a GitHub release from this tag. This triggers the publication of this package to npmjs.

@tschaffter tschaffter marked this pull request as ready for review September 9, 2020 04:46
@tschaffter
Copy link
Collaborator Author

@jaeddy The npmjs package below has been created automatically using the GH Action proposed in this PR.

https://www.npmjs.com/package/gh-openapi-docs-test

This package has been generated when I created this GH release

https://github.com/tschaffter/gh-openapi-docs/releases/tag/20200913-3

Here is the GH Action run that shows the logs

https://github.com/tschaffter/gh-openapi-docs/actions/runs/252577012

@jaeddy
Copy link
Member

jaeddy commented Sep 15, 2020

Thanks, @tschaffter! Is it straightforward to modify the workflow so that test runs on all branches and PRs? Seems like we'd want to have that as a universal check.

For the release process, it'd be nice to have steps (4) and (5) automated (triggered whenever a release branch is merged into master) as part of the workflow — maybe a tag_and_release job (or whatever other name makes sense). We can probably add that in a separate PR though.

@tschaffter
Copy link
Collaborator Author

@jaeddy The GH worflow now runs for commits pushed to all branches

on:
  push:
    branches:
      - '**'
  release:
    types:
      - created
  pull_request:

For the release process, it'd be nice to have steps (4) and (5) automated (triggered whenever a release branch is merged into master) as part of the workflow — maybe a tag_and_release job (or whatever other name makes sense). We can probably add that in a separate PR though.

If you agree, let's merge this PR to switch to GitHub workflow for CI/CD. I'll then open a second PR to address what you describe above.

@jaeddy
Copy link
Member

jaeddy commented Sep 18, 2020

Thanks, @tschaffter! Just to clarify, the workflow will (a) run tests on all branches; but (b) only publish when a release is created (i.e., not for every branch)?

@tschaffter
Copy link
Collaborator Author

Correct! The job publish is run only when this condition is met:

  publish:
    if: github.event_name == 'release' && github.event.action == 'created'

Copy link
Member

@jaeddy jaeddy left a comment

Choose a reason for hiding this comment

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

Looks good - thanks!

@jaeddy jaeddy merged commit b3a46f7 into ga4gh:develop Sep 18, 2020
@tschaffter tschaffter deleted the feature-53-add-gh-workflow branch September 18, 2020 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants