From b40294e145fcaa456c77f39110ab0cb71fdb8a80 Mon Sep 17 00:00:00 2001 From: Thomas Schmelzer Date: Mon, 10 Nov 2025 09:19:32 +0400 Subject: [PATCH 1/3] Create action.yml --- .github/actions/setup-project/action.yml | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/actions/setup-project/action.yml diff --git a/.github/actions/setup-project/action.yml b/.github/actions/setup-project/action.yml new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/.github/actions/setup-project/action.yml @@ -0,0 +1 @@ + From db818327b7574128739db20872cb3b88cf25d2ca Mon Sep 17 00:00:00 2001 From: Thomas Schmelzer Date: Mon, 10 Nov 2025 09:20:25 +0400 Subject: [PATCH 2/3] Create composite action for Python project setup This composite action sets up a Python project by installing necessary tools, creating a virtual environment, and checking for the presence of a pyproject.toml file. --- .github/actions/setup-project/action.yml | 80 ++++++++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/.github/actions/setup-project/action.yml b/.github/actions/setup-project/action.yml index 8b137891..f3ee6bc0 100644 --- a/.github/actions/setup-project/action.yml +++ b/.github/actions/setup-project/action.yml @@ -1 +1,81 @@ +# Action: Setup Project (composite action) +# +# Purpose: Bootstrap a Python project in GitHub Actions by: +# - Installing Task, uv, and uvx into a local ./bin directory +# - Detecting presence of pyproject.toml and exposing it as an output +# - Creating a virtual environment with uv and syncing dependencies +# +# Inputs: +# - python-version: Python version used for the virtual environment (default: 3.12) +# +# Outputs: +# - pyproject_exists: "true" if pyproject.toml exists, otherwise "false" +# +# Notes: +# - Safe to run in repositories without pyproject.toml; dependency sync will be skipped. +# - Used by workflows such as CI, Book, Marimo, and Release. +name: 'Setup Project' +description: 'Setup the project' + +inputs: + python-version: + description: 'Python version to use' + required: false + default: '3.12' + +outputs: + pyproject_exists: + description: 'Flag indicating whether pyproject.toml exists' + value: ${{ steps.check_pyproject.outputs.exists }} + +runs: + using: 'composite' + steps: + - name: Set up task, uv, uvx and the venv + shell: bash + run: | + mkdir -p bin + + # Add ./bin to the PATH + echo "Adding ./bin to PATH" + echo "$(pwd)/bin" >> $GITHUB_PATH + + # Install Task + curl -fsSL https://taskfile.dev/install.sh | sh -s -- -d -b ./bin + + # Install uv and uvx + curl -fsSL https://astral.sh/uv/install.sh | UV_INSTALL_DIR="./bin" sh + + - name: Check version for task + shell: bash + run: | + task --version + + - name: Check version for uv + shell: bash + run: | + uv --version + + - name: Check for pyproject.toml + id: check_pyproject + shell: bash + run: | + if [ -f "pyproject.toml" ]; then + echo "exists=true" >> "$GITHUB_OUTPUT" + else + echo "exists=false" >> "$GITHUB_OUTPUT" + fi + + - name: Build the virtual environment + shell: bash + run: uv venv --python ${{ inputs.python-version }} + + - name: "Sync the virtual environment for ${{ github.repository }} if pyproject.toml exists" + shell: bash + run: | + if [ -f "pyproject.toml" ]; then + uv sync --all-extras + else + echo "No pyproject.toml found, skipping package installation" + fi From 0a90f17cdd709fb9cd90361bf02e6ee12efeac0d Mon Sep 17 00:00:00 2001 From: Thomas Schmelzer Date: Mon, 10 Nov 2025 09:20:59 +0400 Subject: [PATCH 3/3] Delete .github/ISSUE_TEMPLATE/workflows directory --- .github/ISSUE_TEMPLATE/workflows/main.yml | 39 ----------------------- 1 file changed, 39 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/workflows/main.yml diff --git a/.github/ISSUE_TEMPLATE/workflows/main.yml b/.github/ISSUE_TEMPLATE/workflows/main.yml deleted file mode 100644 index d94f0a51..00000000 --- a/.github/ISSUE_TEMPLATE/workflows/main.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: pytest -on: - pull_request: - push: - branches: - - main - -jobs: - pytest: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: [3.6, 3.7, 3.8] - steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Get full python version - id: full-python-version - run: | - echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info[:3]))") - - name: Install Poetry - uses: snok/install-poetry@v1.1.1 - with: - virtualenvs-create: true - virtualenvs-in-project: true - - name: Set up cache - id: cached-poetry-dependencies - uses: actions/cache@v2 - with: - path: .venv - key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }} - - name: Install dependencies - run: poetry install -E optionals - if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' - - name: Run tests - run: poetry run pytest