Skip to content

Commit

Permalink
turns out theres no way to tell github actions to use a different nod…
Browse files Browse the repository at this point in the history
…e binary even if its added to PATH
  • Loading branch information
DetachHead committed Feb 24, 2025
1 parent dd6875f commit 3f850b8
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 16 deletions.
11 changes: 5 additions & 6 deletions .github/workflows/build_and_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,11 @@ jobs:

- run: ./pw uv sync --config-setting regenerate_docstubs=false

# using relative path for npm scripts because it needs to work in the package directories too
- name: add pyprojectx and npm scripts to PATH

# ideally we would do the same thing with ./node_modules/.bin to ensure that the version of node from nodejs-wheel
# is always used, but it seems to be impossible to prevent github actions from using its own node version
- name: add pyprojectx to PATH
run: |
realpath ./.pyprojectx/main >> $GITHUB_PATH
echo ./node_modules/.bin >> $GITHUB_PATH
# ideally this should be run with the rest of the pytest tests in the validation workflow,
# but they depend on the docstubs generated in the previous job
Expand All @@ -118,7 +117,7 @@ jobs:

- name: set version for npm packages
if: github.ref == 'refs/heads/main'
run: npm version ${{ steps.current-version.outputs.CURRENT_VERSION }} --workspaces --no-git-tag-version
run: uv run npm version ${{ steps.current-version.outputs.CURRENT_VERSION }} --workspaces --no-git-tag-version

- name: Build VSIX
working-directory: ${{ env.VSIX_DIR }}
Expand Down Expand Up @@ -176,7 +175,7 @@ jobs:
# i think to fix that i need to rewrite pdm_build.py to use the build hooks so we can control it more easily, but i can't get that to work soooo
- name: set npm package versions back to upstream so pypi package can use it in --version output
if: github.ref == 'refs/heads/main'
run: npm version ${{ steps.current-version.outputs.CURRENT_UPSTREAM_VERSION }} --workspaces --no-git-tag-version
run: uv run npm version ${{ steps.current-version.outputs.CURRENT_UPSTREAM_VERSION }} --workspaces --no-git-tag-version

- name: build package - pypi
run: uv build --config-setting regenerate_docstubs=false
Expand Down
17 changes: 8 additions & 9 deletions .github/workflows/validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,26 +57,25 @@ jobs:

- run: ./pw uv sync

# using relative path for npm scripts because it needs to work in the package directories too
- name: add pyprojectx and npm scripts to PATH (linux)
# ideally we would do the same thing with ./node_modules/.bin to ensure that the version of node from nodejs-wheel
# is always used, but it seems to be impossible to prevent github actions from using its own node version
- name: add pyprojectx to PATH (linux)
if: runner.os != 'Windows'
run: |
realpath ./.pyprojectx/main >> $GITHUB_PATH
echo ./node_modules/.bin >> $GITHUB_PATH
- name: add pyprojectx and npm scripts to PATH (windows)
- name: add pyprojectx to PATH (windows)
if: runner.os == 'Windows'
run: |
echo (resolve-path "./.pyprojectx/main").path | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "./node_modules/.bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: python tests
run: uv run npm run test-python -- -m "not needs_all_docstubs"

- name: npm test (pyright-internal)
run: npm test
run: uv run npm test
working-directory: packages/pyright-internal

# TODO: all tests run in a venv now so i dont think any of this stuff is needed anymore
- name: Create Venv
run: |
${{ steps.install_python.outputs.python-path }} -m venv .venv
Expand All @@ -102,13 +101,13 @@ jobs:
env:
CI_IMPORT_TEST_VENVPATH: '../../'
CI_IMPORT_TEST_VENV: '.venv'
run: npm run test:imports
run: uv run npm run test:imports
working-directory: packages/pyright-internal

- name: Run import tests with pythonpath
env:
CI_IMPORT_TEST_PYTHONPATH: ${{env.python_venv_path}}
run: npm run test:imports
run: uv run npm run test:imports
working-directory: packages/pyright-internal

required:
Expand Down
1 change: 1 addition & 0 deletions packages/pyright-internal/src/tests/importResolver.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ describe('Import tests with fake venv', () => {
afterAll(() => tempFile.dispose());

if (!usingTrueVenv()) {
// TODO: investigate these tests. idk why it says they cant run in a venv because they seem to pass either way
describe('Import tests that cannot run in a true venv', () => {
test('partial stub file exists', () => {
const files = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def func1(v: A.Inner | None):


def func2(v: A.Inner | B.Inner | None):
reveal_type(v, expected_text="typePrinter1.A.Inner | typePrinter1.B.Inner | None")
reveal_type(v, expected_text="packages.pyright-internal.src.tests.samples.typePrinter1.A.Inner | packages.pyright-internal.src.tests.samples.typePrinter1.B.Inner | None")


class IntOrStr:
Expand Down

0 comments on commit 3f850b8

Please sign in to comment.