|
| 1 | +--- |
1 | 2 | name: tests |
2 | | -on: |
| 3 | + |
| 4 | +on: # yamllint disable-line rule:truthy |
3 | 5 | pull_request: |
4 | 6 | push: |
5 | 7 | branches: [main] |
@@ -44,66 +46,94 @@ jobs: |
44 | 46 | name: ${{ matrix.os }} py-${{ matrix.py }} qt-${{ matrix.qt }} |
45 | 47 |
|
46 | 48 | steps: |
47 | | - - uses: actions/checkout@v3 |
48 | | - - uses: actions/setup-python@v4 |
49 | | - with: |
50 | | - python-version: ${{ matrix.py }} |
51 | | - |
52 | | - - name: Get full Python version |
53 | | - id: full-py-version |
54 | | - run: echo version=$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))") >> $GITHUB_OUTPUT |
55 | | - |
56 | | - - name: Cache ./.venv |
57 | | - id: cache-venv |
58 | | - |
59 | | - with: |
60 | | - path: .venv |
61 | | - key: venv-${{ runner.os }}-${{ steps.full-py-version.outputs.version }}-${{ matrix.qt }}-${{ hashFiles('**/poetry.lock') }} |
62 | | - |
63 | | - - uses: snok/install-poetry@v1 |
64 | | - with: |
65 | | - virtualenvs-in-project: true |
66 | | - |
67 | | - - name: Install dependencies |
68 | | - if: steps.cache-venv.outputs.cache-hit != 'true' |
69 | | - run: poetry install --only dev,github-actions,test,main |
70 | | - |
71 | | - - name: Install Qt dependencies |
72 | | - if: matrix.qt != 'none' && steps.cache-venv.outputs.cache-hit != 'true' |
73 | | - run: poetry run pip install -U ${{ matrix.qt }} |
74 | | - |
75 | | - - name: Install Linux dependencies |
76 | | - if: runner.os == 'Linux' |
77 | | - run: | |
78 | | - sudo apt-get update -y |
79 | | - sudo apt-get install --no-install-recommends -y libxkbcommon-x11-0 x11-utils libyaml-dev libegl1-mesa libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libopengl0 |
80 | | -
|
81 | | - - name: Run pytest |
82 | | - if: matrix.qt != 'none' |
83 | | - run: poetry run pytest --cov --cov-report=term-missing --cov-report=xml |
84 | | - |
85 | | - - name: Run pytest without Qt lib |
86 | | - if: matrix.qt == 'none' |
87 | | - run: | |
88 | | - poetry run pytest --cov --cov-report=term-missing --cov-report=xml --ignore=tests/test_widget_gallery.py --ignore=tests/test_qdarktheme_with_qt.py -p no:pytest-qt |
89 | | -
|
90 | | - - name: Upload coverage to Codecov |
91 | | - uses: codecov/codecov-action@v3 |
92 | | - with: |
93 | | - fail_ci_if_error: true |
94 | | - token: ${{ secrets.CODECOV_TOKEN }} |
95 | | - |
96 | | - - name: Capture img of WidgetGallery |
97 | | - if: matrix.qt != 'none' |
98 | | - run: poetry run python ./tools/capture.py -i ${{runner.os}}-py${{matrix.py}}-${{matrix.qt}} -d ${{ env.TEST_IMG_OUTPUT_PATH}} |
99 | | - |
100 | | - - name: Archive img of WidgetGallery |
101 | | - if: matrix.qt != 'none' |
102 | | - uses: actions/upload-artifact@v3 |
103 | | - with: |
104 | | - name: widget-img |
105 | | - path: ./${{ env.TEST_IMG_OUTPUT_PATH}}/*.png |
106 | | - |
107 | | - - name: Test freezing-pkg(PyInstaller) |
108 | | - if: matrix.qt != 'none' && runner.os != 'Linux' |
109 | | - run: poetry run python -m tools.test_freezing_lib |
| 49 | + - uses: actions/checkout@v3 |
| 50 | + - uses: actions/setup-python@v4 |
| 51 | + with: |
| 52 | + python-version: ${{ matrix.py }} |
| 53 | + |
| 54 | + - name: Get full Python version |
| 55 | + id: full-py-version |
| 56 | + run: | |
| 57 | + echo version=$(python -c " \ |
| 58 | + import sys; \ |
| 59 | + print('-'.join(str(v) for v in sys.version_info)) \ |
| 60 | + ") >> $GITHUB_OUTPUT |
| 61 | +
|
| 62 | + - name: Cache ./.venv |
| 63 | + id: cache-venv |
| 64 | + |
| 65 | + with: |
| 66 | + path: .venv |
| 67 | + key: | |
| 68 | + venv-\ |
| 69 | + ${{ runner.os }}-\ |
| 70 | + ${{ steps.full-py-version.outputs.version }}-\ |
| 71 | + ${{ matrix.qt }}-\ |
| 72 | + ${{ hashFiles('**/poetry.lock') }} |
| 73 | +
|
| 74 | + - uses: snok/install-poetry@v1 |
| 75 | + with: |
| 76 | + virtualenvs-in-project: true |
| 77 | + |
| 78 | + - name: Install dependencies |
| 79 | + if: steps.cache-venv.outputs.cache-hit != 'true' |
| 80 | + run: poetry install --only dev,github-actions,test,main |
| 81 | + |
| 82 | + - name: Install Qt dependencies |
| 83 | + if: matrix.qt != 'none' && steps.cache-venv.outputs.cache-hit != 'true' |
| 84 | + run: poetry run pip install -U ${{ matrix.qt }} |
| 85 | + |
| 86 | + - name: Install Linux dependencies |
| 87 | + if: runner.os == 'Linux' |
| 88 | + run: | |
| 89 | + sudo apt-get update -y |
| 90 | + sudo apt-get install --no-install-recommends -y \ |
| 91 | + libxkbcommon-x11-0 \ |
| 92 | + x11-utils libyaml-dev \ |
| 93 | + libegl1-mesa \ |
| 94 | + libxcb-icccm4 \ |
| 95 | + libxcb-image0 \ |
| 96 | + libxcb-keysyms1 \ |
| 97 | + libxcb-randr0 \ |
| 98 | + libxcb-render-util0 \ |
| 99 | + libxcb-xinerama0 \ |
| 100 | + libopengl0 |
| 101 | +
|
| 102 | + - name: Run pytest |
| 103 | + if: matrix.qt != 'none' |
| 104 | + run: poetry run pytest --cov --cov-report=term-missing --cov-report=xml |
| 105 | + |
| 106 | + - name: Run pytest without Qt lib |
| 107 | + if: matrix.qt == 'none' |
| 108 | + run: | |
| 109 | + poetry run pytest \ |
| 110 | + --cov \ |
| 111 | + --cov-report=term-missing \ |
| 112 | + --cov-report=xml \ |
| 113 | + --ignore=tests/test_widget_gallery.py \ |
| 114 | + --ignore=tests/test_qdarktheme_with_qt.py \ |
| 115 | + -p no:pytest-qt |
| 116 | +
|
| 117 | + - name: Upload coverage to Codecov |
| 118 | + uses: codecov/codecov-action@v3 |
| 119 | + with: |
| 120 | + fail_ci_if_error: true |
| 121 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 122 | + |
| 123 | + - name: Capture img of WidgetGallery |
| 124 | + if: matrix.qt != 'none' |
| 125 | + run: | |
| 126 | + poetry run python ./tools/capture.py \ |
| 127 | + -i ${{runner.os}}-py${{matrix.py}}-${{matrix.qt}} \ |
| 128 | + -d ${{ env.TEST_IMG_OUTPUT_PATH}} |
| 129 | +
|
| 130 | + - name: Archive img of WidgetGallery |
| 131 | + if: matrix.qt != 'none' |
| 132 | + uses: actions/upload-artifact@v3 |
| 133 | + with: |
| 134 | + name: widget-img |
| 135 | + path: ./${{ env.TEST_IMG_OUTPUT_PATH}}/*.png |
| 136 | + |
| 137 | + - name: Test freezing-pkg(PyInstaller) |
| 138 | + if: matrix.qt != 'none' && runner.os != 'Linux' |
| 139 | + run: poetry run python -m tools.test_freezing_lib |
0 commit comments