Skip to content

Update to new rcrscore and migrate from Poetry to uv #240

Update to new rcrscore and migrate from Poetry to uv

Update to new rcrscore and migrate from Poetry to uv #240

Workflow file for this run

name: CI
on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop
jobs:
setup:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Cache virtual environment
id: cached-virtualenv
uses: actions/cache@v4
with:
path: .venv
key: ${{ runner.os }}-venv-${{ hashFiles('**/uv.lock') }}
- name: Install dependencies
if: steps.cached-virtualenv.outputs.cache-hit != 'true'
run: |
python -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install uv
uv sync
ruff-format:
needs: setup
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Restore virtual environment cache
uses: actions/cache@v4
with:
path: .venv
key: ${{ runner.os }}-venv-${{ hashFiles('**/uv.lock') }}
- name: Set path
run: echo ${{ github.workspace }}/.venv/bin >> $GITHUB_PATH
- name: Check ruff version
run: uv run ruff --version
- name: Run ruff format check
run: uv run ruff format --check .
ruff-lint:
needs: setup
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Restore virtual environment cache
uses: actions/cache@v4
with:
path: .venv
key: ${{ runner.os }}-venv-${{ hashFiles('**/poetry.lock') }}
- name: Set path
run: echo ${{ github.workspace }}/.venv/bin >> $GITHUB_PATH
- name: Check ruff version
run: uv run ruff --version
- name: Run ruff lint
run: uv run ruff check --output-format=github .
mypy-type-check:
needs: setup
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Restore virtual environment cache
uses: actions/cache@v4
with:
path: .venv
key: ${{ runner.os }}-venv-${{ hashFiles('**/poetry.lock') }}
- name: Set path
run: echo ${{ github.workspace }}/.venv/bin >> $GITHUB_PATH
- name: Check mypy version
run: uv run mypy --version
- name: Run mypy type check
run: uv run mypy .
pytest:
needs: setup
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Restore virtual environment cache
uses: actions/cache@v4
with:
path: .venv
key: ${{ runner.os }}-venv-${{ hashFiles('**/poetry.lock') }}
- name: Set path
run: echo ${{ github.workspace }}/.venv/bin >> $GITHUB_PATH
- name: Run pytest
run: pytest tests/
publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: "17"
distribution: "temurin"
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Publish package
run: cd java && ./gradlew publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}