44 workflow_dispatch :
55 pull_request :
66 push :
7- branches : [master]
7+ branches : [ master, main ]
88
99env :
10- UV_INDEX_STRATEGY : " unsafe-first-match"
11- UV_EXTRA_INDEX_URL : " https://download.pytorch.org/whl/cpu"
12- PIP_EXTRA_INDEX_URL : " https://download.pytorch.org/whl/cpu"
10+ UV_TORCH_BACKEND : " auto"
1311 UV_SYSTEM_PYTHON : 1
1412 BRANCH_NAME : ${{ github.head_ref || github.ref_name }}
1513
3836 strategy :
3937 fail-fast : true
4038 matrix :
41- python-version : ["3.10", "3.11", "3.12", "3.13"]
39+ python-version : [ "3.10", "3.11", "3.12", "3.13" ]
4240 steps :
4341 - uses : actions/checkout@v2
4442
@@ -58,19 +56,21 @@ jobs:
5856 uses : actions/setup-python@v5
5957 with :
6058 python-version : ${{ matrix.python-version }}
61- cache : ' pip'
59+
60+ - name : Install the latest version of uv
61+ uses : astral-sh/setup-uv@v7
6262
6363 - name : Install dependencies
64- run : pip install -e . --group dev
64+ run : uv pip install -e . --group dev
6565 if : matrix.python-version != '3.10' && matrix.python-version != '3.12' && matrix.python-version != '3.13' && matrix.python-version != '3.14'
6666
6767 - name : Install dependencies
68- run : pip install -e . --group dev --group setup
68+ run : uv pip install -e . --group dev --group setup
6969 if : matrix.python-version == '3.10'
7070
7171 - name : Install dependencies
7272 # skip ML tests for 3.12 and 3.13
73- run : pip install -e . --group dev
73+ run : uv pip install -e . --group dev
7474 if : matrix.python-version == '3.12' || matrix.python-version == '3.13' || matrix.python-version == '3.14'
7575
7676 - name : Test with Pytest on Python ${{ matrix.python-version }}
@@ -110,94 +110,95 @@ jobs:
110110 # Main docs are built in another workflow, we don't have to test them outside of PR
111111 if : github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
112112 steps :
113- - uses : actions/checkout@v2
114-
115- - uses : actions/setup-python@v5
116- with :
117- python-version : " 3.11"
118- cache : ' pip'
119-
120- - name : Install dependencies
121- run : pip install -e . --group docs
122-
123- - name : Set up Git
124- run : |
125- git config user.name ${{ github.actor }}
126- git config user.email ${{ github.actor }}@users.noreply.github.com
127- echo Current branch: $BRANCH_NAME
128-
129- - name : Build documentation
130- run : |
131- mike deploy --alias-type=copy --update-aliases $BRANCH_NAME latest
132- mike set-default $BRANCH_NAME
133-
134- - name : Put content of gh-pages to public folder
135- run : rm -rf public && mkdir public && git archive gh-pages | tar -x -C ./public/
136-
137- - name : Set up Vercel
138- run : npm install --global vercel@latest
139-
140- - name : Pull Vercel environment
141- run : vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
142-
143- - name : Create new vercel project linked to this branch
144- run : vercel project add edsnlp-$BRANCH_NAME --token=${{ secrets.VERCEL_TOKEN }}
145-
146- - name : Link public folder to the (maybe) new vercel project
147- run : vercel link --cwd public --project edsnlp-$BRANCH_NAME --yes --token=${{ secrets.VERCEL_TOKEN }}
148-
149- - name : Deploy to Vercel
150- run : vercel deploy public/ --yes --token=${{ secrets.VERCEL_TOKEN }} --archive=tgz --prod > deployment-url.txt
151-
152- - name : Post the documentation link
153- env :
154- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
155- run : |
156- slugify () {
157- echo "$1" | iconv -c -t ascii//TRANSLIT | sed -E 's/[^a-zA-Z0-9-]+//g' | tr A-Z a-z
158- }
159- RAW_PROJECT_NAME="edsnlp-$BRANCH_NAME"
160- URL=https://$(slugify "$RAW_PROJECT_NAME").vercel.app/
161- COMMENT_BODY="## Docs preview URL\n\n$URL\n\n"
162- HEADER="Authorization: token $GITHUB_TOKEN"
163- PR_COMMENTS_URL="https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments"
164-
165- # Fetch existing comments to find if one from this workflow already exists
166- COMMENTS=$(curl -s -H "$HEADER" "$PR_COMMENTS_URL")
167- COMMENT_ID=$(echo "$COMMENTS" | jq -r '.[] | select(.user.login == "github-actions[bot]" and (.body | startswith("## Docs preview URL"))) | .id')
168-
169- # Check if we have a comment ID, if so, update it, otherwise create a new one
170- if [[ "$COMMENT_ID" ]]; then
171- # Update existing comment
172- curl -s -X PATCH -H "$HEADER" -H "Content-Type: application/json" -d "{\"body\": \"$COMMENT_BODY\"}" "https://api.github.com/repos/${{ github.repository }}/issues/comments/$COMMENT_ID"
173- else
174- # Post new comment
175- curl -s -X POST -H "$HEADER" -H "Content-Type: application/json" -d "{\"body\": \"$COMMENT_BODY\"}" "$PR_COMMENTS_URL"
176- fi
177-
178- if [ $status -ne 0 ]; then
179- exit $status
180- fi
113+ - uses : actions/checkout@v2
114+
115+ - uses : actions/setup-python@v5
116+ with :
117+ python-version : " 3.11"
118+
119+ - name : Install the latest version of uv
120+ uses : astral-sh/setup-uv@v7
121+
122+ - name : Install dependencies
123+ run : uv pip install -e . --group docs
124+
125+ - name : Set up Git
126+ run : |
127+ git config user.name ${{ github.actor }}
128+ git config user.email ${{ github.actor }}@users.noreply.github.com
129+ echo Current branch: $BRANCH_NAME
130+
131+ - name : Build documentation
132+ run : |
133+ mike deploy --alias-type=copy --update-aliases $BRANCH_NAME latest
134+ mike set-default $BRANCH_NAME
135+
136+ - name : Put content of gh-pages to public folder
137+ run : rm -rf public && mkdir public && git archive gh-pages | tar -x -C ./public/
138+
139+ - name : Set up Vercel
140+ run : npm install --global vercel@latest
141+
142+ - name : Pull Vercel environment
143+ run : vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
144+
145+ - name : Create new vercel project linked to this branch
146+ run : vercel project add edsnlp-$BRANCH_NAME --token=${{ secrets.VERCEL_TOKEN }}
147+
148+ - name : Link public folder to the (maybe) new vercel project
149+ run : vercel link --cwd public --project edsnlp-$BRANCH_NAME --yes --token=${{ secrets.VERCEL_TOKEN }}
150+
151+ - name : Deploy to Vercel
152+ run : vercel deploy public/ --yes --token=${{ secrets.VERCEL_TOKEN }} --archive=tgz --prod > deployment-url.txt
153+
154+ - name : Post the documentation link
155+ env :
156+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
157+ run : |
158+ slugify () {
159+ echo "$1" | iconv -c -t ascii//TRANSLIT | sed -E 's/[^a-zA-Z0-9-]+//g' | tr A-Z a-z
160+ }
161+ RAW_PROJECT_NAME="edsnlp-$BRANCH_NAME"
162+ URL=https://$(slugify "$RAW_PROJECT_NAME").vercel.app/
163+ COMMENT_BODY="## Docs preview URL\n\n$URL\n\n"
164+ HEADER="Authorization: token $GITHUB_TOKEN"
165+ PR_COMMENTS_URL="https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments"
166+
167+ # Fetch existing comments to find if one from this workflow already exists
168+ COMMENTS=$(curl -s -H "$HEADER" "$PR_COMMENTS_URL")
169+ COMMENT_ID=$(echo "$COMMENTS" | jq -r '.[] | select(.user.login == "github-actions[bot]" and (.body | startswith("## Docs preview URL"))) | .id')
170+
171+ # Check if we have a comment ID, if so, update it, otherwise create a new one
172+ if [[ "$COMMENT_ID" ]]; then
173+ # Update existing comment
174+ curl -s -X PATCH -H "$HEADER" -H "Content-Type: application/json" -d "{\"body\": \"$COMMENT_BODY\"}" "https://api.github.com/repos/${{ github.repository }}/issues/comments/$COMMENT_ID"
175+ else
176+ # Post new comment
177+ curl -s -X POST -H "$HEADER" -H "Content-Type: application/json" -d "{\"body\": \"$COMMENT_BODY\"}" "$PR_COMMENTS_URL"
178+ fi
179+
180+ if [ $status -ne 0 ]; then
181+ exit $status
182+ fi
181183
182184 simple-installation :
183185 name : Simple installation
184186 runs-on : ubuntu-latest
185187 strategy :
186188 fail-fast : true
187189 matrix :
188- python-version : ["3.10", "3.11", "3.12", "3.13"]
190+ python-version : [ "3.10", "3.11", "3.12", "3.13" ]
189191 steps :
190192 - uses : actions/checkout@v2
191193
192194 - uses : actions/setup-python@v5
193195 with :
194196 python-version : ${{ matrix.python-version }}
195- cache : ' pip'
196197
197- - run : echo WEEK=$(date +%V) >>$GITHUB_ENV
198- shell : bash
198+ - name : Install the latest version of uv
199+ uses : astral-sh/setup-uv@v7
199200
200201 - name : Install library
201202 run : |
202- pip install ".[ml]" pytest
203+ uv pip install ".[ml]" pytest
203204 pytest tests/pipelines/test_pipelines.py
0 commit comments