High-level Client with Image Handling etc. #40
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Test | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| build-and-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Initialize submodules | |
| env: | |
| GIT_ASKPASS: /bin/echo | |
| GH_PAT: ${{ secrets.GH_PAT }} | |
| run: | | |
| git config --global url."https://${GH_PAT}@github.com/".insteadOf "https://github.com/" | |
| git submodule update --init --recursive | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v6 | |
| with: | |
| enable-cache: true | |
| - name: Set up Python | |
| run: uv python install | |
| - name: Install the project | |
| run: uv sync --locked --all-extras --dev | |
| - name: Ensure no differences in generated code | |
| run: | | |
| source .venv/bin/activate | |
| GENERATED_DIR="src/athena_client/generated" | |
| BACKUP_DIR="src/athena_client/generated_backup" | |
| cp -r $GENERATED_DIR $BACKUP_DIR | |
| ./scripts/compile_proto.sh || (echo "Protobuf compilation failed. Ensure submodules are initialized and the proto file exists." && exit 1) | |
| # Fix imports in generated files | |
| if [[ -f "$GENERATED_DIR/athena/athena_pb2_grpc.py" && -f "$GENERATED_DIR/athena/athena_pb2.py" ]]; then | |
| sed -i "$GENERATED_DIR/athena/athena_pb2_grpc.py" -e 's/^from athena /from athena_client.generated.athena /' | |
| sed -i "$GENERATED_DIR/athena/athena_pb2.py" -e 's/^from athena /from athena_client.generated.athena /' | |
| else | |
| echo "Error: Expected files not found in $GENERATED_DIR/athena" | |
| exit 1 | |
| fi | |
| diff -r $GENERATED_DIR $BACKUP_DIR || (echo "Generated code differs. Please commit the changes after running compile_proto.sh." && exit 1) | |
| rm -rf $BACKUP_DIR | |
| - name: Run linter | |
| run: | | |
| uv run ruff check | |
| - name: Run code formatting check | |
| run: | | |
| uv run ruff format --check | |
| - name: Run type checking | |
| run: | | |
| uv run pyright | |
| - name: Run tests | |
| run: | | |
| uv run pytest --junitxml=pytest.xml --tb=auto --cov-report=term-missing:skip-covered --cov=src tests/ | tee pytest-coverage.txt | |
| - name: Pytest Coverage Comment | |
| uses: MishaKav/pytest-coverage-comment@v1.1.56 | |
| with: | |
| junitxml-path: ./pytest.xml | |
| - name: Upload test results | |
| uses: actions/upload-artifact@v4 # upload test results | |
| if: ${{ !cancelled() }} # run this step even if previous step failed | |
| with: | |
| name: test-results | |
| path: pytest.xml | |
| - name: Build package | |
| run: | | |
| uv build |