Major Infra Restructure #4
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: CI | |
| on: | |
| push: | |
| branches: [ master, python314 ] | |
| pull_request: | |
| branches: [ master ] | |
| workflow_dispatch: | |
| jobs: | |
| test: | |
| name: Test Python ${{ matrix.python-version }} on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14'] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Checkout worldengine-data | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: Mindwerks/worldengine-data | |
| path: ../worldengine-data | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| allow-prereleases: true | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| with: | |
| enable-cache: true | |
| - name: Install dependencies | |
| run: | | |
| uv pip install --system -e ".[hdf5,dev]" | |
| - name: Run tests | |
| run: | | |
| pytest -v tests --tb=short | |
| - name: Test worldengine command | |
| run: | | |
| worldengine --help | |
| worldengine world -s 42 -n test_world -x 512 -y 512 | |
| lint: | |
| name: Lint and Type Check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| - name: Install dependencies | |
| run: | | |
| uv pip install --system -e ".[dev]" | |
| - name: Run pre-commit | |
| run: | | |
| pre-commit run --all-files | |
| - name: Run ruff check | |
| run: | | |
| ruff check worldengine/ | |
| - name: Run mypy | |
| run: | | |
| mypy worldengine/ --ignore-missing-imports | |
| continue-on-error: true | |
| build-wheels: | |
| name: Build wheels on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install build tools | |
| run: | | |
| python -m pip install --upgrade pip build | |
| - name: Build sdist (Ubuntu only) | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| python -m build --sdist | |
| - name: Build wheel | |
| run: | | |
| python -m build --wheel | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-${{ matrix.os }} | |
| path: dist/* | |
| docker: | |
| name: Test Docker build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build Docker image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| push: false | |
| tags: worldengine:test | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| load: true | |
| - name: Test Docker image | |
| run: | | |
| docker run worldengine:test worldengine --help | |
| docker run worldengine:test worldengine world -s 123 -n docker_test -x 256 -y 256 |