Skip to content

Commit

Permalink
ci: replace conda ci setup with poetry
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud committed Oct 18, 2024
1 parent 5243af0 commit 026400c
Showing 1 changed file with 24 additions and 79 deletions.
103 changes: 24 additions & 79 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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"
Expand Down Expand Up @@ -297,8 +243,7 @@ jobs:
if: ${{ github.event_name != 'pull_request' }}
needs:
- nix
- conda-ubuntu-macos
- conda-windows
- poetry
- docker-image
- pre-commit
- tensorflow
Expand Down

0 comments on commit 026400c

Please sign in to comment.