1- name : Build and Run Tests
1+ name : Fix, Test, and Build
22
33on :
44 push :
1010 POETRY_VERSION : " 1.6.1"
1111
1212jobs :
13+ fix :
14+ name : Apply Ruff Fix
15+ runs-on : ubuntu-latest
16+ permissions :
17+ contents : write
18+ steps :
19+ - uses : actions/checkout@v3
20+ - uses : actions/setup-python@v5
21+ - uses : chartboost/ruff-action@v1
22+ with :
23+ args : --fix-only
24+ - uses : stefanzweifel/git-auto-commit-action@v5
25+ with :
26+ commit_message : " Automatic Style fixes"
27+
1328 test :
14- name : Test
29+ name : Run Tests
1530 runs-on : ubuntu-latest
1631 strategy :
1732 matrix :
1833 python-version : ["3.9"]
1934 steps :
20- - uses : actions/checkout@v3
35+ - uses : actions/checkout@v4
36+ with :
37+ ref : ${{ github.head_ref }}
38+ - name : Load cached Poetry installation
39+ id : cached-poetry
40+ uses : actions/cache@v3
41+ with :
42+ path : ~/.local
43+ key : poetry-${{ env.POETRY_VERSION }}-${{ hashFiles('**/poetry.lock') }}
44+ - name : Install Poetry
45+ if : steps.cached-poetry.outputs.cache-hit != 'true'
46+ uses : snok/install-poetry@v1
2147 - name : Set up python ${{ matrix.python-version }}
2248 uses : actions/setup-python@v5
2349 with :
2450 python-version : ${{ matrix.python-version }}
25- - name : Install Poetry
26- uses : snok/install-poetry@v1
51+ cache : " poetry"
2752 - name : Install dependencies
28- run : poetry install
53+ run : poetry install --no-interaction --no-root
54+ - name : Run lint with tests
55+ uses : chartboost/ruff-action@v1
56+ with :
57+ args : --fix-only
2958 - name : Run tests with pytest
3059 run : poetry run pytest tests/
60+
3161 build_poetry :
3262 name : Build Poetry
3363 runs-on : ubuntu-latest
3464 strategy :
3565 matrix :
3666 python-version : ["3.9"]
3767 steps :
38- - uses : actions/checkout@v3
68+ - uses : actions/checkout@v4
69+ with :
70+ ref : ${{ github.head_ref }}
71+ - name : Load cached Poetry installation
72+ id : cached-poetry
73+ uses : actions/cache@v3
74+ with :
75+ path : ~/.local
76+ key : poetry-${{ env.POETRY_VERSION }}-${{ hashFiles('**/poetry.lock') }}
77+ - name : Install Poetry
78+ if : steps.cached-poetry.outputs.cache-hit != 'true'
79+ uses : snok/install-poetry@v1
3980 - name : Set up python ${{ matrix.python-version }}
4081 uses : actions/setup-python@v5
4182 with :
4283 python-version : ${{ matrix.python-version }}
43- - name : Install Poetry
44- uses : snok/install-poetry@v1
84+ cache : " poetry"
4585 - name : Build
4686 run : poetry build
4787 - name : Install built package
@@ -50,17 +90,30 @@ jobs:
5090 run : python -c "import dspy"
5191 - name : Test import dsp
5292 run : python -c "import dsp"
93+
5394 build_setup :
5495 name : Build Setup
5596 runs-on : ubuntu-latest
5697 strategy :
5798 matrix :
5899 python-version : ["3.9"]
59100 steps :
60- - uses : actions/checkout@v3
101+ - uses : actions/checkout@v4
102+ with :
103+ ref : ${{ github.head_ref }}
104+ - name : Load cached Poetry installation
105+ id : cached-poetry
106+ uses : actions/cache@v3
107+ with :
108+ path : ~/.local
109+ key : poetry-${{ env.POETRY_VERSION }}-${{ hashFiles('**/poetry.lock') }}
110+ - name : Install Poetry
111+ if : steps.cached-poetry.outputs.cache-hit != 'true'
112+ uses : snok/install-poetry@v1
61113 - name : Set up python ${{ matrix.python-version }}
62114 uses : actions/setup-python@v5
63115 with :
64116 python-version : ${{ matrix.python-version }}
117+ cache : " poetry"
65118 - name : Run setup.py build
66119 run : python setup.py build
0 commit comments