Repository navigation
Name the pull request's branch, and abort a conflicting merge first #30
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 }} | |
| 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 3.15 runs report | |
| # whether the install works there without failing the others | |
| continue-on-error: ${{ matrix.python == '3.15' }} | |
| 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 | |
| run: python -m pip install ".[dev]" | |
| - name: Set a Git identity for the test repos | |
| 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 | |
| run: python -m pytest tests/unit_tests -q | |
| - name: Draw a simulation | |
| 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 |