|
1 | 1 | name: test
|
2 | 2 |
|
3 |
| -on: pull_request |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - master |
4 | 8 |
|
5 | 9 | jobs:
|
6 | 10 | linting:
|
@@ -42,45 +46,55 @@ jobs:
|
42 | 46 | include-prereleases: false
|
43 | 47 |
|
44 | 48 | test:
|
45 |
| - needs: [linting, get-python-versions] |
| 49 | + needs: [get-python-versions] |
46 | 50 | runs-on: ubuntu-latest
|
47 | 51 | strategy:
|
48 | 52 | fail-fast: false
|
49 | 53 | matrix:
|
50 | 54 | python-version: ${{ fromJson(needs.get-python-versions.outputs.python-matrix) }}
|
51 | 55 | django-version: [ "2.2", "3.0", "3.1", "3.2" ]
|
52 | 56 | steps:
|
53 |
| - - name: Check out repository |
54 |
| - uses: actions/checkout@v2 |
55 |
| - - name: Set up python ${{ matrix.python-version }} |
56 |
| - uses: actions/setup-python@v2 |
| 57 | + - uses: actions/checkout@v2 |
| 58 | + - uses: actions/setup-python@v2 |
| 59 | + with: |
| 60 | + python-version: "${{ matrix.python-version }}" |
| 61 | + - uses: actions/cache@v2 |
| 62 | + id: poetry-cache |
57 | 63 | with:
|
58 |
| - python-version: ${{ matrix.python-version }} |
| 64 | + path: ~/.local |
| 65 | + key: key-0 |
59 | 66 | - name: Install poetry
|
60 | 67 | uses: snok/install-poetry@v1
|
61 | 68 | with:
|
62 | 69 | version: 1.2.0a2
|
63 |
| - virtualenvs-in-project: true |
64 |
| - - name: Load cached venv |
65 |
| - uses: actions/cache@v2 |
| 70 | + virtualenvs-create: false |
| 71 | + - uses: actions/cache@v2 |
66 | 72 | id: cache-venv
|
67 | 73 | with:
|
68 | 74 | path: .venv
|
69 |
| - key: ${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}-4 |
70 |
| - - name: Install dependencies |
71 |
| - run: poetry install --no-interaction --no-root |
| 75 | + key: ${{ hashFiles('**/poetry.lock') }}-0 |
| 76 | + |
| 77 | + - run: | |
| 78 | + pip install virtualenv |
| 79 | + virtualenv .venv |
| 80 | + source .venv/bin/activate |
| 81 | + pip install pip setuptools wheel -U |
| 82 | + poetry install --no-interaction --no-root |
72 | 83 | if: steps.cache-venv.outputs.cache-hit != 'true'
|
73 |
| - - name: Install package |
74 |
| - run: poetry install --no-interaction |
75 |
| - - name: Install django ${{ matrix.django-version }} |
76 |
| - run: | |
| 84 | + - run: | |
77 | 85 | source .venv/bin/activate
|
78 |
| - poetry add "Django==${{ matrix.django-version }}" |
| 86 | + pip install "Django==${{ matrix.django-version }}" |
79 | 87 | - name: Install DRF 3.11 on Django 2.2
|
80 | 88 | if: matrix.django-version == '2.2'
|
81 |
| - run: poetry add "djangorestframework==3.11.1" |
| 89 | + run: pip install "djangorestframework==3.11.1" |
82 | 90 | - name: Run tests
|
83 | 91 | run: |
|
84 | 92 | source .venv/bin/activate
|
85 |
| - poetry run pytest --cov=openapi_tester --verbose --assert=plain |
| 93 | + poetry run pytest --cov=openapi_tester --verbose --assert=plain --cov-report=xml |
86 | 94 | poetry run coverage report
|
| 95 | + - uses: codecov/codecov-action@v2 |
| 96 | + with: |
| 97 | + file: ./coverage.xml |
| 98 | + fail_ci_if_error: true |
| 99 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 100 | + if: matrix.python-version == '3.10' |
0 commit comments