Mirrowel commited on
Commit
54cc4c2
·
1 Parent(s): 2b065a1

ci(build): 🎡 migrate build workflow to use uv for Python setup and dependency management

Browse files

- replace actions/setup-python with astral-sh/setup-uv and enable uv cache for requirements.txt
- use `uv` to install Python 3.12, create venv, and run `uv pip` for dependency installs; activate the venv before installs
- remove pip cache discovery and actions/cache usage for pip in favor of uv-managed venv/cache
- switch PyInstaller cache step from PowerShell to bash and normalize cache path outputs to use $GITHUB_OUTPUT

Files changed (1) hide show
  1. .github/workflows/build.yml +19 -26
.github/workflows/build.yml CHANGED
@@ -29,45 +29,38 @@ jobs:
29
  - name: Check out repository
30
  uses: actions/checkout@v4
31
 
32
- - name: Set up Python
33
- id: setup-python
34
- uses: actions/setup-python@v5
35
  with:
36
- python-version: '3.12'
 
37
 
38
- - name: Get pip cache dir
39
- id: pip-cache
40
  shell: bash
41
  run: |
42
- echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
43
-
44
- - name: Cache pip dependencies
45
- uses: actions/cache@v4
46
- with:
47
- path: ${{ steps.pip-cache.outputs.dir }}
48
- key: ${{ runner.os }}-pip-3.12-${{ hashFiles('requirements.txt') }}
49
- restore-keys: |
50
- ${{ runner.os }}-pip-3.12
51
 
52
  - name: Install dependencies
53
  shell: bash
54
  run: |
55
  grep -v -- '-e src/rotator_library' requirements.txt > temp_requirements.txt
56
- pip install -r temp_requirements.txt
57
- pip install pyinstaller
58
- pip install -e src/rotator_library
 
59
 
60
  - name: Get PyInstaller cache directory
61
  id: pyinstaller-cache-dir
62
- shell: pwsh
63
  run: |
64
- if ($env:RUNNER_OS -eq 'Windows') {
65
- echo "path=$($env:USERPROFILE)\AppData\Local\pyinstaller" >> $env:GITHUB_OUTPUT
66
- } elseif ($env:RUNNER_OS -eq 'Linux') {
67
- echo "path=$($env:HOME)/.cache/pyinstaller" >> $env:GITHUB_OUTPUT
68
- } elseif ($env:RUNNER_OS -eq 'macOS') {
69
- echo "path=$($env:HOME)/Library/Application Support/pyinstaller" >> $env:GITHUB_OUTPUT
70
- }
71
 
72
  - name: Cache PyInstaller build data
73
  uses: actions/cache@v4
 
29
  - name: Check out repository
30
  uses: actions/checkout@v4
31
 
32
+ - name: Set up uv
33
+ uses: astral-sh/setup-uv@v4
 
34
  with:
35
+ enable-cache: true
36
+ cache-dependency-glob: "requirements.txt"
37
 
38
+ - name: Set up Python with uv
 
39
  shell: bash
40
  run: |
41
+ uv python install 3.12
42
+ uv venv --python 3.12
 
 
 
 
 
 
 
43
 
44
  - name: Install dependencies
45
  shell: bash
46
  run: |
47
  grep -v -- '-e src/rotator_library' requirements.txt > temp_requirements.txt
48
+ source .venv/bin/activate || . .venv/Scripts/activate
49
+ uv pip install -r temp_requirements.txt
50
+ uv pip install pyinstaller
51
+ uv pip install -e src/rotator_library
52
 
53
  - name: Get PyInstaller cache directory
54
  id: pyinstaller-cache-dir
55
+ shell: bash
56
  run: |
57
+ if [ "${{ runner.os }}" == "Windows" ]; then
58
+ echo "path=$USERPROFILE/AppData/Local/pyinstaller" >> $GITHUB_OUTPUT
59
+ elif [ "${{ runner.os }}" == "Linux" ]; then
60
+ echo "path=$HOME/.cache/pyinstaller" >> $GITHUB_OUTPUT
61
+ elif [ "${{ runner.os }}" == "macOS" ]; then
62
+ echo "path=$HOME/Library/Application Support/pyinstaller" >> $GITHUB_OUTPUT
63
+ fi
64
 
65
  - name: Cache PyInstaller build data
66
  uses: actions/cache@v4