-
Notifications
You must be signed in to change notification settings - Fork 170
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 tests and CI #34
Merged
Add tests and CI #34
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
0a0b6f8
Add first version of tests
joao-p-marques 05ba0be
Expand tests
joao-p-marques 0dec9ac
Add GH CI
joao-p-marques ffdd442
Apply suggestions
joao-p-marques c2fc1ff
Apply autopretty template + fix prettier
joao-p-marques 7bd86a5
Fix isort
joao-p-marques 0206be6
Apply autoprettier
joao-p-marques b21d6d8
Fix VSCode settings
joao-p-marques 0b7c5d9
Make tests run in parallel
joao-p-marques 8d09134
Build docker image before testing
joao-p-marques 38f530a
Update workspace settings
joao-p-marques d2dad86
Try multi-platform builds and push to ghcr.io
joao-p-marques 856cb49
Push to docker hub as well from ci
joao-p-marques a7d91ef
Upgrade autopretty
joao-p-marques f3366b5
Update pyproject configurations
joao-p-marques 0c41d3a
Improve test configuration and execution
joao-p-marques 91c0652
Provide initial conftest
3cf4ee6
Improve tests
joao-p-marques 1f4bd85
Add python3 in image
joao-p-marques 764ece5
Remove POST rule from proxy
joao-p-marques d9d5b44
Build image before testing and push at the end
joao-p-marques 47f8f46
Fix python path
joao-p-marques dc0b60e
Remove build fixture from tests to see if image is built in CI
joao-p-marques b46fc70
Organize docker tests definition and document
joao-p-marques 15071f7
Restore fixture allowing usage for local testing
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Changes here will be overwritten by Copier; do NOT edit manually | ||
_commit: v0.1.0a5 | ||
_src_path: https://github.com/copier-org/autopretty.git | ||
ansible: false | ||
biggest_kbs: 0 | ||
github: true | ||
js: false | ||
protected_branches: | ||
- master | ||
python: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 4 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.py] | ||
# For isort | ||
profile = black | ||
|
||
[*.{code-snippets,code-workspace,json,yaml,yml}{,.jinja}] | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[flake8] | ||
ignore = E203, E501, W503, B950 | ||
max-line-length = 88 | ||
select = C,E,F,W,B |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: pre-commit | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
pre-commit: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v2 | ||
- uses: pre-commit/[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
name: test | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- master | ||
workflow_dispatch: | ||
inputs: | ||
pytest_addopts: | ||
description: | ||
Extra options for pytest; use -vv for full details; see | ||
https://docs.pytest.org/en/latest/example/simple.html#how-to-change-command-line-options-defaults | ||
required: false | ||
|
||
env: | ||
LANG: "en_US.utf-8" | ||
LC_ALL: "en_US.utf-8" | ||
PIP_CACHE_DIR: ${{ github.workspace }}/.cache.~/pip | ||
PIPX_HOME: ${{ github.workspace }}/.cache.~/pipx | ||
POETRY_CACHE_DIR: ${{ github.workspace }}/.cache.~/pypoetry | ||
POETRY_VIRTUALENVS_IN_PROJECT: "true" | ||
PYTEST_ADDOPTS: ${{ github.event.inputs.pytest_addopts }} | ||
PYTHONIOENCODING: "UTF-8" | ||
|
||
jobs: | ||
build-test-push: | ||
runs-on: ubuntu-latest | ||
env: | ||
DOCKER_REPO: tecnativa/docker-socket-proxy | ||
steps: | ||
# Prepare Docker environment and build | ||
- uses: actions/checkout@v2 | ||
- uses: docker/setup-qemu-action@v1 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
- name: Build image(s) | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
# HACK: Build single platform image for testing. See https://github.com/docker/buildx/issues/59 | ||
load: true | ||
push: false | ||
tags: | | ||
${{ env.DOCKER_REPO }}:local | ||
# Set up and run tests | ||
- name: Install python | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: "3.9" | ||
- name: Generate cache key CACHE | ||
run: | ||
echo "CACHE=${{ secrets.CACHE_DATE }} ${{ runner.os }} $(python -VV | | ||
sha256sum | cut -d' ' -f1) ${{ hashFiles('pyproject.toml') }} ${{ | ||
hashFiles('poetry.lock') }}" >> $GITHUB_ENV | ||
- uses: actions/cache@v2 | ||
with: | ||
path: | | ||
.cache.~ | ||
.venv | ||
~/.local/bin | ||
key: venv ${{ env.CACHE }} | ||
- run: pip install poetry | ||
- name: Patch $PATH | ||
run: echo "$HOME/.local/bin" >> $GITHUB_PATH | ||
- run: poetry install | ||
# Run tests | ||
- run: poetry run pytest | ||
joao-p-marques marked this conversation as resolved.
Show resolved
Hide resolved
|
||
env: | ||
DOCKER_IMAGE_NAME: ${{ env.DOCKER_REPO }}:local | ||
# Build and push | ||
- name: Login to DockerHub | ||
if: | ||
github.repository == 'Tecnativa/docker-socket-proxy' && github.ref == | ||
'refs/heads/master' | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_LOGIN }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- name: Login to GitHub Container Registry | ||
if: | ||
github.repository == 'Tecnativa/docker-socket-proxy' && github.ref == | ||
'refs/heads/master' | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ secrets.BOT_LOGIN }} | ||
password: ${{ secrets.BOT_TOKEN }} | ||
- name: Build and push | ||
if: | ||
github.repository == 'Tecnativa/docker-socket-proxy' && github.ref == | ||
'refs/heads/master' | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm/v8,linux/arm64,linux/ppc64le,linux/s390x | ||
load: false | ||
push: true | ||
tags: | | ||
ghcr.io/${{ env.DOCKER_REPO }} | ||
${{ env.DOCKER_REPO }} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Do you think this is the time to implement #33 (comment)?
I'm developing for TT25794 a new python lib that will help know that you're currently in the latest tag. I'll notify you when it's done.
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.
Yes, good suggestion. I agree that it makes sense now. I'll wait for your call then.