Skip to content

Commit

Permalink
ci: change to use uv action
Browse files Browse the repository at this point in the history
  • Loading branch information
shenxiangzhuang committed Oct 29, 2024
1 parent 9cbf349 commit 0282846
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 47 deletions.
54 changes: 26 additions & 28 deletions .github/workflows/build_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,32 @@ jobs:
name: Build docs (python-${{ matrix.python-version }}, ${{ matrix.os }})
strategy:
matrix:
os:
- ubuntu-latest
python-version:
# - "3.10"
# - "3.11"
# - "3.12"
- "3.13"
os:
- ubuntu-latest
# - macos-latest
# - windows-latest
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup pandoc
run: |
wget https://github.com/jgm/pandoc/releases/download/2.18/pandoc-2.18-1-amd64.deb && sudo dpkg -i pandoc-2.18-1-amd64.deb
sudo apt-get install pandoc-citeproc
- name: Set up uv (Unix)
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Restore uv cache
uses: actions/cache@v4
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install uv
uses: astral-sh/setup-uv@v2
with:
path: |
~/.cache/uv
~/.uv
key: ${{ runner.os }}-uv-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-uv-
enable-cache: true
cache-dependency-glob: "uv.lock"

- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
Expand All @@ -56,26 +56,24 @@ jobs:
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup pandoc
run: |
wget https://github.com/jgm/pandoc/releases/download/2.18/pandoc-2.18-1-amd64.deb && sudo dpkg -i pandoc-2.18-1-amd64.deb
sudo apt-get install pandoc-citeproc
- name: Set up uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Restore uv cache
uses: actions/cache@v4
- name: Install uv
uses: astral-sh/setup-uv@v2
with:
path: ~/.cache/uv
key: ${{ runner.os }}-uv-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-uv-
enable-cache: true
cache-dependency-glob: "uv.lock"

- name: Set up Python
run: uv python install 3.12
- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version-file: "pyproject.toml"

- name: Install the project
run: uv sync --all-extras --dev
Expand Down
30 changes: 17 additions & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,20 @@ jobs:
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
uv pip install --system -e '.[dev,docs,plot]'
- name: Build
run: uv build
- name: Publish
uses: pypa/gh-action-pypi-publish@release/v1
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v2
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version-file: "pyproject.toml"

- name: Install the project
run: uv sync --all-extras --dev
- name: Build package
run: uv build
- name: Publish
uses: pypa/gh-action-pypi-publish@release/v1
19 changes: 13 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,21 @@ jobs:
python-version: [ "3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}

- name: Install uv
uses: astral-sh/setup-uv@v2
with:
enable-cache: true
cache-dependency-glob: "uv.lock"

- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
uv pip install --system -e '.[dev,docs,plot]'
python-version-file: "pyproject.toml"

- name: Install the project
run: uv sync --all-extras --dev

- name: Lint with Mypy
run: mypy toyml tests
- name: Pre-Commit Check
Expand Down

0 comments on commit 0282846

Please sign in to comment.