Skip to content

Commit 882c2a8

Browse files
author
Release Manager
committed
sagemathgh-39286: Migrate pyright workflow to use conda <!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes sagemath#12345". --> Simplifies the setup a bit and one step closer to independence on sage- the-distro. Also updates the pyright action ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [ ] The title is concise and informative. - [ ] The description explains in detail what this PR is about. - [ ] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#39286 Reported by: Tobias Diez Reviewer(s): Dima Pasechnik
2 parents 960e238 + a2cc52f commit 882c2a8

File tree

1 file changed

+24
-50
lines changed

1 file changed

+24
-50
lines changed

.github/workflows/pyright.yml

Lines changed: 24 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
name: Static check with Pyright
1+
name: Static type check
22

33
on:
4-
pull_request:
54
merge_group:
65
push:
76
branches:
87
- master
98
- develop
9+
pull_request:
1010
workflow_dispatch:
1111
# Allow to run manually
1212

@@ -18,67 +18,41 @@ concurrency:
1818
jobs:
1919
pyright:
2020
runs-on: ubuntu-latest
21-
container: ghcr.io/sagemath/sage/sage-ubuntu-noble-standard-with-targets:dev
2221
steps:
2322
- name: Checkout
24-
id: checkout
2523
uses: actions/checkout@v4
2624

27-
- name: Update system packages
28-
id: prepare
29-
run: |
30-
export PATH="build/bin:$PATH"
31-
eval $(sage-print-system-package-command auto update)
32-
eval $(sage-print-system-package-command auto --spkg --yes --no-install-recommends install git)
33-
34-
- name: Install GH CLI
35-
uses: dev-hanz-ops/[email protected]
36-
with:
37-
gh-cli-version: 2.32.0
38-
3925
- name: Merge CI fixes from sagemath/sage
4026
run: |
41-
git config --global --add safe.directory "$GITHUB_WORKSPACE"
4227
.ci/merge-fixes.sh
43-
44-
- name: Add prebuilt tree as a worktree
45-
id: worktree
46-
run: |
47-
set -ex
48-
.ci/retrofit-worktree.sh worktree-image /sage
49-
50-
- name: Incremental build (sagelib deps)
51-
id: incremental
52-
run: |
53-
# Now re-bootstrap and build. The build is incremental because we were careful with the timestamps.
54-
# pyright does not need a built sagelib; it only needs
55-
# the libraries from which sagelib imports.
56-
./bootstrap && make sagelib-build-deps
57-
working-directory: ./worktree-image
5828
env:
59-
MAKE: make -j2 --output-sync=recurse
60-
SAGE_NUM_THREADS: 2
29+
GH_TOKEN: ${{ github.token }}
6130

62-
- name: Static code check with pyright
63-
uses: jakebailey/pyright-action@v1
31+
- name: Cache conda packages
32+
uses: actions/cache@v4
6433
with:
65-
version: 1.1.332
66-
# Many warnings issued by pyright are not yet helpful because there is not yet enough type information.
67-
no-comments: true
68-
working-directory: ./worktree-image
69-
env:
70-
# To avoid out of memory errors
71-
NODE_OPTIONS: --max-old-space-size=8192
34+
path: ~/conda_pkgs_dir
35+
key:
36+
${{ runner.os }}-conda-${{ hashFiles('environment-3.11-linux.yml') }}
7237

73-
- name: Static code check with pyright (annotated)
74-
if: (success() || failure()) && steps.incremental.outcome == 'success'
75-
uses: jakebailey/pyright-action@v1
38+
- name: Setup Conda environment
39+
uses: conda-incubator/setup-miniconda@v3
40+
with:
41+
python-version: 3.11
42+
miniforge-version: latest
43+
use-mamba: true
44+
channels: conda-forge
45+
channel-priority: true
46+
activate-environment: sage-dev
47+
environment-file: environment-3.11-linux.yml
48+
49+
# No need to build sagelib; pyright only needs the libraries from which sagelib imports
50+
51+
- name: Static code check with pyright
52+
uses: jakebailey/[email protected]
7653
with:
7754
version: 1.1.332
78-
# Issue errors
79-
no-comments: false
80-
level: error
81-
working-directory: ./worktree-image
55+
annotate: "errors"
8256
env:
8357
# To avoid out of memory errors
8458
NODE_OPTIONS: --max-old-space-size=8192

0 commit comments

Comments
 (0)