|
| 1 | +name: Tycho |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: ["main"] |
| 6 | + pull_request: |
| 7 | + branches: ["main"] |
| 8 | + types: [ opened, synchronize, reopened, edited ] |
| 9 | + paths: |
| 10 | + - "src/tycho/**" |
| 11 | + |
| 12 | +permissions: |
| 13 | + contents: read |
| 14 | + |
| 15 | +jobs: |
| 16 | + build-tycho: |
| 17 | + runs-on: ubuntu-latest |
| 18 | + defaults: |
| 19 | + run: |
| 20 | + working-directory: ./src/tycho |
| 21 | + steps: |
| 22 | + - uses: actions/checkout@v5 |
| 23 | + - name: Install uv |
| 24 | + uses: astral-sh/setup-uv@v7 |
| 25 | + with: |
| 26 | + version: "0.9.7" |
| 27 | + enable-cache: true |
| 28 | + - name: Set up Python |
| 29 | + uses: actions/setup-python@v6 |
| 30 | + with: |
| 31 | + python-version-file: "./src/tycho/.python-version" |
| 32 | + - name: Install the project |
| 33 | + run: uv sync --locked --all-extras --dev |
| 34 | + |
| 35 | + build-docker-tycho: |
| 36 | + runs-on: ubuntu-latest |
| 37 | + steps: |
| 38 | + - uses: actions/checkout@v5 |
| 39 | + - name: Build tycho Docker image |
| 40 | + run: bin/compose build tycho |
| 41 | + |
| 42 | + lint-tycho: |
| 43 | + needs: build-tycho |
| 44 | + runs-on: ubuntu-latest |
| 45 | + defaults: |
| 46 | + run: |
| 47 | + working-directory: ./src/tycho |
| 48 | + env: |
| 49 | + TYCHO_SECRET_KEY: the_secret_key |
| 50 | + TYCHO_DATABASE_URL: psql://tycho:pass@postgresql:5432/tycho |
| 51 | + steps: |
| 52 | + - uses: actions/checkout@v5 |
| 53 | + - name: Install uv |
| 54 | + uses: astral-sh/setup-uv@v7 |
| 55 | + with: |
| 56 | + version: "0.9.7" |
| 57 | + enable-cache: true |
| 58 | + - name: Set up Python |
| 59 | + uses: actions/setup-python@v6 |
| 60 | + with: |
| 61 | + python-version-file: "./src/tycho/.python-version" |
| 62 | + - name: Lint with Ruff |
| 63 | + run: uv run ruff check . |
| 64 | + - name: Lint format with Ruff |
| 65 | + run: uv run ruff format --check . |
| 66 | + - name: Lint with MyPy |
| 67 | + run: uv run mypy . |
| 68 | + |
| 69 | + test-tycho: |
| 70 | + needs: build-tycho |
| 71 | + runs-on: ubuntu-latest |
| 72 | + services: |
| 73 | + postgresql: |
| 74 | + image: postgres:16.10 |
| 75 | + env: |
| 76 | + POSTGRES_DB: test-tycho |
| 77 | + POSTGRES_USER: tycho |
| 78 | + POSTGRES_PASSWORD: pass |
| 79 | + TEST: true |
| 80 | + options: >- |
| 81 | + --health-cmd pg_isready |
| 82 | + --health-interval 10s |
| 83 | + --health-timeout 5s |
| 84 | + --health-retries 5 |
| 85 | + ports: |
| 86 | + - 5432:5432 |
| 87 | + defaults: |
| 88 | + run: |
| 89 | + working-directory: ./src/tycho |
| 90 | + env: |
| 91 | + TYCHO_SECRET_KEY: the_secret_key |
| 92 | + TYCHO_DATABASE_URL: psql://tycho:pass@postgresql:5432/test-tycho |
| 93 | + steps: |
| 94 | + - uses: actions/checkout@v5 |
| 95 | + - name: Install uv |
| 96 | + uses: astral-sh/setup-uv@v7 |
| 97 | + with: |
| 98 | + version: "0.9.7" |
| 99 | + enable-cache: true |
| 100 | + - name: Set up Python |
| 101 | + uses: actions/setup-python@v6 |
| 102 | + with: |
| 103 | + python-version-file: "./src/tycho/.python-version" |
| 104 | + - name: Test with pytest |
| 105 | + run: uv run pytest . |
0 commit comments