Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce PR labeler workflow and config #392

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
Rest-Clients:
- changed-files:
- any-glob-to-any-file:
- 'geti_sdk/rest_clients/**'
- 'tests/pre-merge/integration/rest_clients/*'

HTTP-Session:
- changed-files:
- any-glob-to-any-file:
- 'geti_sdk/http_session/*'
- 'tests/pre-merge/integration/http_session/*'

SDK-Core:
- changed-files:
- any-glob-to-any-file:
- 'geti_sdk/geti.py'
- 'tests/pre-merge/integration/test_geti.py'

Geti-Utils:
- changed-files:
- any-glob-to-any-file:
- 'geti_sdk/utils/*'
- 'tests/pre-merge/integration/utils/*'

Documentation:
- changed-files:
- any-glob-to-any-file:
- 'docs/**'

Notebooks:
- changed-files:
- any-glob-to-any-file:
- 'notebooks/**'
12 changes: 12 additions & 0 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: "Pull Request Labeler"
on:
- pull_request_target

jobs:
labeler:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v5
33 changes: 30 additions & 3 deletions .github/workflows/record-vcr-cassettes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,20 @@ name: Record and push VCR cassettes

on:
workflow_dispatch: # run on request (no need for PR)
pull_request:
branches:
- main
types:
- labeled

env:
GETI_USERNAME: ${{ secrets.GETI_USERNAME }}
GETI_PASSWORD: ${{ secrets.GETI_PASSWORD }}
# Python version
PYTHON_VERSION: 3.9
PYTHON_VERSION: "3.10"

# Other environment variables used in the tests
TEST_TARGET: "tests/pre-merge/integration"
TEST_MODE: "RECORD"
REPORT_DIRECTORY: reports
VIRTUALENV_DIRECTORY: .venv
Expand All @@ -24,6 +30,27 @@ jobs:
runs-on: [self-hosted, sdk-runner]

steps:
- id: label-the-PR
if: github.event_name == 'pull_request'
uses: actions/labeler@v5

- name: Smart CI
if: github.event_name == 'pull_request'
run: |
export TEST_TARGET=""
if [[ ${{ contains(steps.label-the-PR.outputs.all-labels, 'SDK-Core') }} ]]; then
export TEST_TARGET="tests/pre-merge/integration/test_geti.py $TEST_TARGET"
fi
if [[ ${{ contains(steps.label-the-PR.outputs.all-labels, 'Rest-Clients') }} ]]; then
export TEST_TARGET="tests/pre-merge/integration/rest_clients/ $TEST_TARGET"
fi
if [[ ${{ contains(steps.label-the-PR.outputs.all-labels, 'HTTP-Session') }} ]]; then
export TEST_TARGET="tests/pre-merge/integration/http_session/ $TEST_TARGET"
fi
if [[ ${{ contains(steps.label-the-PR.outputs.all-labels, 'Geti-Utils') }} ]]; then
export TEST_TARGET="tests/pre-merge/integration/utils/ $TEST_TARGET"
fi

- name: Checkout repository
uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -51,7 +78,7 @@ jobs:
export NO_PROXY=$GETI_HOST,$NO_PROXY
export GETI_HOST=https://$GETI_HOST

pytest tests/pre-merge/integration --html=$REPORT_DIRECTORY/integration_test_report_legacy.html --self-contained-html
pytest $TEST_TARGET --html=$REPORT_DIRECTORY/integration_test_report_legacy.html --self-contained-html
env:
# Login details for the Geti instance to run the tests against
# Secrets are configured on the repository level (Settings > Secrets)
Expand All @@ -67,7 +94,7 @@ jobs:
export NO_PROXY=$GETI_HOST,$NO_PROXY
export GETI_HOST=https://$GETI_HOST

pytest tests/pre-merge/integration --html=$REPORT_DIRECTORY/integration_test_report_develop.html --self-contained-html
pytest $TEST_TARGET --html=$REPORT_DIRECTORY/integration_test_report_develop.html --self-contained-html
env:
# Login details for the Geti instance to run the tests against
# Secrets are configured on the repository level (Settings > Secrets)
Expand Down
Loading