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

Setup the repo #1

Merged
merged 22 commits into from
Mar 7, 2024
Merged

Setup the repo #1

merged 22 commits into from
Mar 7, 2024

Conversation

sjspielman
Copy link
Member

This PR pretty much sets up the repo all around:

  • Add a bit more detail into the README. We can consider adding more once the image has been pushed.
  • Add the Dockerfile
    • Any feedback on the author metadata field? Is this the right email address? I didn't include a maintainer label either - should we?
    • I more or less followed spell-check.yaml and used the base rocker/tidyverse and installed spelling. But, I didn't specify the repo with , repos = c(CRAN = '$CRAN'))". Should I add this?
  • Add a GHA
    • I mostly followed the default setup but infused with our creds as specified here. I didn't include the docker metadata step found in that linked GHA since this is a much smaller potatoes image.
    • Let me know where the workflow can be tweaked!

Also note that I set up this repo with the MIT license. Any thoughts there?

Copy link
Member

@jashapiro jashapiro 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 part of what we need, but we should also include the spelling.R script from other repos here.

I would even put it in /usr/local/bin in the image and make it executable, so one does not need to call Rscript at all when running jobs in actions.

Something like the following added to the Dockerfile:

COPY spelling.R /usr/local/bin/spelling.R
RUN chmod +x /usr/local/bin/spelling.R

Dockerfile Outdated Show resolved Hide resolved
Dockerfile Outdated Show resolved Hide resolved
uses: docker/build-push-action@v5
with:
push: true
tags: user/app:latest
Copy link
Member

Choose a reason for hiding this comment

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

This is a string literal, so not what you want the tag to be.

I would use docker/metadata-action to automatically set this. It's worth it even for small potatoes.

Copy link
Member Author

Choose a reason for hiding this comment

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

I ported over both the tags and labels here after the metadata action, but wasn't entirely sure if we needed them both?

@sjspielman
Copy link
Member Author

Getting closer!

Also thinking of next steps, I'm not entirely sure how directories/OS will work between a dictionary file stored in the repo we're spell checking, and the spell check script itself. My sense is since we've placed the script as an executable in a directory that is presumably in $PATH, we maybe don't have to think about it at all and things will just...work?

Copy link
Member

@jashapiro jashapiro left a comment

Choose a reason for hiding this comment

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

Also thinking of next steps, I'm not entirely sure how directories/OS will work between a dictionary file stored in the repo we're spell checking, and the spell check script itself. My sense is since we've placed the script as an executable in a directory that is presumably in $PATH, we maybe don't have to think about it at all and things will just...work?

Yes, that was the idea!

But I was thinking about it, and had a few evening hacking minutes, so I made a branch where we actually make an action...

This made a few more changes to the Dockerfile, like adding an entrypoint (and then not bothering to put the script in /usr/local/bin, but just leaving it at the root).

The action isn't quite done, and we still would want to push the docker image with an action here it doesn't rebuild on every run, but the idea of the changes are in https://github.com/AlexsLemonade/spellcheck/tree/jashapiro/action

I also fixed a few bugs in the script, and made the dictionary the first argument, so that path can be more flexible (but with the same default).

I'm not filing it as a PR to this branch just yet, but I could if you like it.
Needs some more docs though.

spell-check.R Outdated
dictionary <- readLines(dict_file)

# Run spell check
spelling_errors <- spelling::spell_check_files(files, ignore = dictionary_plus) |>
Copy link
Member

Choose a reason for hiding this comment

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

you didn't define dictionary_plus?

Copy link
Member Author

Choose a reason for hiding this comment

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

copy/paste fail 😞

spell-check.R Show resolved Hide resolved
@sjspielman
Copy link
Member Author

I'm not filing it as a PR to this branch just yet, but I could if you like it.

I don't see a good reason not to really? Helps move things along, can't hurt!

@sjspielman
Copy link
Member Author

I love it, for now at least.

Screenshot 2024-03-07 at 3 40 39 PM

action.yaml Outdated Show resolved Hide resolved
Copy link
Member

@jashapiro jashapiro left a comment

Choose a reason for hiding this comment

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

Okay, so this needs to go in to trigger a build, but I had one more suggestion to have the Docker build always happen but push only when the action is actually the change to main.

.github/workflows/build-docker.yaml Show resolved Hide resolved
.github/workflows/build-docker.yaml Outdated Show resolved Hide resolved
Copy link
Member

@jashapiro jashapiro left a comment

Choose a reason for hiding this comment

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

LGTM, let's do it!

@sjspielman sjspielman merged commit 35b1ce4 into main Mar 7, 2024
2 checks passed
@sjspielman sjspielman deleted the sjspielman/setup-repo branch March 7, 2024 21:51

- name: Docker metadata
id: meta
uses: docker/metadata-action@v4
Copy link
Member

Choose a reason for hiding this comment

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

Update to latest version to quiet a warning

Suggested change
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5

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