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

[WIP]CI: Added tests for windows #28

Open
wants to merge 26 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/run_tests_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ on:

jobs:
tests:
name: Run Tests for python${{ inputs.python-version }} on ${{ inputs.runs-on }}
name: Test for python${{ inputs.python-version }} on ${{ inputs.runs-on }}
runs-on: ${{ inputs.runs-on }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/run_tests_windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Run Tests
on:
workflow_call:
inputs:
python-version:
type: string
runs-on:
type: string
default: "windows-2019"


jobs:
tests:
name: Tests for python${{ inputs.python-version }} on ${{ inputs.runs-on }}
runs-on: ${{ inputs.runs-on }}
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
- name: Install dependencies
run: |
python -m pip install poetry --upgrade pip
poetry config virtualenvs.create false
poetry install
- name: Install
run: poetry install --with dev
- name: Run Pytest
run: |
docker context list
docker run hello-world
$env:DOCKER_HOST="npipe:////./pipe/docker_engine"
poetry run pytest tests/test_docker.py
#- name: Run Lint and Format
# run: |
# poetry run ruff check

27 changes: 19 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,24 @@ name: Run Tests
on: [pull_request, workflow_dispatch]

jobs:
test_python38:
test_windows_python312:
secrets: inherit
uses: ./.github/workflows/run_tests_linux.yml
uses: ./.github/workflows/run_tests_windows.yml
with:
python-version: "3.8"
test_python312:
secrets: inherit
uses: ./.github/workflows/run_tests_linux.yml
with:
python-version: "3.12"
python-version: "3.12"
#test_linux_python38:
# secrets: inherit
# uses: ./.github/workflows/run_tests_linux.yml
# with:
# python-version: "3.8"
#test_linux_python312:
# secrets: inherit
# uses: ./.github/workflows/run_tests_linux.yml
# with:
# python-version: "3.12"
#test_macos_python312:
# secrets: inherit
# uses: ./.github/workflows/run_tests_linux.yml
# with:
# python-version: "3.12"
# runs-on: "macos-latest"
14 changes: 14 additions & 0 deletions tests/test_docker.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from docker.models.containers import Container


def test_docker():
from poetry_plugin_lambda_build.docker import get_docker_client
client = get_docker_client()
image = "public.ecr.aws/sam/build-python3.12:latest-x86_64"
docker_container: Container = get_docker_client().containers.run(
"ubuntu", "echo hello world",
image, tty=True, detach=True
)
assert docker_container
docker_container.kill()
docker_container.remove(v=True)
Loading