Debian Codegraph @

.github/workflows/test-package.yml

raw symbols SCIP
1 name: Test package
2
3 on:
4 push:
5 pull_request:
6 workflow_dispatch:
7
8 jobs:
9
10 prepare:
11
12 runs-on: ubuntu-latest
13 steps:
14 - name: Checkout code
15 uses: actions/checkout@v4
16
17 - name: Create matrix
18 uses: fabiocaccamo/create-matrix-action@v3
19 id: create_matrix
20 with:
21 matrix: |
22 python-version {3.8}, django-version {3.0, 3.1, 3.2, 4.0, 4.1, 4.2}
23 python-version {3.9}, django-version {3.0, 3.1, 3.2, 4.0, 4.1, 4.2}
24 python-version {3.10}, django-version {3.2, 4.0, 4.1, 4.2, 5.0}
25 python-version {3.11}, django-version {4.1, 4.2, 5.0}
26 python-version {3.12}, django-version {4.2, 5.0}
27
28 outputs:
29 matrix: ${{ steps.create_matrix.outputs.matrix }}
30
31 lint:
32
33 runs-on: ubuntu-latest
34 steps:
35 - name: Checkout code
36 uses: actions/checkout@v4
37
38 - name: Set up Python
39 uses: actions/setup-python@v4
40 with:
41 python-version: '3.x'
42 cache: 'pip'
43
44 - name: Install tools needed
45 run: |
46 sudo apt install gettext
47 python -m pip install --upgrade pip
48 pip install tox
49
50 - name: Check migrations
51 run: |
52 tox -e migrations
53
54 - name: Check translations
55 run: |
56 tox -e translations
57
58 test:
59
60 needs: prepare
61 runs-on: ubuntu-latest
62 strategy:
63 fail-fast: false
64 matrix:
65 include: ${{fromJson(needs.prepare.outputs.matrix)}}
66
67 steps:
68
69 - uses: actions/checkout@v4
70
71 - name: Set up Python ${{ matrix.python-version }}
72 uses: actions/setup-python@v4
73 with:
74 python-version: ${{ matrix.python-version }}
75 # cache: 'pip'
76
77 - name: Cache virtualenv
78 uses: actions/cache@v3
79 with:
80 key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements-test.txt') }}
81 path: ./venv
82
83 - name: Create virtualenv
84 run: |
85 python -m venv ./venv
86 source ./venv/bin/activate
87 echo "$VIRTUAL_ENV/bin" >> $GITHUB_PATH
88 echo "VIRTUAL_ENV=$VIRTUAL_ENV" >> $GITHUB_ENV
89
90 - name: Upgrade pip version
91 run: |
92 python -m pip install --upgrade pip
93
94 - name: Install django
95 run: |
96 pip install "Django == ${{ matrix.django-version }}.*"
97
98 - name: Install requirements
99 run: |
100 pip install -r requirements.txt
101 pip install -r requirements-test.txt
102
103 - name: Run tests
104 run: |
105 coverage run --append --source=colorfield runtests.py
106 coverage report --show-missing
107 coverage xml -o ./coverage.xml
108
109 - name: Upload coverage to Codecov
110 uses: codecov/codecov-action@v3
111 with:
112 fail_ci_if_error: false
113 files: ./coverage.xml
114 flags: unittests
115 verbose: true