From a161b0482cff2bd0704c2816a84c70fea8bee591 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Sun, 5 Jan 2025 21:04:26 +0800 Subject: [PATCH 1/4] Migrate pyright workflow to use conda --- .github/workflows/pyright.yml | 61 ++++++++++++++--------------------- 1 file changed, 24 insertions(+), 37 deletions(-) diff --git a/.github/workflows/pyright.yml b/.github/workflows/pyright.yml index eb84117cb3a..d4918e41c38 100644 --- a/.github/workflows/pyright.yml +++ b/.github/workflows/pyright.yml @@ -1,12 +1,11 @@ -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 @@ -18,52 +17,40 @@ 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/install-gh-cli-action@v0.2.0 - with: - gh-cli-version: 2.32.0 + - uses: actions/checkout@v4 - name: Merge CI fixes from sagemath/sage run: | - git config --global --add safe.directory "$GITHUB_WORKSPACE" .ci/merge-fixes.sh + env: + GH_TOKEN: ${{ github.token }} - - name: Add prebuilt tree as a worktree - id: worktree - run: | - set -ex - .ci/retrofit-worktree.sh worktree-image /sage + - name: Cache conda packages + uses: actions/cache@v4 + with: + path: ~/conda_pkgs_dir + key: + ${{ runner.os }}-conda-${{ hashFiles('environment-3.11-linux.yml') }} - - 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 + - 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-${{ matrix.python }}-${{ startsWith(matrix.os, 'macos') && (startsWith(runner.arch, 'ARM') && 'macos' || 'macos-x86_64') || 'linux' }}.yml + + # No need to build sagelib; pyright only needs the libraries from which sagelib imports - name: Static code check with pyright uses: jakebailey/pyright-action@v1 with: version: 1.1.332 - # Many warnings issued by pyright are not yet helpful because there is not yet enough type information. + # 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: From a62be2f5917fc97a83f71df3cb711d48bd98b8bb Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Mon, 6 Jan 2025 01:22:04 +0800 Subject: [PATCH 2/4] fix python version --- .github/workflows/pyright.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pyright.yml b/.github/workflows/pyright.yml index d4918e41c38..4a26f0f5e9c 100644 --- a/.github/workflows/pyright.yml +++ b/.github/workflows/pyright.yml @@ -42,7 +42,7 @@ jobs: channels: conda-forge channel-priority: true activate-environment: sage-dev - environment-file: environment-${{ matrix.python }}-${{ startsWith(matrix.os, 'macos') && (startsWith(runner.arch, 'ARM') && 'macos' || 'macos-x86_64') || 'linux' }}.yml + environment-file: environment-3.11-linux.yml # No need to build sagelib; pyright only needs the libraries from which sagelib imports From a33196a47347b2748d1bb5f785dbc64e1d1ee808 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Mon, 6 Jan 2025 12:30:02 +0800 Subject: [PATCH 3/4] upgrade pyright action --- .github/workflows/pyright.yml | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/.github/workflows/pyright.yml b/.github/workflows/pyright.yml index 4a26f0f5e9c..515765f257c 100644 --- a/.github/workflows/pyright.yml +++ b/.github/workflows/pyright.yml @@ -47,25 +47,10 @@ jobs: # No need to build sagelib; pyright only needs the libraries from which sagelib imports - name: Static code check with pyright - uses: jakebailey/pyright-action@v1 + uses: jakebailey/pyright-action@v2.3.2 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 - - - name: Static code check with pyright (annotated) - if: (success() || failure()) && steps.incremental.outcome == 'success' - uses: jakebailey/pyright-action@v1 - 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 From 1d17022d8fa7868bd2ff33bd6a4066a89cad102b Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Thu, 30 Jan 2025 20:43:23 +0800 Subject: [PATCH 4/4] Readd merge_group trigger to pyright workflow --- .github/workflows/pyright.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pyright.yml b/.github/workflows/pyright.yml index 1141a7d5a49..6e50a61af12 100644 --- a/.github/workflows/pyright.yml +++ b/.github/workflows/pyright.yml @@ -1,6 +1,7 @@ name: Static type check on: + merge_group: push: branches: - master