Skip to content

Move CI from TravisCI to GitHub Actions #339

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

Merged

Conversation

johnttompkins
Copy link
Contributor

@johnttompkins johnttompkins commented Dec 17, 2020

Issue #, if available:

Description of changes: First two commits: Github actions CI for java. Should have parity with existing travis job.

Next commit: Adding a PyPI deployment actions. Any time a release w tag suffix "-plugin" is published, the CI job will publish said release to PyPI.

Final commit: Adds automation to release to our staging repository for releases w tag suffix "-lib". This should make it a lot easier to cut new releases, as all that is necessary is a version bump an a tag. Also adds a small configuration change to the pom.xml to support the automated deployment.

For both of these, I added the credentials for uploading, keys, passphrases, etc. As GitHub secrets, which are encrypted and stored on an organization level.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@johnttompkins johnttompkins marked this pull request as ready for review December 17, 2020 04:37
@johnttompkins johnttompkins force-pushed the github-actions branch 3 times, most recently from d23600f to bb6236d Compare December 17, 2020 20:40
@@ -431,6 +431,12 @@
<goals>
<goal>sign</goal>
</goals>
<configuration>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Had to add this to pick up the passphrase for the gpg key that is set in the setup java step

@PatMyron
Copy link
Contributor

PatMyron commented Dec 21, 2020

Can we remove .travis.yml in these PRs as well? Easier to review the diff for parity if that's part of the PR

@johnttompkins
Copy link
Contributor Author

Can we remove .travis.yml in these PRs as well? Easier to review the diff for parity if that's part of the PR

Should be removed now.

Comment on lines +11 to +13
env:
AWS_DEFAULT_REGION: us-east-1
AWS_REGION: us-east-1
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these environment variables used for anything btw?

Suggested change
env:
AWS_DEFAULT_REGION: us-east-1
AWS_REGION: us-east-1

Copy link
Contributor Author

@johnttompkins johnttompkins Dec 23, 2020

Choose a reason for hiding this comment

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

yeah if you dont have these set the unit tests fail 🤷🏻 something with initializing aws clients in unit tests. maybe at a later date we can look into why these are necessary are try to remove

AWS_REGION: us-east-1
strategy:
matrix:
python: [3.6, 3.7, 3.8]
Copy link
Contributor

@PatMyron PatMyron Dec 22, 2020

Choose a reason for hiding this comment

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

linking aws-cloudformation/cloudformation-cli-python-plugin#139 again just so we don't forget later
we should just sweep all these repos when we get Python 3.9 working:

Suggested change
python: [3.6, 3.7, 3.8]
python: [3.6, 3.7, 3.8, 3.9]

matrix:
python: [3.6, 3.7, 3.8]
java: [8, 11]
runs-on: ubuntu-latest
Copy link
Contributor

@PatMyron PatMyron Dec 22, 2020

Choose a reason for hiding this comment

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

might as well test on macos-latest and windows-latest here as well

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added. i think it might also be useful to test compatibility with published libraries and plugins i.e. since we are managing two different packages of software, we should test the library against the published plugin and vice versa to ensure backwards compatibility. These things get missed since we test the built library in a given PR with the built plugin in the given PR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

seeing some macos failures trying to build the java library. going to leave out the multiple OS testing for now since this was just supposed to be a migration and create a followup so we can do this in a more targeted way where we aren't just running 18 jobs for one pr. ideally we'd only need to test compatibility of the plugin with the given OS

Comment on lines +15 to +31
steps:
- uses: actions/checkout@v2
- name: Set up Java & publishing credentials
uses: actions/setup-java@v1
with:
java-version: 8
server-id: sonatype-nexus-staging # Value of the distributionManagement/repository/id field of the pom.xml
server-username: SONATYPE_USERNAME # env variable for username in deploy
server-password: SONATYPE_PASSWORD # env variable for token in deploy
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} # Value of the GPG private key to import
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
- name: Deploy to sonatype staging repo
run: mvn deploy -Ppublishing
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
Copy link
Contributor

Choose a reason for hiding this comment

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

confused what's going on with secrets/env variables here

looks similar to actions/setup-java README but don't understand why env variables are set in the step after they're used 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i think it's to limit the scope of when these secrets are on the build machine. the setup-java step simply creates a configuration file which points to environment variables then the deploy step sets these when the configuration file is actually used (during the mvn deploy command)

@johnttompkins johnttompkins merged commit 643b124 into aws-cloudformation:master Jan 4, 2021
@johnttompkins johnttompkins deleted the github-actions branch January 4, 2021 19:35
@PatMyron PatMyron changed the title GitHub Actions CI Move CI from TravisCI to GitHub Actions Jan 11, 2021
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.

3 participants