From 026400cb1de8b1f34d690780a3d48d183df34430 Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Fri, 18 Oct 2024 11:04:45 -0400 Subject: [PATCH] ci: replace conda ci setup with poetry --- .github/workflows/ci.yml | 103 +++++++++------------------------------ 1 file changed, 24 insertions(+), 79 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e9282d8b..33db3e4b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -103,109 +103,49 @@ jobs: imagetag="$(nix eval --raw '.#protoletariat-image.imageTag')" docker run --rm "protoletariat:${imagetag}" - conda-ubuntu-macos: + poetry: strategy: fail-fast: false matrix: os: - ubuntu-latest - macos-latest + - windows-latest python-version: - "3.8" - "3.9" - "3.10" - "3.11" + - "3.12" buf: - - buf - include: - - os: ubuntu-latest - python-version: "3.9" - buf: no-buf - - os: macos-latest - python-version: "3.9" - buf: no-buf + - true + - false runs-on: ${{ matrix.os }} - defaults: - run: - shell: bash -l {0} steps: - uses: actions/checkout@v4 - - uses: bufbuild/buf-setup-action@v1.26.1 - if: ${{ matrix.buf == 'buf' }} + - uses: bufbuild/buf-setup-action@v1.45.0 + if: matrix.buf with: github_token: ${{ github.token }} - uses: arduino/setup-protoc@v3 with: - python-version: ${{ matrix.python-version }} - - - run: pip3 install poetry2conda poetry + repo-token: ${{ github.token }} - - name: Generate conda environment file - run: | - set -euo pipefail - - poetry2conda --dev pyproject.toml - | tee environment.yml - - - uses: conda-incubator/setup-miniconda@v2 + - uses: actions/setup-python@v5 with: - mamba-version: "*" - miniforge-variant: Mambaforge - miniforge-version: latest - channel-priority: strict - activate-environment: protoletariat python-version: ${{ matrix.python-version }} - environment-file: environment.yml - - run: mamba install grpc-cpp grpcio-tools - - run: pip install . - - run: pytest -ra - conda-windows: - strategy: - fail-fast: false - matrix: - python-version: - - "3.8" - - "3.9" - - "3.10" - - "3.11" - buf: - - buf - include: - - python-version: "3.9" - buf: no-buf - runs-on: windows-latest - steps: - - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4 - - - uses: bufbuild/buf-setup-action@v1.26.1 - if: ${{ matrix.buf == 'buf' }} - with: - github_token: ${{ github.token }} + - name: install poetry + run: pip install poetry - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - - run: pip3 install poetry2conda poetry + - name: install env + run: poetry install - - name: Generate conda environment file - run: poetry2conda --dev pyproject.toml - > environment.yml - - - uses: conda-incubator/setup-miniconda@v2 - with: - mamba-version: "*" - miniforge-variant: Mambaforge - miniforge-version: latest - channel-priority: strict - activate-environment: protoletariat - python-version: ${{ matrix.python-version }} - environment-file: environment.yml + - name: run tests + run: poetry run pytest -ra - - run: mamba install grpc-cpp grpcio-tools pip - - run: pip install . - - run: pytest -ra tensorflow: runs-on: ubuntu-latest env: @@ -243,7 +183,10 @@ jobs: nix develop -c \ protoc \ --python_out "$PYTHON_OUT" \ - --proto_path "$TENSORFLOW_HOME" "${files[@]}" + --proto_path "$TENSORFLOW_HOME/third_party/xla/third_party/tsl" \ + --proto_path "$TENSORFLOW_HOME/third_party/xla" \ + --proto_path "$TENSORFLOW_HOME" \ + "${files[@]}" - name: Test tensorflow rewriting working-directory: protoletariat @@ -257,7 +200,10 @@ jobs: --create-package \ --python-out "$PYTHON_OUT" \ protoc \ - --proto-path "$TENSORFLOW_HOME" "${files[@]}" + --proto-path "$TENSORFLOW_HOME/third_party/xla/third_party/tsl" \ + --proto-path "$TENSORFLOW_HOME/third_party/xla" \ + --proto-path "$TENSORFLOW_HOME" \ + "${files[@]}" - name: Check for absolute imports run: grep -vq -R '^import tensorflow' "$PYTHON_OUT" @@ -297,8 +243,7 @@ jobs: if: ${{ github.event_name != 'pull_request' }} needs: - nix - - conda-ubuntu-macos - - conda-windows + - poetry - docker-image - pre-commit - tensorflow