Skip to content

Add prune command for removing cached JDKs #147

Add prune command for removing cached JDKs

Add prune command for removing cached JDKs #147

Workflow file for this run

# This file is part of cjdk.
# Copyright 2022-25 Board of Regents of the University of Wisconsin System
# SPDX-License-Identifier: MIT
name: CI
on:
pull_request:
push:
branches:
- main
tags:
- v*
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.x"
- uses: pre-commit/action@v3.0.0
- uses: astral-sh/setup-uv@v5
- run: uv run ty check # Until they add a pre-commit hook
test:
strategy:
fail-fast: false
matrix:
include:
# All Python versions on Ubuntu
- runner: ubuntu-latest
python: "3.10"
- runner: ubuntu-latest
python: "3.11"
- runner: ubuntu-latest
python: "3.12"
- runner: ubuntu-latest
python: "3.13"
- runner: ubuntu-latest
python: "3.14"
# Oldest and newest Python on other platforms
- runner: macos-latest
python: "3.10"
- runner: macos-latest
python: "3.14"
- runner: windows-latest
python: "3.10"
- runner: windows-latest
python: "3.14"
name: test-${{ matrix.runner }}-py${{ matrix.python }}
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Full history needed for hatch-vcs
- uses: astral-sh/setup-uv@v5
- name: Run tests
run: uv run --python ${{ matrix.python }} --group test pytest
docs:
needs:
- lint
- test
concurrency:
group: publish-gh-pages
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Full history needed for hatch-vcs
- uses: astral-sh/setup-uv@v5
- name: Build docs
run: uv run --group docs jb build docs/
env:
CJDK_HIDE_PROGRESS_BARS: "1"
- name: Publish to gh-pages (latest)
if: >-
github.repository == 'cachedjdk/cjdk' &&
github.event_name == 'push' &&
github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/_build/html
destination_dir: latest
commit_message: Deploy latest
- name: Get version from tag
id: get_version
if: startsWith(github.ref, 'refs/tags/v')
run: |
VERSION="${GITHUB_REF##refs/tags/v}"
echo "version=${VERSION}" >>$GITHUB_OUTPUT
- name: Publish to gh-pages (tag)
if: >-
github.repository == 'cachedjdk/cjdk' &&
github.event_name == 'push' &&
startsWith(github.ref, 'refs/tags/v')
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/_build/html
destination_dir: ${{ steps.get_version.outputs.version }}
commit_message: Deploy ${{ steps.get_version.outputs.version }}
publish:
needs:
- lint
- test
- docs
runs-on: ubuntu-latest
permissions: # https://docs.pypi.org/trusted-publishers/
id-token: write
contents: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Full history needed for hatch-vcs
- uses: astral-sh/setup-uv@v5
- name: Build sdist and wheel
run: uv build
- name: Publish on PyPI
if: >-
github.repository == 'cachedjdk/cjdk' &&
github.event_name == 'push' &&
startsWith(github.ref, 'refs/tags/v')
uses: pypa/gh-action-pypi-publish@release/v1