|
7 | 7 | - develop
|
8 | 8 | pull_request:
|
9 | 9 | branches:
|
10 |
| - - "**" |
| 10 | + - master |
| 11 | + - develop |
11 | 12 |
|
12 | 13 | concurrency:
|
13 | 14 | group: tests-${{ github.head_ref || github.ref }}
|
@@ -56,73 +57,75 @@ jobs:
|
56 | 57 | - name: Checkout
|
57 | 58 | uses: actions/checkout@v4
|
58 | 59 |
|
59 |
| - - name: Set up Python ${{ matrix.python-version }} |
| 60 | + - name: Install libxcb dependencies |
| 61 | + if: ${{ matrix.os == 'ubuntu' }} |
| 62 | + env: |
| 63 | + DEBIAN_FRONTEND: noninteractive |
| 64 | + run: | |
| 65 | + sudo apt-get -qq update |
| 66 | + sudo apt-get -qq install '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev libegl-dev |
| 67 | +
|
| 68 | + - name: Setup python ${{ matrix.python-version }} |
60 | 69 | uses: actions/setup-python@v5
|
61 | 70 | with:
|
62 | 71 | python-version: ${{ matrix.python-version }}
|
63 | 72 |
|
64 |
| - - name: Get full Python version |
65 |
| - id: full-python-version |
66 |
| - run: echo version=$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))") >> $GITHUB_OUTPUT |
67 |
| - |
68 |
| - - name: Bootstrap poetry |
69 |
| - run: | |
70 |
| - curl -sSL https://install.python-poetry.org | POETRY_VERSION=1.8.4 python - -y |
71 |
| -
|
72 |
| - - name: Update Path |
73 |
| - if: ${{ matrix.os != 'windows' }} |
74 |
| - run: echo "$HOME/.local/bin" >> $GITHUB_PATH |
75 |
| - |
76 |
| - - name: Update Path for Windows |
77 |
| - if: ${{ matrix.os == 'windows' }} |
78 |
| - run: echo "$APPDATA\Python\Scripts" >> $GITHUB_PATH |
79 |
| - |
80 |
| - - name: Enable long paths on Windows |
81 |
| - if: ${{ matrix.os == 'windows' }} |
82 |
| - run: git config --system core.longpaths true |
83 |
| - |
84 |
| - - name: Configure poetry |
85 |
| - run: poetry config virtualenvs.in-project true |
86 |
| - |
87 |
| - - name: Setup cache |
88 |
| - uses: actions/cache@v4 |
89 |
| - id: cache |
| 73 | + - name: Install uv |
| 74 | + uses: astral-sh/setup-uv@v6 |
90 | 75 | with:
|
91 |
| - path: .venv |
92 |
| - key: venv-${{ runner.os }}-${{ matrix.qt-version }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }} |
| 76 | + version: "0.8.3" |
| 77 | + enable-cache: true |
93 | 78 |
|
94 |
| - - name: Valdate cache |
95 |
| - if: steps.cache.outputs.cache-hit == 'true' |
96 |
| - run: | |
97 |
| - # `timeout` is not available on macos, so we define a custom function. |
98 |
| - [ "$(command -v timeout)" ] || function timeout() { perl -e 'alarm shift; exec @ARGV' "$@"; } |
| 79 | + - name: Install qasync |
| 80 | + run: uv sync --locked --group dev |
99 | 81 |
|
100 |
| - # Using `timeout` is a safeguard against the Poetry command hanging for some reason. |
101 |
| - timeout 10s poetry run pip --version || rm -rf .venv |
| 82 | + - name: Install qt ${{ matrix.qt-version }} |
| 83 | + run: uv pip install ${{ matrix.qt-version }} |
102 | 84 |
|
103 |
| - - name: Check lock file |
104 |
| - run: poetry check --lock |
| 85 | + - name: Run tests |
| 86 | + uses: coactions/setup-xvfb@v1 |
| 87 | + env: |
| 88 | + QT_API: "${{ matrix.qt_version }}" |
| 89 | + COVERAGE_FILE: ".coverage.${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.qt-version }}" |
| 90 | + with: |
| 91 | + run: uv run coverage run --context=${{matrix.qt-version}} |
105 | 92 |
|
106 |
| - - name: Install dependencies |
107 |
| - run: poetry install --with github-actions |
| 93 | + - name: Upload coverage artifacts |
| 94 | + uses: actions/upload-artifact@v4 |
| 95 | + with: |
| 96 | + name: coverage-${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.qt-version }} |
| 97 | + path: .coverage.${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.qt-version }} |
| 98 | + include-hidden-files: true |
| 99 | + |
| 100 | + coverage: |
| 101 | + name: collect coverage |
| 102 | + runs-on: ubuntu-latest |
| 103 | + needs: tests |
| 104 | + permissions: |
| 105 | + pull-requests: write |
| 106 | + contents: write |
108 | 107 |
|
109 |
| - # - name: Run mypy |
110 |
| - # run: poetry run mypy |
| 108 | + steps: |
| 109 | + - name: Checkout |
| 110 | + uses: actions/checkout@v4 |
111 | 111 |
|
112 |
| - - name: Install Qt |
113 |
| - run: poetry run pip install --ignore-installed ${{ matrix.qt-version }} |
| 112 | + - name: Download coverage artifacts |
| 113 | + uses: actions/download-artifact@v4 |
| 114 | + with: |
| 115 | + pattern: coverage-* |
| 116 | + merge-multiple: true |
114 | 117 |
|
115 |
| - - name: Install libxcb dependencies |
116 |
| - if: ${{ matrix.os == 'ubuntu' }} |
117 |
| - env: |
118 |
| - DEBIAN_FRONTEND: noninteractive |
119 |
| - run: | |
120 |
| - sudo apt-get -qq update |
121 |
| - sudo apt-get -qq install '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev libegl-dev |
| 118 | + - name: Coverage comment |
| 119 | + id: coverage_comment |
| 120 | + uses: py-cov-action/[email protected] |
| 121 | + with: |
| 122 | + GITHUB_TOKEN: ${{ github.token }} |
| 123 | + MERGE_COVERAGE_FILES: true |
| 124 | + ANNOTATE_MISSING_LINES: true |
122 | 125 |
|
123 |
| - - name: Run pytest |
124 |
| - uses: coactions/setup-xvfb@v1 |
125 |
| - env: |
126 |
| - QT_API: ${{ matrix.qt-version }} |
| 126 | + - name: Store coverage comment to be posted |
| 127 | + uses: actions/upload-artifact@v4 |
| 128 | + if: steps.coverage_comment.outputs.COMMENT_FILE_WRITTEN == 'true' |
127 | 129 | with:
|
128 |
| - run: poetry run pytest --cov qasync -v |
| 130 | + name: python-coverage-comment-action |
| 131 | + path: python-coverage-comment-action.txt |
0 commit comments