Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate pyright workflow to use conda #39286

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 24 additions & 50 deletions .github/workflows/pyright.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: Static check with Pyright
name: Static type check

on:
pull_request:
merge_group:
push:
branches:
- master
- develop
pull_request:
workflow_dispatch:
# Allow to run manually

Expand All @@ -18,67 +18,41 @@ concurrency:
jobs:
pyright:
runs-on: ubuntu-latest
container: ghcr.io/sagemath/sage/sage-ubuntu-jammy-standard-with-targets:dev
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4

- name: Update system packages
id: prepare
run: |
export PATH="build/bin:$PATH"
eval $(sage-print-system-package-command auto update)
eval $(sage-print-system-package-command auto --spkg --yes --no-install-recommends install git)

- name: Install GH CLI
uses: dev-hanz-ops/[email protected]
with:
gh-cli-version: 2.32.0

- name: Merge CI fixes from sagemath/sage
run: |
git config --global --add safe.directory "$GITHUB_WORKSPACE"
.ci/merge-fixes.sh

- name: Add prebuilt tree as a worktree
id: worktree
run: |
set -ex
.ci/retrofit-worktree.sh worktree-image /sage

- name: Incremental build (sagelib deps)
id: incremental
run: |
# Now re-bootstrap and build. The build is incremental because we were careful with the timestamps.
# pyright does not need a built sagelib; it only needs
# the libraries from which sagelib imports.
./bootstrap && make sagelib-build-deps
working-directory: ./worktree-image
env:
MAKE: make -j2 --output-sync=recurse
SAGE_NUM_THREADS: 2
GH_TOKEN: ${{ github.token }}

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

- name: Static code check with pyright (annotated)
if: (success() || failure()) && steps.incremental.outcome == 'success'
uses: jakebailey/pyright-action@v1
- name: Setup Conda environment
uses: conda-incubator/setup-miniconda@v3
with:
python-version: 3.11
miniforge-version: latest
use-mamba: true
channels: conda-forge
channel-priority: true
activate-environment: sage-dev
environment-file: environment-3.11-linux.yml

# No need to build sagelib; pyright only needs the libraries from which sagelib imports

- name: Static code check with pyright
uses: jakebailey/[email protected]
with:
version: 1.1.332
# Issue errors
no-comments: false
level: error
working-directory: ./worktree-image
annotate: "errors"
env:
# To avoid out of memory errors
NODE_OPTIONS: --max-old-space-size=8192
Loading