|
1 | 1 | name: Test
|
2 | 2 |
|
3 | 3 | on:
|
4 |
| - push: |
5 |
| - branches: |
6 |
| - - master |
7 |
| - - develop |
8 |
| - pull_request: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + - develop |
| 8 | + pull_request: |
9 | 9 |
|
10 | 10 | jobs:
|
11 |
| - pkg_meta: |
12 |
| - runs-on: ubuntu-latest |
13 |
| - steps: |
14 |
| - - uses: actions/checkout@v2 |
15 |
| - - uses: actions/setup-python@v2 |
16 |
| - |
17 |
| - - name: Install dependencies |
18 |
| - run: | |
19 |
| - python -m pip install --upgrade pip tox |
20 |
| - - name: Lint with flake8 |
21 |
| - run: | |
22 |
| - tox -e pkg_meta |
23 |
| - lint: |
24 |
| - runs-on: ubuntu-latest |
25 |
| - steps: |
26 |
| - - uses: actions/checkout@v2 |
27 |
| - - uses: actions/setup-python@v2 |
28 |
| - |
29 |
| - - name: Install dependencies |
30 |
| - run: | |
31 |
| - python -m pip install --upgrade pip tox |
32 |
| - - name: Lint with flake8 |
33 |
| - run: | |
34 |
| - tox -e lint |
35 |
| -
|
36 |
| - test: |
37 |
| - runs-on: ubuntu-latest |
38 |
| - strategy: |
39 |
| - fail-fast: false |
40 |
| - matrix: |
41 |
| - python-version: [ "3.11", "3.12"] |
42 |
| - django-version: [ "3.2", "4.2", "5.1"] |
43 |
| - db-engine: ["pg", "mysql"] |
| 11 | + changes: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + timeout-minutes: 1 |
| 14 | + defaults: |
| 15 | + run: |
| 16 | + shell: bash |
| 17 | + outputs: |
| 18 | + run_tests: ${{ steps.changes.outputs.run_tests }} |
| 19 | + steps: |
| 20 | + - name: Checkout code |
| 21 | + uses: actions/checkout@v4 |
| 22 | + - id: changes |
| 23 | + name: Check for file changes |
| 24 | + uses: dorny/paths-filter@0bc4621a3135347011ad047f9ecf449bf72ce2bd # v3.0.0 |
| 25 | + with: |
| 26 | + base: ${{ github.ref }} |
| 27 | + token: ${{ github.token }} |
| 28 | + filters: .github/file-filters.yml |
| 29 | + |
| 30 | + pkg_meta: |
| 31 | + needs: [ changes ] |
| 32 | + if: needs.changes.outputs.run_tests == 'true' |
| 33 | + |
| 34 | + runs-on: ubuntu-latest |
| 35 | + steps: |
| 36 | + - uses: actions/checkout@v4 |
| 37 | + - uses: actions/setup-python@v2 |
| 38 | + |
| 39 | + - name: Install dependencies |
| 40 | + run: | |
| 41 | + python -m pip install --upgrade pip tox |
| 42 | + - name: Lint with flake8 |
| 43 | + run: | |
| 44 | + tox -e pkg_meta |
| 45 | + lint: |
| 46 | + needs: [ changes ] |
| 47 | + if: needs.changes.outputs.run_tests == 'true' |
| 48 | + |
| 49 | + runs-on: ubuntu-latest |
| 50 | + steps: |
| 51 | + - uses: actions/checkout@v4 |
| 52 | + - uses: actions/setup-python@v2 |
| 53 | + |
| 54 | + - name: Install dependencies |
| 55 | + run: | |
| 56 | + python -m pip install --upgrade pip tox |
| 57 | + - name: Lint with flake8 |
| 58 | + run: | |
| 59 | + tox -e lint |
| 60 | +
|
| 61 | + test: |
| 62 | + needs: [ changes ] |
| 63 | + if: needs.changes.outputs.run_tests == 'true' |
| 64 | + |
| 65 | + runs-on: ubuntu-latest |
| 66 | + strategy: |
| 67 | + fail-fast: false |
| 68 | + matrix: |
| 69 | + python-version: [ "3.11", "3.12" ] |
| 70 | + django-version: [ "3.2", "4.2", "5.1" ] |
| 71 | + db-engine: [ "pg", "mysql" ] |
| 72 | + env: |
| 73 | + PY_VER: ${{ matrix.python-version}} |
| 74 | + DJ_VER: ${{ matrix.django-version}} |
| 75 | + DBENGINE: ${{ matrix.db-engine}} |
| 76 | + MYSQL_USER: 'root' |
| 77 | + MYSQL_PASSWORD: 'root' |
| 78 | + |
| 79 | + services: |
| 80 | + postgres: |
| 81 | + image: postgres |
44 | 82 | env:
|
45 |
| - PY_VER: ${{ matrix.python-version}} |
46 |
| - DJ_VER: ${{ matrix.django-version}} |
47 |
| - DBENGINE: ${{ matrix.db-engine}} |
48 |
| - MYSQL_USER: 'root' |
49 |
| - MYSQL_PASSWORD: 'root' |
50 |
| - |
51 |
| - services: |
52 |
| - postgres: |
53 |
| - image: postgres |
54 |
| - env: |
55 |
| - POSTGRES_USER: postgres |
56 |
| - POSTGRES_PASSWORD: postgres |
57 |
| - POSTGRES_DB: concurrency |
58 |
| - ports: |
59 |
| - - 5432:5432 |
60 |
| - options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 |
61 |
| - |
62 |
| - mysql: |
63 |
| - image: mysql:5.7 |
64 |
| - env: |
65 |
| - MYSQL_DATABASE: test_db |
66 |
| - MYSQL_USER: user |
67 |
| - MYSQL_PASSWORD: password |
68 |
| - MYSQL_ROOT_PASSWORD: rootpassword |
69 |
| - ports: |
70 |
| - - 33306:3306 |
71 |
| - options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5 |
72 |
| - |
73 |
| - steps: |
74 |
| - - uses: actions/checkout@v2 |
75 |
| - |
76 |
| - - name: Setup MySQL |
77 |
| - run: | |
78 |
| - sudo /etc/init.d/mysql start |
79 |
| - mysql -e 'CREATE DATABASE concurrency;' -uroot -proot |
80 |
| - mysql -e 'SHOW DATABASES;' -uroot -proot |
81 |
| -
|
82 |
| - - name: Set up Python ${{ matrix.python-version }} |
83 |
| - uses: actions/setup-python@v2 |
84 |
| - with: |
85 |
| - python-version: ${{ matrix.python-version }} |
86 |
| - |
87 |
| - - name: Install dependencies |
88 |
| - run: python -m pip install --upgrade pip tox |
89 |
| - |
90 |
| - - name: Test with |
91 |
| - run: tox -e d${DJ_VER//.}-py${PY_VER//.}-${DBENGINE} |
92 |
| - |
93 |
| - - uses: codecov/codecov-action@v1 |
94 |
| - with: |
95 |
| - verbose: true |
| 83 | + POSTGRES_USER: postgres |
| 84 | + POSTGRES_PASSWORD: postgres |
| 85 | + POSTGRES_DB: concurrency |
| 86 | + ports: |
| 87 | + - 5432:5432 |
| 88 | + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 |
| 89 | + |
| 90 | + mysql: |
| 91 | + image: mysql:5.7 |
| 92 | + env: |
| 93 | + MYSQL_DATABASE: test_db |
| 94 | + MYSQL_USER: user |
| 95 | + MYSQL_PASSWORD: password |
| 96 | + MYSQL_ROOT_PASSWORD: rootpassword |
| 97 | + ports: |
| 98 | + - 33306:3306 |
| 99 | + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5 |
| 100 | + |
| 101 | + steps: |
| 102 | + - uses: actions/checkout@v4 |
| 103 | + |
| 104 | + - name: Setup MySQL |
| 105 | + run: | |
| 106 | + sudo /etc/init.d/mysql start |
| 107 | + mysql -e 'CREATE DATABASE concurrency;' -uroot -proot |
| 108 | + mysql -e 'SHOW DATABASES;' -uroot -proot |
| 109 | +
|
| 110 | + - name: Set up Python ${{ matrix.python-version }} |
| 111 | + uses: actions/setup-python@v5 |
| 112 | + with: |
| 113 | + python-version: ${{ matrix.python-version }} |
| 114 | + |
| 115 | + - name: Install dependencies |
| 116 | + run: python -m pip install --upgrade pip tox |
| 117 | + |
| 118 | + - name: Test with |
| 119 | + run: tox -e d${DJ_VER//.}-py${PY_VER//.}-${DBENGINE} |
| 120 | + |
| 121 | + - name: UUpload test results to Codecov |
| 122 | + uses: codecov/test-results-action@v1 |
| 123 | + with: |
| 124 | + env_vars: OS |
| 125 | + flags: ${{ matrix.django }} ${{ matrix.python }} |
| 126 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 127 | + verbose: true |
| 128 | + |
| 129 | + - name: Upload coverage to Codecov |
| 130 | + uses: codecov/codecov-action@v5 |
| 131 | + with: |
| 132 | + env_vars: OS,PYTHON |
| 133 | + fail_ci_if_error: true |
| 134 | + files: ./coverage1.xml,./coverage2.xml,!./cache |
| 135 | + flags: unittests |
| 136 | + name: codecov-umbrella |
| 137 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 138 | + verbose: true |
0 commit comments