2021-01-26 12:37:03 +00:00
|
|
|
name: TestNDeploy
|
|
|
|
|
2021-01-28 15:19:30 +00:00
|
|
|
on: [push, pull_request]
|
2021-01-26 12:37:03 +00:00
|
|
|
|
2021-01-23 20:46:54 +00:00
|
|
|
jobs:
|
2021-01-26 12:37:03 +00:00
|
|
|
# Install and cache dependencies
|
|
|
|
cache:
|
|
|
|
name: Caching
|
2021-01-23 20:46:54 +00:00
|
|
|
runs-on: ubuntu-latest
|
2021-01-26 12:37:03 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
python-version: [ 2.7, 3.6, 3.7, 3.8 ]
|
|
|
|
|
2021-01-23 20:46:54 +00:00
|
|
|
steps:
|
2021-01-26 12:37:03 +00:00
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
|
|
uses: actions/setup-python@v2
|
|
|
|
with:
|
|
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
- name: Get pip cache dir
|
|
|
|
id: pip-cache-dir
|
|
|
|
run: |
|
|
|
|
echo "::set-output name=dir::$(pip cache dir)"
|
|
|
|
- name: pip cache
|
|
|
|
id: pip-cache
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: ${{ steps.pip-cache-dir.outputs.dir }}
|
2021-02-16 10:44:48 +00:00
|
|
|
key: pip-${{ matrix.python-version }}-${{ hashFiles('**/setup.py') }}
|
2021-01-26 12:37:03 +00:00
|
|
|
- name: Install Linux dependencies
|
|
|
|
if: ${{ matrix.python-version == 3.8 && steps.pip-cache.outputs.cache-hit != 'true' }}
|
|
|
|
run: |
|
|
|
|
sudo apt-get install libxslt-dev libxml2-dev -y
|
|
|
|
- name: Install project dependencies
|
|
|
|
if: ${{ steps.pip-cache.outputs.cache-hit != 'true' }}
|
|
|
|
run: |
|
|
|
|
python -m pip install --upgrade pip
|
|
|
|
pip install -r requirements-dev.txt
|
|
|
|
|
|
|
|
lint:
|
|
|
|
name: Linting
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: cache
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
python-version: [3.7]
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
|
|
uses: actions/setup-python@v2
|
|
|
|
with:
|
|
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
# Retrieve the previously cached dependencies
|
|
|
|
- name: Get pip cache dir
|
|
|
|
id: pip-cache
|
|
|
|
run: |
|
|
|
|
echo "::set-output name=dir::$(pip cache dir)"
|
|
|
|
- name: pip cache
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: ${{ steps.pip-cache.outputs.dir }}
|
2021-02-16 10:44:48 +00:00
|
|
|
key: pip-${{ matrix.python-version }}-${{ hashFiles('**/setup.py') }}
|
2021-01-26 12:37:03 +00:00
|
|
|
# Still need to properly install the dependencies - it will only skip the download part
|
|
|
|
- name: Install project dependencies
|
|
|
|
run: |
|
|
|
|
python -m pip install --upgrade pip
|
|
|
|
pip install -r requirements-dev.txt
|
|
|
|
- name: Lint with flake8
|
|
|
|
run:
|
|
|
|
make lint
|
|
|
|
|
|
|
|
test:
|
|
|
|
name: Unit test
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: lint
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
python-version: [2.7, 3.6, 3.7, 3.8]
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
|
|
uses: actions/setup-python@v2
|
|
|
|
with:
|
|
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
- name: Get pip cache dir
|
|
|
|
id: pip-cache
|
|
|
|
run: |
|
|
|
|
echo "::set-output name=dir::$(pip cache dir)"
|
|
|
|
- name: pip cache
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: ${{ steps.pip-cache.outputs.dir }}
|
2021-02-16 10:44:48 +00:00
|
|
|
key: pip-${{ matrix.python-version }}-${{ hashFiles('**/setup.py') }}
|
2021-01-26 12:37:03 +00:00
|
|
|
- name: Install Linux dependencies
|
|
|
|
if: ${{ matrix.python-version == 3.8 }}
|
|
|
|
run: |
|
|
|
|
sudo apt-get install libxslt-dev libxml2-dev -y
|
|
|
|
- name: Install project dependencies
|
|
|
|
run: |
|
|
|
|
python -m pip install --upgrade pip
|
|
|
|
pip install -r requirements-dev.txt
|
|
|
|
pip install pytest-cov
|
|
|
|
- name: Test with pytest
|
|
|
|
run: |
|
|
|
|
make test-coverage
|
|
|
|
- name: "Upload coverage to Codecov"
|
2021-02-16 17:03:41 +00:00
|
|
|
if: ${{ github.repository == 'spulec/moto'}}
|
2021-01-26 12:37:03 +00:00
|
|
|
uses: codecov/codecov-action@v1
|
|
|
|
with:
|
|
|
|
fail_ci_if_error: true
|
2021-02-02 18:01:00 +00:00
|
|
|
flags: unittests
|
2021-01-26 12:37:03 +00:00
|
|
|
|
|
|
|
testserver:
|
|
|
|
name: Unit tests in Server Mode
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: lint
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
python-version: [2.7, 3.6, 3.7, 3.8]
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
2021-02-12 12:59:45 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2021-01-26 12:37:03 +00:00
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
|
|
uses: actions/setup-python@v2
|
|
|
|
with:
|
|
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
- name: Start MotoServer
|
|
|
|
run: |
|
|
|
|
python setup.py sdist
|
|
|
|
docker run --rm -t --name motoserver -e TEST_SERVER_MODE=true -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:3.7-buster /moto/travis_moto_server.sh &
|
|
|
|
python wait_for.py
|
|
|
|
- name: Get pip cache dir
|
|
|
|
id: pip-cache
|
|
|
|
run: |
|
|
|
|
echo "::set-output name=dir::$(pip cache dir)"
|
|
|
|
- name: pip cache
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: ${{ steps.pip-cache.outputs.dir }}
|
2021-02-16 10:44:48 +00:00
|
|
|
key: pip-${{ matrix.python-version }}-${{ hashFiles('**/setup.py') }}
|
2021-01-26 12:37:03 +00:00
|
|
|
- name: Install Linux dependencies
|
|
|
|
if: ${{ matrix.python-version == 3.8 }}
|
|
|
|
run: |
|
|
|
|
sudo apt-get install libxslt-dev libxml2-dev -y
|
|
|
|
- name: Install project dependencies
|
|
|
|
run: |
|
|
|
|
python -m pip install --upgrade pip
|
|
|
|
pip install -r requirements-dev.txt
|
2021-02-02 18:01:00 +00:00
|
|
|
- name: Test ServerMode/Coverage
|
|
|
|
env:
|
|
|
|
TEST_SERVER_MODE: ${{ true }}
|
|
|
|
run: |
|
|
|
|
make test-coverage
|
|
|
|
- name: "Upload coverage to Codecov"
|
2021-02-16 17:03:41 +00:00
|
|
|
if: ${{ github.repository == 'spulec/moto'}}
|
2021-02-02 18:01:00 +00:00
|
|
|
uses: codecov/codecov-action@v1
|
|
|
|
with:
|
|
|
|
fail_ci_if_error: true
|
|
|
|
flags: servertests
|
2021-01-26 12:37:03 +00:00
|
|
|
|
|
|
|
deploy:
|
|
|
|
name: Deploy
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: [test, testserver]
|
2021-01-28 15:19:30 +00:00
|
|
|
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository == 'spulec/moto' }}
|
2021-01-26 12:37:03 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
python-version: [3.8]
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
2021-03-03 09:57:08 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
|
|
uses: actions/setup-python@v2
|
|
|
|
with:
|
|
|
|
python-version: ${{ matrix.python-version }}
|
2021-03-05 12:36:32 +00:00
|
|
|
- name: Update & Build
|
2021-01-26 12:37:03 +00:00
|
|
|
run: |
|
2021-03-05 12:36:32 +00:00
|
|
|
pip install wheel packaging
|
2021-01-26 12:37:03 +00:00
|
|
|
python update_version_from_git.py
|
|
|
|
python setup.py sdist bdist_wheel
|
|
|
|
- name: Publish to PyPI
|
|
|
|
uses: pypa/gh-action-pypi-publish@master
|
|
|
|
with:
|
|
|
|
password: ${{ secrets.PYPI_API_TOKEN }}
|
|
|
|
|