|
|
|
name: Python Tests
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
workflow_dispatch:
|
|
|
|
|
|
|
|
env:
|
|
|
|
DOCKER_IMAGE: gcr.io/protobuf-build/bazel/linux@sha256:05a41edee21f620445ca01c46b9d33be2e4d06c3d8adced4341ac5abea754baa
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build_wheels:
|
|
|
|
name: Build Wheels
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Set up Cloud SDK
|
|
|
|
uses: google-github-actions/auth@v0
|
|
|
|
with:
|
|
|
|
credentials_json: ${{ secrets.GOOGLE_CREDENTIALS }}
|
|
|
|
export_environment_variables: true
|
|
|
|
|
|
|
|
- name: Use gcloud CLI
|
|
|
|
run: gcloud info
|
|
|
|
- name: Configure Docker
|
|
|
|
run: gcloud auth configure-docker
|
|
|
|
- name: Pull Docker Image
|
|
|
|
run: docker pull $DOCKER_IMAGE
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Build Wheels
|
|
|
|
run: cd ${{ github.workspace }} && docker run -v$PWD:/workspace $DOCKER_IMAGE build --crosstool_top=@com_google_protobuf//toolchain:clang_suite --symlink_prefix=/ -c opt python/dist
|
|
|
|
- name: Move Wheels
|
|
|
|
run: mkdir wheels && find _build/out -name 'protobuf*.whl' -exec mv '{}' wheels ';'
|
|
|
|
- uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: python-wheels
|
|
|
|
path: wheels/
|
|
|
|
|
|
|
|
test_wheels:
|
|
|
|
name: Test Wheels
|
|
|
|
needs: build_wheels
|
|
|
|
strategy:
|
|
|
|
fail-fast: false # Don't cancel all jobs if one fails.
|
|
|
|
matrix:
|
|
|
|
# TODO: add macos once we are building Darwin wheels.
|
|
|
|
os: [ubuntu-18.04, ubuntu-latest, windows-latest]
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
shell: bash
|
|
|
|
steps:
|
|
|
|
- name: Download Wheels
|
|
|
|
uses: actions/download-artifact@v3
|
|
|
|
with:
|
|
|
|
name: python-wheels
|
|
|
|
path: wheels
|
|
|
|
- uses: actions/setup-python@v2
|
|
|
|
with:
|
|
|
|
python-version: 3.8
|
|
|
|
- name: Setup Python venv
|
|
|
|
run: |
|
|
|
|
python -m pip install --upgrade pip
|
|
|
|
python -m venv env
|
|
|
|
# Windows uses 'Scripts' instead of 'bin'
|
|
|
|
source env/bin/activate || source env/Scripts/activate
|
|
|
|
echo "VIRTUAL ENV:" $VIRTUAL_ENV
|
|
|
|
- name: Install Wheels
|
|
|
|
run: pip install -vvv --no-index --find-links wheels protobuf
|
|
|
|
- name: Test that module is importable
|
|
|
|
run: python -c 'from google._upb import _message; assert "google._upb._message.MessageMeta" in str(_message.MessageMeta)'
|