Format/lint with ruff #162
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: main-ci | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| branches: | |
| - master | |
| jobs: | |
| format: | |
| # check formatting with ruff | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.14 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v6 | |
| with: | |
| # Install a specific version of uv. | |
| version: "0.8.13" | |
| python-version: 3.14 | |
| - name: Install dependencies | |
| run: | | |
| uv sync | |
| - name: Format check | |
| run: | | |
| uv run -- ruff check --select I . | |
| uv run -- ruff format --diff | |
| - name: Lint check | |
| run: | | |
| uv run -- ruff check . | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v6 | |
| with: | |
| # Install a specific version of uv. | |
| version: "0.8.13" | |
| python-version: 3.14 | |
| - name: 🏗️ Build Wheels etc | |
| run: | | |
| make | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-and-sdist | |
| path: dist | |
| test: | |
| runs-on: ubuntu-latest | |
| container: | |
| image: ghcr.io/dtrx-py/dtrx:2025-11-03 | |
| # we need tty for the test for password zip noninteractive prompt | |
| # we need to be root for checkout to work without pain | |
| options: "-t --user=root" | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python: ["3.10", "3.11", "3.12", "3.13", "3.14"] | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: 🧪 Run Tests | |
| run: | | |
| # switch to a non-root user; this is required for one of the dtrx | |
| # tests, which checks for an EACCESS error :/ | |
| chown -R testuser:testuser . | |
| su testuser --pty -c "uv run --python ${{ matrix.python }} -- tests/compare.py" | |
| test-missing-file-command: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| # build the Docker image we use to run the tests | |
| - name: ✅ Test When `file` Command Not Present | |
| run: | | |
| ./tools/test-nonexistent-file-cmd.sh | |
| manpage: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v6 | |
| with: | |
| # Install a specific version of uv. | |
| version: "0.8.13" | |
| python-version: 3.14 | |
| # build the Docker image we use to run the tests | |
| - name: 📝 Generate Man Pages | |
| run: tools/gen-manpage.sh archived/README dtrx.1 | |
| # upload-artifact to save the generated manpage | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: manpage-output | |
| path: dtrx.1 | |
| windows: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v6 | |
| with: | |
| # Install a specific version of uv. | |
| version: "0.8.13" | |
| python-version: 3.14 | |
| - name: 🪟 Verify Windows Install Fails | |
| run: ./tools/test-windows-install-fails.sh |