address remaining comments #340
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
name: DockerTests | |
on: [push, pull_request] | |
jobs: | |
cache: | |
name: Caching | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: [ "3.11" ] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Get pip cache dir | |
id: pip-cache-dir | |
run: | | |
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT | |
- name: pip cache | |
id: pip-cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.pip-cache-dir.outputs.dir }} | |
key: pip-${{ matrix.python-version }}-${{ hashFiles('**/setup.cfg') }} | |
- name: Update pip | |
if: ${{ steps.pip-cache.outputs.cache-hit != 'true' }} | |
run: | | |
python -m pip install --upgrade pip | |
- name: Install project dependencies | |
if: ${{ steps.pip-cache.outputs.cache-hit != 'true' }} | |
run: | | |
pip install -r requirements-dev.txt | |
test_custom_port: | |
name: Test Custom Port | |
runs-on: ubuntu-latest | |
needs: cache | |
strategy: | |
matrix: | |
python-version: ["3.11"] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Start MotoServer on an unusual port | |
run: | | |
pip install --upgrade build | |
python -m build | |
docker run --rm -t --name motoserver -e TEST_SERVER_MODE=true -e AWS_SECRET_ACCESS_KEY=server_secret -e MOTO_PORT=4555 -e AWS_ACCESS_KEY_ID=server_key -v `pwd`:/moto -p 4555:4555 -v /var/run/docker.sock:/var/run/docker.sock python:3.11-slim /moto/scripts/ci_moto_server.sh & | |
MOTO_PORT=4555 python scripts/ci_wait_for_server.py | |
- name: Get pip cache dir | |
id: pip-cache | |
run: | | |
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT | |
- name: pip cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.pip-cache.outputs.dir }} | |
key: pip-${{ matrix.python-version }}-${{ hashFiles('**/setup.cfg') }} | |
- name: Update pip | |
run: | | |
python -m pip install --upgrade pip | |
- name: Install project dependencies | |
run: | | |
pip install -r requirements-dev.txt | |
- name: Test | |
env: | |
TEST_SERVER_MODE: ${{ true }} | |
MOTO_PORT: 4555 | |
run: | | |
pytest -sv tests/test_awslambda/test_lambda_invoke.py::test_invoke_lambda_using_environment_port tests/test_cloudformation/test_cloudformation_custom_resources.py | |
- name: Collect Logs | |
if: always() | |
run: | | |
mkdir serverlogs1 | |
cp server_output.log serverlogs1/server_output.log | |
docker stop motoserver | |
- name: Archive Logs | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: custom_port | |
path: | | |
serverlogs1/* | |
test_custom_name: | |
name: Test Custom Network Name | |
runs-on: ubuntu-latest | |
needs: cache | |
strategy: | |
matrix: | |
python-version: ["3.11"] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Start MotoServer on a custom Docker network bridge | |
run: | | |
pip install --upgrade build | |
python -m build | |
docker network create -d bridge my-custom-network | |
docker run --rm -t -e TEST_SERVER_MODE=true -e MOTO_DOCKER_NETWORK_NAME=my-custom-network -e AWS_SECRET_ACCESS_KEY=server_secret -e AWS_ACCESS_KEY_ID=server_key -v `pwd`:/moto -p 5000:5000 --network my-custom-network -v /var/run/docker.sock:/var/run/docker.sock python:3.11-slim /moto/scripts/ci_moto_server.sh & | |
python scripts/ci_wait_for_server.py | |
- name: Get pip cache dir | |
id: pip-cache | |
run: | | |
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT | |
- name: pip cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.pip-cache.outputs.dir }} | |
key: pip-${{ matrix.python-version }}-${{ hashFiles('**/setup.cfg') }} | |
- name: Update pip | |
run: | | |
python -m pip install --upgrade pip | |
- name: Install project dependencies | |
run: | | |
pip install -r requirements-dev.txt | |
- name: Test | |
env: | |
TEST_SERVER_MODE: ${{ true }} | |
run: | | |
pytest -sv tests/test_awslambda/test_lambda_invoke.py::test_invoke_lambda_using_environment_port tests/test_cloudformation/test_cloudformation_custom_resources.py | |
- name: Collect Logs | |
if: always() | |
run: | | |
mkdir serverlogs2 | |
cp server_output.log serverlogs2/server_output.log | |
- name: Archive logs | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: custom_name | |
path: | | |
serverlogs2/* | |
test_custom_networkmode: | |
name: Pass NetworkMode to AWSLambda | |
runs-on: ubuntu-latest | |
needs: cache | |
strategy: | |
matrix: | |
python-version: ["3.11"] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Start MotoServer on an unusual port | |
run: | | |
pip install --upgrade build | |
python -m build | |
docker run --rm -t -e MOTO_DOCKER_NETWORK_MODE=host -e TEST_SERVER_MODE=true -e AWS_SECRET_ACCESS_KEY=server_secret -e MOTO_PORT=4555 -e AWS_ACCESS_KEY_ID=server_key -v `pwd`:/moto -p 4555:4555 -v /var/run/docker.sock:/var/run/docker.sock python:3.11-slim /moto/scripts/ci_moto_server.sh & | |
MOTO_PORT=4555 python scripts/ci_wait_for_server.py | |
- name: Get pip cache dir | |
id: pip-cache | |
run: | | |
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT | |
- name: pip cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.pip-cache.outputs.dir }} | |
key: pip-${{ matrix.python-version }}-${{ hashFiles('**/setup.cfg') }} | |
- name: Update pip | |
run: | | |
python -m pip install --upgrade pip | |
- name: Install project dependencies | |
run: | | |
pip install -r requirements-dev.txt | |
- name: Test | |
env: | |
TEST_SERVER_MODE: ${{ true }} | |
MOTO_PORT: 4555 | |
MOTO_DOCKER_NETWORK_MODE: host | |
run: | | |
pytest -sv tests/test_awslambda/test_lambda_invoke.py::test_invoke_lambda_using_networkmode tests/test_cloudformation/test_cloudformation_custom_resources.py | |
- name: Collect Logs | |
if: always() | |
run: | | |
mkdir serverlogs3 | |
cp server_output.log serverlogs3/server_output.log | |
- name: Archive Logs | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: custom_mode | |
path: | | |
serverlogs3/* |