fix: update rye path #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI Backend | |
on: | |
push: | |
paths: | |
- 'backend/**' | |
- '.github/workflows/**' | |
pull_request: | |
paths: | |
- 'backend/**' | |
- '.github/workflows/**' | |
jobs: | |
build-and-test: | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
python-version: [3.12] | |
steps: | |
# Step 1: Checkout the repository | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
# Step 2: Install Rye | |
- name: Install Rye | |
run: | | |
curl -sSf https://rye.astral.sh/get | RYE_INSTALL_OPTION="--yes" bash | |
# Step 3: Add Rye to PATH | |
- name: Add Rye to PATH | |
run: | | |
echo "$HOME/.local/bin" >> $GITHUB_PATH | |
# Step 4: Verify Rye Installation (Optional but recommended) | |
- name: Verify Rye Installation | |
run: rye --version | |
# Step 5: Cache Rye Dependencies (Optional but recommended) | |
- name: Cache Rye Dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/rye | |
key: ${{ runner.os }}-rye-${{ hashFiles('backend/rye.lock') }} | |
restore-keys: | | |
${{ runner.os }}-rye- | |
# Step 6: Install dependencies using Rye | |
- name: Install Dependencies with Rye | |
working-directory: backend | |
run: | | |
rye sync | |
# Step 7: Verify Python and Rye Versions (Optional but recommended) | |
- name: Verify Python and Rye Versions | |
run: | | |
python --version | |
rye --version | |
# Step 8: Run Tests with Pytest using Rye | |
- name: Run Pytest | |
working-directory: backend | |
run: | | |
rye run pytest --cov=api --cov=tests --cov-report=xml |