|
| 1 | +name: Labelbox Python SDK Shared |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + python-version: |
| 7 | + required: true |
| 8 | + type: string |
| 9 | + api-key: |
| 10 | + required: true |
| 11 | + type: string |
| 12 | + da-test-key: |
| 13 | + required: true |
| 14 | + type: string |
| 15 | + test-env: |
| 16 | + required: true |
| 17 | + type: string |
| 18 | + fixture-profile: |
| 19 | + required: true |
| 20 | + type: boolean |
| 21 | +jobs: |
| 22 | + build: |
| 23 | + runs-on: ubuntu-latest |
| 24 | + env: |
| 25 | + # make sure to tell tox to use these environs in tox.ini |
| 26 | + LABELBOX_TEST_API_KEY: ${{ secrets[inputs.api-key] }} |
| 27 | + DA_GCP_LABELBOX_API_KEY: ${{ secrets[inputs.da-test-key] }} |
| 28 | + LABELBOX_TEST_ENVIRON: ${{ inputs.test-env }} |
| 29 | + FIXTURE_PROFILE: ${{ inputs.fixture-profile }} |
| 30 | + steps: |
| 31 | + - name: Cancel previous workflow |
| 32 | + uses: styfle/cancel-workflow-action@0.12.1 |
| 33 | + with: |
| 34 | + access_token: ${{ github.token }} |
| 35 | + |
| 36 | + - uses: actions/checkout@v4 |
| 37 | + with: |
| 38 | + token: ${{ secrets.ACTIONS_ACCESS_TOKEN }} |
| 39 | + ref: ${{ github.head_ref }} |
| 40 | + |
| 41 | + - name: Set up Python ${{ inputs.python-version }} |
| 42 | + uses: actions/setup-python@v5 |
| 43 | + with: |
| 44 | + python-version: ${{ inputs.python-version }} |
| 45 | + cache: "pip" |
| 46 | + |
| 47 | + - name: yapf |
| 48 | + id: yapf |
| 49 | + uses: AlexanderMelde/yapf-action@master |
| 50 | + with: |
| 51 | + args: --verbose --recursive --parallel --style "google" |
| 52 | + - name: dependencies |
| 53 | + run: | |
| 54 | + sudo apt-get -y update |
| 55 | + sudo apt install -y libsm6 \ |
| 56 | + libxext6 \ |
| 57 | + ffmpeg \ |
| 58 | + libfontconfig1 \ |
| 59 | + libxrender1 \ |
| 60 | + libgl1-mesa-glx |
| 61 | + - name: mypy |
| 62 | + run: | |
| 63 | + pip install strenum |
| 64 | + pip install mypy==1.9.0 |
| 65 | + # TODO: consider installing requests typing |
| 66 | + mypy -p labelbox --pretty --show-error-codes --non-interactive --install-types |
| 67 | + - name: Install test dependencies |
| 68 | + run: | |
| 69 | + pip install tox==4.14.1 |
| 70 | + # TODO: replace tox.ini with what the Makefile does |
| 71 | + # to make sure local testing is |
| 72 | + # identical to github actions which uses tox.ini |
| 73 | + - name: Test with tox (unit) |
| 74 | + run: | |
| 75 | + tox -e py -- tests/unit |
| 76 | + - name: Test with tox (integration / data) |
| 77 | + run: | |
| 78 | + tox -e py -- tests/integration tests/data |
0 commit comments