From 65a36ed7bb5deb39e0f9252ea522eb14f439fef6 Mon Sep 17 00:00:00 2001 From: Joaquin Matres <4514346+joamatab@users.noreply.github.com> Date: Sat, 7 Dec 2024 08:53:54 -0800 Subject: [PATCH] use uv --- .github/workflows/pages.yml | 26 +++++++++---------- .github/workflows/test_code.yml | 45 ++++----------------------------- Makefile | 8 +++--- 3 files changed, 23 insertions(+), 56 deletions(-) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 3e8fd1f4..c1cbcc3e 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -1,10 +1,13 @@ -name: Build docs - +name: build docs on: + pull_request: push: branches: - main workflow_dispatch: +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true jobs: build-docs: @@ -18,19 +21,17 @@ jobs: ~/.gdsfactory/ key: 0.0.1 restore-keys: 0.0.1 - - uses: mamba-org/setup-micromamba@v1 - with: - micromamba-version: '1.3.1-0' - init-shell: bash - - name: Install dependencies and build docs + - name: Install + env: + SIMCLOUD_APIKEY: ${{ secrets.SIMCLOUD_APIKEY }} + GDSFACTORY_DISPLAY_TYPE: klayout + run: | + make uv install test-data + - name: Build docs env: SIMCLOUD_APIKEY: ${{ secrets.SIMCLOUD_APIKEY }} GDSFACTORY_DISPLAY_TYPE: klayout run: | - eval "$(micromamba shell hook --shell=bash)" - micromamba activate - micromamba install -c conda-forge pymeep=*=mpi_mpich_* nlopt -y - make dev test-data make docs - name: Upload artifact uses: actions/upload-pages-artifact@v3 @@ -38,14 +39,13 @@ jobs: path: "./docs/_build/html/" deploy-docs: needs: build-docs + if: ${{ github.ref == 'refs/heads/main' }} permissions: pages: write id-token: write - environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} - runs-on: ubuntu-latest steps: - name: Deploy to GitHub Pages diff --git a/.github/workflows/test_code.yml b/.github/workflows/test_code.yml index 1c8f96c7..93d51ace 100644 --- a/.github/workflows/test_code.yml +++ b/.github/workflows/test_code.yml @@ -41,13 +41,13 @@ jobs: key: ${{ hashFiles('pyproject.toml') }} - name: Install dependencies run: | - pip install -e .[${{ matrix.plugin }},dev] - pip install git+https://github.com/gdsfactory/gdsfactory --force-reinstall + make uv + uv pip install -e .[${{ matrix.plugin }},dev] - name: Test with pytest env: SIMCLOUD_APIKEY: ${{ secrets.SIMCLOUD_APIKEY }} GDSFACTORY_DISPLAY_TYPE: klayout - run: pytest gplugins/${{ matrix.plugin }} + run: uv run pytest gplugins/${{ matrix.plugin }} test_code_conda: runs-on: ubuntu-latest steps: @@ -105,45 +105,10 @@ jobs: SIMCLOUD_APIKEY: ${{ secrets.SIMCLOUD_APIKEY }} GDSFACTORY_DISPLAY_TYPE: klayout run: | - eval "$(micromamba shell hook --shell=bash)" - micromamba activate - micromamba install -c conda-forge pymeep=*=mpi_mpich_* nlopt -y - make dev - pip freeze > requirements.txt - pytest --cov=gplugins + make uv install + uv run pytest --cov=gplugins - name: Upload coverage to Codecov uses: codecov/codecov-action@v4 with: token: ${{ secrets.CODECOV_TOKEN }} fail_ci_if_error: false - test_docs: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/cache@v4 - with: - path: | - ~/.gdsfactory/ - key: 0.0.1 - restore-keys: 0.0.1 - - uses: mamba-org/setup-micromamba@v1 - with: - micromamba-version: "1.3.1-0" - init-shell: bash - - name: Install dependencies and build docs - env: - SIMCLOUD_APIKEY: ${{ secrets.SIMCLOUD_APIKEY }} - GDSFACTORY_DISPLAY_TYPE: klayout - run: | - eval "$(micromamba shell hook --shell=bash)" - micromamba activate - micromamba install -c conda-forge pymeep=*=mpi_mpich_* nlopt -y - make test-data - make dev - make docs - - name: Expose docs artifact - uses: actions/upload-artifact@v4 - if: always() - with: - name: docs - path: docs/_build/html/ diff --git a/Makefile b/Makefile index 90eac1be..a7a2cd29 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,9 @@ +uv: + curl -LsSf https://astral.sh/uv/install.sh | sh + install: - pip install -e .[dev,docs,devsim,femwell,gmsh,klayout,meow,meshwell,ray,sax,schematic,tidy3d,vlsir] - pip install git+https://github.com/gdsfactory/gdsfactory --force-reinstall - pre-commit install + uv pip install -e .[dev,docs,devsim,femwell,gmsh,klayout,meow,meshwell,ray,sax,schematic,tidy3d,vlsir] + uv run pre-commit install dev: test-data gmsh elmer install