moto/.github/workflows/tests_servermode.yml

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

72 lines
2.4 KiB
YAML
Raw Normal View History

name: Unit tests in Server Mode
on: [workflow_call]
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
2024-01-06 19:20:57 +00:00
python-version: [3.8, 3.9, "3.10", "3.11", "3.12"]
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
run: |
pip install build
python -m build
2023-10-30 20:01:03 +00:00
docker run --rm -t --name motoserver -e TEST_SERVER_MODE=true -e MOTO_EC2_LOAD_DEFAULT_AMIS=false -e AWS_SECRET_ACCESS_KEY=server_secret -e AWS_ACCESS_KEY_ID=server_key -v `pwd`:/moto -p 5000:5000 -v /var/run/docker.sock:/var/run/docker.sock python:${{ matrix.python-version }}-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: Download Docker dependencies
# This happens automatically during test execution
# However, our tests can run concurrently
# Which means that our tests can pull this image concurrently
# Pulling it once is more efficient
run: |
docker pull mlupin/docker-lambda:python3.11
- name: Test ServerMode/Coverage
env:
TEST_SERVER_MODE: ${{ true }}
run: |
make test-only
- name: "Upload coverage to Codecov"
if: ${{ github.repository == 'getmoto/moto'}}
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: false
flags: servertests
- name: "Stop MotoServer"
if: always()
run: |
2024-03-16 14:03:41 +00:00
ls -la
docker stop motoserver
mkdir serverlogs
cp server_output.log serverlogs/server_output.log
2024-03-16 14:03:41 +00:00
- name: Archive Server logs
if: always()
uses: actions/upload-artifact@v4
with:
name: motoserver-${{ matrix.python-version }}
path: |
serverlogs/*