|
7 | 7 | branches: [develop, master] |
8 | 8 |
|
9 | 9 | jobs: |
10 | | - build: |
11 | | - runs-on: ubuntu-latest |
| 10 | + build-prod: |
12 | 11 | strategy: |
13 | 12 | fail-fast: false |
14 | 13 | matrix: |
15 | 14 | include: |
16 | 15 | - python-version: 3.8 |
17 | | - prod-key: PROD_LABELBOX_API_KEY_2 |
18 | | - staging-key: STAGING_LABELBOX_API_KEY_2 |
| 16 | + api-key: PROD_LABELBOX_API_KEY_2 |
19 | 17 | da-test-key: DA_GCP_LABELBOX_API_KEY |
20 | 18 | - python-version: 3.9 |
21 | | - prod-key: PROD_LABELBOX_API_KEY_3 |
22 | | - staging-key: STAGING_LABELBOX_API_KEY_3 |
| 19 | + api-key: PROD_LABELBOX_API_KEY_3 |
23 | 20 | da-test-key: DA_GCP_LABELBOX_API_KEY |
24 | 21 | - python-version: "3.10" |
25 | | - prod-key: PROD_LABELBOX_API_KEY_4 |
26 | | - staging-key: STAGING_LABELBOX_API_KEY_4 |
| 22 | + api-key: PROD_LABELBOX_API_KEY_4 |
27 | 23 | da-test-key: DA_GCP_LABELBOX_API_KEY |
28 | 24 | - python-version: 3.11 |
29 | | - prod-key: LABELBOX_API_KEY |
30 | | - staging-key: STAGING_LABELBOX_API_KEY |
| 25 | + api-key: LABELBOX_API_KEY |
31 | 26 | da-test-key: DA_GCP_LABELBOX_API_KEY |
32 | 27 | - python-version: 3.12 |
33 | | - prod-key: PROD_LABELBOX_API_KEY_5 |
34 | | - staging-key: STAGING_LABELBOX_API_KEY_5 |
| 28 | + api-key: PROD_LABELBOX_API_KEY_5 |
35 | 29 | da-test-key: DA_GCP_LABELBOX_API_KEY |
36 | | - |
37 | | - env: |
38 | | - cache-key: testmon=${{ github.ref_name }}-${{ matrix.python-version }} |
39 | | - steps: |
40 | | - - name: Cancel previous workflow |
41 | | - uses: styfle/cancel-workflow-action@0.12.1 |
42 | | - with: |
43 | | - access_token: ${{ github.token }} |
44 | | - |
45 | | - - name: set environment for branch |
46 | | - run: | |
47 | | - if [[ "${{github.base_ref}}" == "master" || "${{github.ref}}" == "refs/heads/master" ]]; then |
48 | | - echo "LABELBOX_TEST_ENVIRON=prod" >> $GITHUB_ENV |
49 | | - else |
50 | | - echo "LABELBOX_TEST_ENVIRON=staging" >> $GITHUB_ENV |
51 | | - echo "FIXTURE_PROFILE=true" >> $GITHUB_ENV |
52 | | - fi |
53 | | -
|
54 | | - - uses: actions/checkout@v4 |
55 | | - with: |
56 | | - token: ${{ secrets.ACTIONS_ACCESS_TOKEN }} |
57 | | - ref: ${{ github.head_ref }} |
58 | | - |
59 | | - - name: Set up Python ${{ matrix.python-version }} |
60 | | - uses: actions/setup-python@v5 |
61 | | - with: |
62 | | - python-version: ${{ matrix.python-version }} |
63 | | - cache: "pip" |
64 | | - |
65 | | - - name: yapf |
66 | | - id: yapf |
67 | | - uses: AlexanderMelde/yapf-action@master |
68 | | - with: |
69 | | - args: --verbose --recursive --parallel --style "google" |
70 | | - - name: dependencies |
71 | | - run: | |
72 | | - sudo apt-get -y update |
73 | | - sudo apt install -y libsm6 \ |
74 | | - libxext6 \ |
75 | | - ffmpeg \ |
76 | | - libfontconfig1 \ |
77 | | - libxrender1 \ |
78 | | - libgl1-mesa-glx |
79 | | - - name: mypy |
80 | | - run: | |
81 | | - pip install strenum |
82 | | - pip install mypy==1.9.0 |
83 | | - # TODO: consider installing requests typing |
84 | | - mypy -p labelbox --pretty --show-error-codes --non-interactive --install-types |
85 | | - - name: Install test dependencies |
86 | | - run: | |
87 | | - pip install tox==4.14.1 |
88 | | - # TODO: replace tox.ini with what the Makefile does |
89 | | - # to make sure local testing is |
90 | | - # identical to github actions which uses tox.ini |
91 | | - - name: Test with tox (unit) |
92 | | - env: |
93 | | - # make sure to tell tox to use these environs in tox.ini |
94 | | - LABELBOX_TEST_API_KEY_PROD: ${{ secrets[matrix.prod-key] }} |
95 | | - LABELBOX_TEST_API_KEY_STAGING: ${{ secrets[matrix.staging-key] }} |
96 | | - DA_GCP_LABELBOX_API_KEY: ${{ secrets[matrix.da-test-key] }} |
97 | | - run: | |
98 | | - tox -e py -- tests/unit |
99 | | - - name: Test with tox (integration / data) |
100 | | - env: |
101 | | - # make sure to tell tox to use these environs in tox.ini |
102 | | - LABELBOX_TEST_API_KEY_PROD: ${{ secrets[matrix.prod-key] }} |
103 | | - LABELBOX_TEST_API_KEY_STAGING: ${{ secrets[matrix.staging-key] }} |
104 | | - DA_GCP_LABELBOX_API_KEY: ${{ secrets[matrix.da-test-key] }} |
105 | | - run: | |
106 | | - tox -e py -- tests/integration tests/data |
| 30 | + uses: ./.github/workflows/python-package-shared.yml |
| 31 | + with: |
| 32 | + python-version: ${{ matrix.python-version }} |
| 33 | + api-key: ${{ matrix.api-key }} |
| 34 | + da-test-key: ${{ matrix.da-test-key }} |
| 35 | + fixture-profile: false |
| 36 | + test-env: 'prod' |
| 37 | + secrets: inherit |
| 38 | + build-staging: |
| 39 | + if: ${{ github.event_name }} == 'pull_request' |
| 40 | + strategy: |
| 41 | + fail-fast: false |
| 42 | + matrix: |
| 43 | + include: |
| 44 | + - python-version: 3.8 |
| 45 | + api-key: STAGING_LABELBOX_API_KEY_2 |
| 46 | + da-test-key: DA_GCP_LABELBOX_API_KEY |
| 47 | + - python-version: 3.9 |
| 48 | + api-key: STAGING_LABELBOX_API_KEY_3 |
| 49 | + da-test-key: DA_GCP_LABELBOX_API_KEY |
| 50 | + - python-version: "3.10" |
| 51 | + api-key: STAGING_LABELBOX_API_KEY_4 |
| 52 | + da-test-key: DA_GCP_LABELBOX_API_KEY |
| 53 | + - python-version: 3.11 |
| 54 | + api-key: STAGING_LABELBOX_API_KEY |
| 55 | + da-test-key: DA_GCP_LABELBOX_API_KEY |
| 56 | + - python-version: 3.12 |
| 57 | + api-key: STAGING_LABELBOX_API_KEY_5 |
| 58 | + da-test-key: DA_GCP_LABELBOX_API_KEY |
| 59 | + uses: ./.github/workflows/python-package-shared.yml |
| 60 | + with: |
| 61 | + python-version: ${{ matrix.python-version }} |
| 62 | + api-key: ${{ matrix.api-key }} |
| 63 | + da-test-key: ${{ matrix.da-test-key }} |
| 64 | + fixture-profile: true |
| 65 | + test-env: 'staging' |
| 66 | + secrets: inherit |
0 commit comments