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

tests: add tests and GHA workflow #1

Merged
merged 1 commit into from
Oct 27, 2023
Merged

tests: add tests and GHA workflow #1

merged 1 commit into from
Oct 27, 2023

Conversation

shepherdjerred
Copy link
Contributor

@shepherdjerred shepherdjerred commented Oct 24, 2023

Overview

  • Add tests for parser
  • Setup GHA for linting + building + testing
  • Setup dependabot
  • Resolve some linter errors
  • Move most of the code into internal

Related to https://github.com/rstudio/package-manager/issues/11950

@shepherdjerred shepherdjerred force-pushed the sj/tests branch 5 times, most recently from e9b5082 to 045717d Compare October 24, 2023 23:22
@shepherdjerred shepherdjerred force-pushed the sj/tests branch 5 times, most recently from 5df254d to e0ea641 Compare October 26, 2023 21:48
@shepherdjerred shepherdjerred marked this pull request as ready for review October 26, 2023 21:49
@shepherdjerred shepherdjerred force-pushed the sj/tests branch 5 times, most recently from 2843094 to 2bca7bd Compare October 26, 2023 22:08
@shepherdjerred
Copy link
Contributor Author

@jmwoliver I believe this is all ready!

Copy link
Collaborator

@jmwoliver jmwoliver left a comment

Choose a reason for hiding this comment

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

This looks great! I'd be nice to also test the GPG signing as well if we could. Having a signed .asc file would be in the gpg_signature field from the parser and you'd have to parse the file from the multipart request to make sure it is the same. Here's some rough code on how to do that:

// We may also have 1 and only 1 GPG signature file header
var hasGPG bool
if _, ok := mf.File["gpg_signature"]; ok {
	if len(mf.File["gpg_signature"]) > 1 {
		return errors.New("only one gpg_signature allowed")
	}
	hasGPG = len(mf.File["gpg_signature"]) == 1
}
// Get the file name and size for the GPG data
var fileGPG multipart.File
if hasGPG {
	fileHeaderGPG := mf.File["gpg_signature"][0]
	if fileHeaderGPG == nil || fileHeaderGPG.Filename == "" || fileHeaderGPG.Size == 0 {
		err = errors.New("error retrieving the file name and size from the upload")
		return err
	}
	fileGPG, err = fileHeaderGPG.Open()
	if err != nil {
		return err
	}
	defer fileGPG.Close()
}

You'll also need to cut a new release so that we can pull in these changes to use. That looks like:

git tag v0.3.0
git push origin v0.3.0

@shepherdjerred
Copy link
Contributor Author

I'll add gpg in another PR since this one is so big!

@shepherdjerred shepherdjerred merged commit b31087e into main Oct 27, 2023
3 checks passed
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