|
12 | 12 |
|
13 | 13 | jobs: |
14 | 14 | setup: |
| 15 | + name: Setup |
15 | 16 | runs-on: ubuntu-latest |
| 17 | + outputs: |
| 18 | + cache-hit: ${{ steps.setup_uv.outputs.cache-hit }} |
16 | 19 | steps: |
17 | 20 | - name: Checkout code |
18 | 21 | uses: actions/checkout@v4 |
19 | 22 |
|
20 | | - - name: Set up Python |
21 | | - uses: actions/setup-python@v5 |
| 23 | + - name: Install uv (+ enable cache) |
| 24 | + id: setup_uv |
| 25 | + uses: astral-sh/setup-uv@v6 |
22 | 26 | with: |
23 | | - python-version: 3.12 |
| 27 | + enable-cache: true |
24 | 28 |
|
25 | | - - name: Cache pip |
26 | | - uses: actions/cache@v4 |
27 | | - with: |
28 | | - path: ~/.cache/pip |
29 | | - key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} |
30 | | - restore-keys: | |
31 | | - ${{ runner.os }}-pip- |
| 29 | + - name: Sync dependencies |
| 30 | + run: uv sync --locked --dev |
32 | 31 |
|
33 | | - - name: Cache virtual environment |
34 | | - uses: actions/cache@v4 |
35 | | - with: |
36 | | - path: .venv |
37 | | - key: ${{ runner.os }}-venv-${{ hashFiles('**/poetry.lock') }} |
38 | | - restore-keys: | |
39 | | - ${{ runner.os }}-venv- |
40 | | -
|
41 | | - - name: Install dependencies |
42 | | - run: | |
43 | | - python -m venv .venv |
44 | | - source .venv/bin/activate |
45 | | - pip install --upgrade pip |
46 | | - pip install poetry |
47 | | - poetry install |
| 32 | + - name: Prune uv cache (optimized for CI) |
| 33 | + run: uv cache prune --ci |
48 | 34 |
|
49 | 35 | ruff-format: |
| 36 | + name: ruff-format |
50 | 37 | needs: setup |
51 | 38 | runs-on: ubuntu-latest |
52 | 39 | steps: |
53 | 40 | - name: Checkout code |
54 | 41 | uses: actions/checkout@v4 |
55 | 42 |
|
56 | | - - name: Restore virtual environment cache |
57 | | - uses: actions/cache@v4 |
| 43 | + - name: Install uv + restore cache |
| 44 | + uses: astral-sh/setup-uv@v6 |
58 | 45 | with: |
59 | | - path: .venv |
60 | | - key: ${{ runner.os }}-venv-${{ hashFiles('**/poetry.lock') }} |
61 | | - restore-keys: | |
62 | | - ${{ runner.os }}-venv- |
63 | | -
|
64 | | - - name: Check ruff version |
65 | | - run: | |
66 | | - source .venv/bin/activate |
67 | | - poetry run ruff --version |
| 46 | + enable-cache: true |
68 | 47 |
|
69 | | - - name: Run ruff format check |
70 | | - run: | |
71 | | - source .venv/bin/activate |
72 | | - poetry run ruff format --check . |
| 48 | + - name: Check ruff formatting |
| 49 | + run: uv run ruff format --check . |
73 | 50 |
|
74 | 51 | ruff-lint: |
| 52 | + name: ruff-lint |
75 | 53 | needs: setup |
76 | 54 | runs-on: ubuntu-latest |
77 | 55 | steps: |
78 | 56 | - name: Checkout code |
79 | 57 | uses: actions/checkout@v4 |
80 | 58 |
|
81 | | - - name: Restore virtual environment cache |
82 | | - uses: actions/cache@v4 |
| 59 | + - name: Install uv + restore cache |
| 60 | + uses: astral-sh/setup-uv@v6 |
83 | 61 | with: |
84 | | - path: .venv |
85 | | - key: ${{ runner.os }}-venv-${{ hashFiles('**/poetry.lock') }} |
86 | | - restore-keys: | |
87 | | - ${{ runner.os }}-venv- |
88 | | -
|
89 | | - - name: Set up Python environment |
90 | | - run: source .venv/bin/activate |
91 | | - |
92 | | - - name: Check ruff version |
93 | | - run: | |
94 | | - source .venv/bin/activate |
95 | | - poetry run ruff --version |
| 62 | + enable-cache: true |
96 | 63 |
|
97 | 64 | - name: Run ruff lint |
98 | | - run: | |
99 | | - source .venv/bin/activate |
100 | | - poetry run ruff check --output-format=github . |
| 65 | + run: uv run ruff check --output-format=github . |
101 | 66 |
|
102 | 67 | mypy-type-check: |
| 68 | + name: mypy-type-check |
103 | 69 | needs: setup |
104 | 70 | runs-on: ubuntu-latest |
105 | 71 | steps: |
106 | 72 | - name: Checkout code |
107 | 73 | uses: actions/checkout@v4 |
108 | 74 |
|
109 | | - - name: Restore virtual environment cache |
110 | | - uses: actions/cache@v4 |
| 75 | + - name: Install uv + restore cache |
| 76 | + uses: astral-sh/setup-uv@v6 |
| 77 | + with: |
| 78 | + enable-cache: true |
| 79 | + |
| 80 | + - name: Run mypy |
| 81 | + run: uv run --frozen mypy . |
| 82 | + |
| 83 | + publish: |
| 84 | + runs-on: ubuntu-latest |
| 85 | + permissions: |
| 86 | + contents: read |
| 87 | + packages: write |
| 88 | + steps: |
| 89 | + - uses: actions/checkout@v4 |
| 90 | + - uses: actions/setup-java@v4 |
111 | 91 | with: |
112 | | - path: .venv |
113 | | - key: ${{ runner.os }}-venv-${{ hashFiles('**/poetry.lock') }} |
114 | | - restore-keys: | |
115 | | - ${{ runner.os }}-venv- |
116 | | -
|
117 | | - - name: Check mypy version |
118 | | - run: | |
119 | | - source .venv/bin/activate |
120 | | - poetry run mypy --version |
121 | | -
|
122 | | - - name: Run mypy type check |
123 | | - run: | |
124 | | - source .venv/bin/activate |
125 | | - poetry run mypy . |
| 92 | + java-version: "17" |
| 93 | + distribution: "temurin" |
| 94 | + - name: Setup Gradle |
| 95 | + uses: gradle/actions/setup-gradle@v3 |
| 96 | + |
| 97 | + - name: Publish package |
| 98 | + run: cd java && ./gradlew publish |
| 99 | + env: |
| 100 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments