Skip to content

Commit

Permalink
fix: action
Browse files Browse the repository at this point in the history
  • Loading branch information
phi-friday committed Mar 8, 2024
1 parent 1e3572b commit f387a3a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 31 deletions.
26 changes: 9 additions & 17 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ on:
branches: [dev]
paths:
- "**.py"
- ".github/workflows/check.yaml"
pull_request:
branches: [dev, main]
paths:
- "**.py"
- ".github/workflows/check.yaml"

jobs:
build:
Expand All @@ -21,40 +23,30 @@ jobs:
- uses: actions/checkout@v4

- name: Install rye
env:
RYE_INSTALL_OPTION: "--yes"
run: |
curl -sSf https://rye-up.com/get | bash
echo "$HOME/.rye/shims" >> $GITHUB_PATH
- name: set python version
id: set-python
run: |
rye config --set-bool behavior.use-uv=true
rye pin cpython@${{ matrix.python-version }}
cat .python-version
VERSION=$(cat .python-version)
echo "python_version=${VERSION}" >> $GITHUB_OUTPUT
uses: phi-friday/install-rye@v1
id: install-rye
with:
python_version: ${{ matrix.python-version }}
use_uv: true

- name: Load cached venv
id: cached-venv-dependencies
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.set-python.outputs.python_version }}-${{ hashFiles('**/pyproject.toml') }}
key: venv-${{ runner.os }}-${{ steps.install-rye.outputs.python-version }}-${{ hashFiles('**/pyproject.toml') }}

- name: Install dependencies
if: steps.cached-venv-dependencies.outputs.cache-hit != 'true'
run: |
rye pin cpython@${{ steps.set-python.outputs.python_version }}
rye sync --all-features
- name: Load cached pre-commit
id: cached-pre-commit-dependencies
uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: venv-${{ runner.os }}-${{ steps.set-python.outputs.python_version }}-${{ hashFiles('**/pyproject.toml') }}
key: venv-${{ runner.os }}-${{ steps.install-rye.outputs.python-version }}-${{ hashFiles('**/pyproject.toml') }}

- name: Code checks
run: |
Expand Down
19 changes: 5 additions & 14 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,11 @@ jobs:
fetch-depth: 0

- name: Install rye
env:
RYE_INSTALL_OPTION: '--yes'
run: |
curl -sSf https://rye-up.com/get | bash
echo "$HOME/.rye/shims" >> $GITHUB_PATH
- name: set python version
id: set-python
run: |
rye config --set-bool behavior.use-uv=true
rye pin cpython@${{ matrix.python-version }}
cat .python-version
VERSION=$(cat .python-version)
echo "python_version=${VERSION}" >> $GITHUB_OUTPUT
uses: phi-friday/install-rye@v1
id: install-rye
with:
python_version: ${{ matrix.python-version }}
use_uv: true

- name: Build package
run: |
Expand Down

0 comments on commit f387a3a

Please sign in to comment.