2023-03-03 14:12:16 +00:00
|
|
|
name: Unit test
|
|
|
|
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"]
|
2023-03-03 14:12:16 +00:00
|
|
|
|
|
|
|
steps:
|
2023-09-05 17:33:10 +00:00
|
|
|
- uses: actions/checkout@v4
|
2023-03-03 14:12:16 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
2023-12-11 23:47:25 +00:00
|
|
|
uses: actions/setup-python@v5
|
2023-03-03 14:12:16 +00:00
|
|
|
with:
|
|
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
- name: Get pip cache dir
|
|
|
|
id: pip-cache
|
|
|
|
run: |
|
|
|
|
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
|
|
|
|
- name: pip cache
|
2024-02-17 08:39:03 +00:00
|
|
|
uses: actions/cache@v4
|
2023-03-03 14:12:16 +00:00
|
|
|
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
|
|
|
|
pip install pytest-cov
|
|
|
|
pip install pytest-github-actions-annotate-failures
|
2023-08-31 06:47:49 +00:00
|
|
|
- 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
|
2023-03-03 14:12:16 +00:00
|
|
|
- name: Test with pytest
|
|
|
|
run: |
|
|
|
|
make test-only
|
|
|
|
- name: "Upload coverage to Codecov"
|
|
|
|
if: ${{ github.repository == 'getmoto/moto'}}
|
2024-02-06 09:12:11 +00:00
|
|
|
uses: codecov/codecov-action@v4
|
2023-03-03 14:12:16 +00:00
|
|
|
with:
|
|
|
|
fail_ci_if_error: false
|
|
|
|
flags: unittests
|