-
Notifications
You must be signed in to change notification settings - Fork 33
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
feat: Run tests in Docker #63
Conversation
sinopeus
commented
Jun 18, 2022
- Build Docker CI image
- Run tests in built Docker CI image
- Use GitHub Actions Docker cache to speed up future Docker builds
- Drive-by action upgrades :-)
- Build Docker CI image - Run tests in built Docker CI image - Use GitHub Actions Docker cache to speed up future Docker builds - Drive-by action upgrades :-)
Still need to fix private package repo support + other things that are a bit broken. But that will be for another time, just wanted to put this out there 🙂 |
OK, let me know when it's ready for review! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! I know it's not ready yet, but I already did a first review pass.
- name: Set up Python {% raw %}${{ matrix.python-version }}{% endraw %} | ||
uses: actions/setup-python@v3 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For my information: why is this action needed? I believe docker/build-push-action
already uses BuildKit, if that's the reason.
path: .venv/ | ||
key: {% raw %}venv-${{ runner.os }}-py${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }}{% endraw %} | ||
context: . | ||
target: dev |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we be building ci
here? The dev
image is much larger because it contains developer tools that in principle aren't necessary in CI.
strategy: | ||
|
||
matrix: | ||
python-version: ["{{ cookiecutter.python_version }}"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although I'm all for using Docker, we do have to be aware that this PR removes the ability to test in a matrix, which is a bit of a downgrade for Python packages (for Python applications that shouldn't matter too much).
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
tags: | | ||
ghcr.io/${{ github.repository }}/ci:${{ github.sha }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this SHA based on? Shouldn't we base it off of Dockerfile
, poetry.lock
, and pyproject.toml
as we do in GitLab CI/CD?
@@ -38,29 +38,27 @@ jobs: | |||
- name: Log in to the Docker registry | |||
uses: docker/login-action@v1 | |||
with: | |||
registry: {% raw %}${{ env.REGISTRY }}{% endraw %} | |||
username: {% raw %}${{ github.actor }}{% endraw %} | |||
password: {% raw %}${{ secrets.GITHUB_TOKEN }}{% endraw %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need the {% raw %}
bits here because otherwise Cookiecutter will treat these as values that should be interpolated.
This is actually similar to Tanguy's PR#8, in a simplified form. Let's see what we keep from both (once comments are handled). Part of the intention was to give Renaud a starting example for converting a GitLab CI/CD pipeline to GitHub Actions as well, which is why this isn't really complete 🙂 |
I suppose this PR is obsolete now that we've merged #65, or is there anything in this one we still want to retain? Apologies for the double effort! |