| 1 |
name: tests |
| 2 |
|
| 3 |
concurrency: |
| 4 |
group: ${{ github.workflow }}-${{ github.ref }} |
| 5 |
cancel-in-progress: true |
| 6 |
|
| 7 |
on: [push, pull_request] |
| 8 |
|
| 9 |
jobs: |
| 10 |
test: |
| 11 |
runs-on: ${{ matrix.os }} |
| 12 |
strategy: |
| 13 |
matrix: |
| 14 |
os: [windows-latest, ubuntu-22.04, macos-latest] |
| 15 |
python-version: ["3.10", "3.11", "3.12", "3.13"] |
| 16 |
fail-fast: false |
| 17 |
|
| 18 |
steps: |
| 19 |
- uses: actions/checkout@v4 |
| 20 |
with: |
| 21 |
submodules: "recursive" |
| 22 |
|
| 23 |
- name: Set up Python |
| 24 |
uses: actions/setup-python@v5 |
| 25 |
|
| 26 |
with: |
| 27 |
python-version: ${{ matrix.python-version }} |
| 28 |
|
| 29 |
- name: Install packages |
| 30 |
shell: bash |
| 31 |
run: | |
| 32 |
pip install tox tox-gh-actions |
| 33 |
if [ "$RUNNER_OS" = "Linux" ]; then |
| 34 |
sudo apt update |
| 35 |
sudo apt-get install libegl1 libopengl0 |
| 36 |
sudo apt-get install '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev |
| 37 |
sudo apt-get install libxcb-xinerama0 |
| 38 |
sudo apt-get install libxkbcommon-x11-0 |
| 39 |
sudo apt-get install libxml2 libxml2-dev libxslt1-dev libxslt1.1 |
| 40 |
sudo apt-get install xorg |
| 41 |
sudo apt-get install -y xvfb |
| 42 |
fi |
| 43 |
|
| 44 |
- name: Start Xvfb |
| 45 |
if: matrix.os == 'ubuntu-22.04' |
| 46 |
run: | |
| 47 |
Xvfb :0 -screen 0 1280x720x24 > /dev/null 2>&1 & |
| 48 |
export DISPLAY=:0 |
| 49 |
touch ~/.Xauthority |
| 50 |
|
| 51 |
Xvfb :0 -screen 0 1280x720x24 > /dev/null 2>&1 & |
| 52 |
export DISPLAY=:0 |
| 53 |
|
| 54 |
# see: https://github.com/ymyzk/tox-gh-actions |
| 55 |
- name: Run tests |
| 56 |
run: tox |
| 57 |
|
| 58 |
- uses: actions/upload-artifact@v4 |
| 59 |
if: failure() # && matrix.os == 'windows-latest' # 'ubuntu-22.04' or 'windows-latest' |
| 60 |
with: |
| 61 |
path: "**/screenshots/**" |
| 62 |
name: screenshots-${{ matrix.os }}-${{ matrix.python-version }} |
| 63 |
|
| 64 |
- name: Stop Xvfb |
| 65 |
if: matrix.os == 'ubuntu-22.04' |
| 66 |
run: killall Xvfb |
| 67 |
|
| 68 |
- name: Publish Style Summary |
| 69 |
if: ${{ failure() || success() }} |
| 70 |
run: | |
| 71 |
python -c "from ci import report_style; report_style()" |
| 72 |
|
| 73 |
- name: Publish Tests Summary |
| 74 |
if: ${{ failure() || success() }} |
| 75 |
run: | |
| 76 |
pip install junitparser |
| 77 |
python -c "from ci import report_tests; report_tests(header='## Unit-tests Report:')" |
| 78 |
|
| 79 |
- name: Coveralls Parallel |
| 80 |
uses: coverallsapp/github-action@v2 |
| 81 |
with: |
| 82 |
github-token: ${{ secrets.GITHUB_TOKEN }} |
| 83 |
flag-name: Unittests-${{ matrix.os }}-${{ matrix.python-version }} |
| 84 |
parallel: true |
| 85 |
format: lcov |
| 86 |
|
| 87 |
coveralls: |
| 88 |
needs: test |
| 89 |
runs-on: ubuntu-latest |
| 90 |
steps: |
| 91 |
- name: Coveralls Finished |
| 92 |
uses: coverallsapp/github-action@v2 |
| 93 |
with: |
| 94 |
github-token: ${{ secrets.GITHUB_TOKEN }} |
| 95 |
parallel-finished: true |