Repository navigation
Ask for a star or sponsorship near the top of the README #37
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Tests | |
| on: | |
| push: | |
| pull_request: | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| unit: | |
| name: ${{ matrix.os }}, Python ${{ matrix.python }}${{ matrix.python == '3.15' && ' (allowed to fail)' || '' }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| python: ["3.10", "3.11", "3.12", "3.13", "3.14", "3.15"] | |
| # skia-python publishes no 3.15 wheels yet, so on 3.15 each step may fail: | |
| # its log says how far it got, but the job (and the commit's check) stays | |
| # green. continue-on-error on the job itself would still mark the commit | |
| # failed. The steps after the install run once it succeeds. | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python }} | |
| allow-prereleases: true | |
| - name: Install the libraries skia needs on Linux | |
| if: runner.os == 'Linux' | |
| run: sudo apt-get update && sudo apt-get install -y libegl1 libgl1 libfontconfig1 | |
| - name: Install | |
| id: install | |
| continue-on-error: ${{ matrix.python == '3.15' }} | |
| run: python -m pip install ".[dev]" | |
| - name: Set a Git identity for the test repos | |
| if: steps.install.outcome == 'success' | |
| run: | | |
| git config --global user.name "git-sim tests" | |
| git config --global user.email "tests@example.com" | |
| git config --global init.defaultBranch main | |
| - name: Unit tests | |
| if: steps.install.outcome == 'success' | |
| continue-on-error: ${{ matrix.python == '3.15' }} | |
| run: python -m pytest tests/unit_tests -q | |
| - name: Draw a simulation | |
| if: steps.install.outcome == 'success' | |
| continue-on-error: ${{ matrix.python == '3.15' }} | |
| shell: bash | |
| run: | | |
| git init -q demo && cd demo | |
| echo a > a && git add a && git commit -qm First | |
| echo b > b && git add b && git commit -qm Second | |
| git-sim -d --media-dir ../media log | |
| ls -R ../media | |
| docker: | |
| name: Docker image | |
| runs-on: ubuntu-latest | |
| env: | |
| # the image installs this commit rather than the release on PyPI | |
| SOURCE: git+https://github.com/${{ github.event.pull_request.head.repo.full_name || github.repository }}@${{ github.event.pull_request.head.sha || github.sha }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Build | |
| run: docker build -t git-sim --build-arg PACKAGE="git-sim[extras] @ $SOURCE" . | |
| # the repo is made by the runner's user and mounted into a container | |
| # running as root, the case the image's safe.directory setting is for | |
| - name: Make a repo to simulate | |
| run: | | |
| git config --global user.name "git-sim tests" | |
| git config --global user.email "tests@example.com" | |
| git init -q -b main demo && cd demo | |
| echo a > a && git add a && git commit -qm First | |
| echo b > b && git add b && git commit -qm Second | |
| - name: Draw a page, an image, and a video | |
| working-directory: demo | |
| run: | | |
| docker run --rm -v "$PWD:/usr/src/git-sim" git-sim -d log | |
| docker run --rm -v "$PWD:/usr/src/git-sim" git-sim -d --img-format png log | |
| docker run --rm -v "$PWD:/usr/src/git-sim" git-sim -d --animate --low-quality log | |
| ls -R git-sim_media | |
| for ext in html png mp4; do | |
| find git-sim_media -name "*.$ext" | grep -q . || { echo "no .$ext written"; exit 1; } | |
| done |