-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Two changes: added file_output component and a cleaner way for a comp…
…onent to discard a message (#22) * Added file_output component * Fixed timer_input component issue that caused the timer interval to shrink over time
- Loading branch information
Showing
12 changed files
with
190 additions
and
215 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,61 +9,35 @@ on: | |
permissions: | ||
id-token: write | ||
checks: write | ||
issues: read | ||
pull-requests: write | ||
contents: write | ||
|
||
jobs: | ||
test: | ||
ci: | ||
uses: SolaceDev/solace-public-workflows/.github/workflows/[email protected] | ||
secrets: | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
SONAR_HOST_URL: ${{ vars.SONAR_HOST_URL }} | ||
structure-test: | ||
name: Test Docker Image Structure | ||
runs-on: ubuntu-latest | ||
env: | ||
HATCH_CACHE_DIR: ${{ github.workspace }}/.hatch_cache | ||
HATCH_DATA_DIR: ${{ github.workspace }}/.hatch_data | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
ssh-key: ${{ secrets.COMMIT_KEY }} | ||
|
||
- name: Install Hatch | ||
uses: pypa/hatch@install | ||
|
||
- name: Restore Hatch Directory | ||
uses: actions/cache/restore@v4 | ||
id: cache-restore | ||
with: | ||
path: | | ||
${{ env.HATCH_CACHE_DIR }} | ||
${{ env.HATCH_DATA_DIR }} | ||
key: ${{ runner.os }}-hatch-${{ hashFiles('pyproject.toml','requirements.txt') }} | ||
|
||
- name: Install Dependencies | ||
if: steps.cache-restore.outputs.cache-hit != 'true' | ||
run: | | ||
hatch python install 3.8 3.12 | ||
- name: Install Dependencies | ||
if: steps.cache-restore.outputs.cache-hit != 'true' | ||
run: | | ||
hatch env create test | ||
- name: Cache Hatch Directory | ||
uses: actions/cache/save@v4 | ||
if: steps.cache-restore.outputs.cache-hit != 'true' | ||
id: cache-hatch | ||
with: | ||
path: | | ||
${{ env.HATCH_CACHE_DIR }} | ||
${{ env.HATCH_DATA_DIR }} | ||
key: ${{ runner.os }}-hatch-${{ hashFiles('pyproject.toml','requirements.txt') }} | ||
- name: Set up Hatch | ||
uses: SolaceDev/solace-public-workflows/.github/actions/[email protected] | ||
|
||
- name: Set up Docker Buildx | ||
- name: Set Up Docker Buildx | ||
id: builder | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Prepare env file | ||
run: | | ||
cp .env_template .env | ||
shell: bash | ||
- name: Build Docker Image | ||
uses: docker/build-push-action@v6 | ||
|
@@ -74,84 +48,7 @@ jobs: | |
builder: ${{ steps.builder.outputs.name }} | ||
load: true | ||
|
||
- name: Run Lint | ||
continue-on-error: true | ||
run: | | ||
hatch run lint:ruff check -o lint.json --output-format json | ||
shell: bash | ||
|
||
- name: Run Structured Tests | ||
run: | | ||
hatch run +py=312 test:make structure-test | ||
- name: Run Structure Tests | ||
shell: bash | ||
|
||
- name: Run Unit Tests | ||
shell: bash | ||
run: | | ||
hatch test --cover --all --parallel --junitxml=junit.xml | ||
- name: Combine Coverage Reports | ||
continue-on-error: true | ||
run: | | ||
hatch run +py=312 test:coverage combine | ||
shell: bash | ||
|
||
- name: Report coverage | ||
run: | | ||
hatch run +py=312 test:coverage xml | ||
shell: bash | ||
|
||
- name: SonarQube Scan | ||
if: always() && github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository | ||
uses: sonarsource/[email protected] | ||
env: | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
SONAR_HOST_URL: ${{ vars.SONAR_HOST_URL }} | ||
with: | ||
args: > | ||
-Dsonar.tests=tests/ | ||
-Dsonar.verbose=true | ||
-Dsonar.sources=src/ | ||
-Dsonar.projectKey=${{github.repository_owner}}_${{github.event.repository.name}} | ||
-Dsonar.python.coverage.reportPaths=coverage.xml | ||
-Dsonar.python.ruff.reportPaths=lint.json | ||
- name: SonarQube Quality Gate check | ||
id: sonarqube-quality-gate-check | ||
if: always() && github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository | ||
uses: sonarsource/sonarqube-quality-gate-action@master | ||
env: | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
SONAR_HOST_URL: ${{ vars.SONAR_HOST_URL }} | ||
|
||
# Build and verify packages | ||
- name: Build | ||
run: hatch build | ||
|
||
- name: Verify Packages | ||
run: | | ||
ls dist/*.tar.gz | hatch run +py=312 test:xargs -n1 twine check | ||
ls dist/*.whl | hatch run +py=312 test:xargs -n1 twine check | ||
shell: bash | ||
|
||
- name: Surface failing tests | ||
if: always() | ||
uses: pmeier/pytest-results-action@main | ||
with: | ||
# A list of JUnit XML files, directories containing the former, and wildcard | ||
# patterns to process. | ||
# See @actions/glob for supported patterns. | ||
path: junit.xml | ||
|
||
# (Optional) Add a summary of the results at the top of the report | ||
summary: true | ||
|
||
# (Optional) Select which results should be included in the report. | ||
# Follows the same syntax as `pytest -r` | ||
display-options: fEX | ||
|
||
# (Optional) Fail the workflow if no JUnit XML was found. | ||
fail-on-empty: true | ||
|
||
# (Optional) Title of the test results section in the workflow summary | ||
title: Unit Test results | ||
hatch run make structure-test |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,71 +7,19 @@ on: | |
required: true | ||
description: "Version bump type" | ||
options: | ||
- patch | ||
- minor | ||
- major | ||
- patch | ||
- minor | ||
- major | ||
|
||
permissions: | ||
id-token: write | ||
checks: write | ||
|
||
jobs: | ||
release: | ||
name: Release | ||
timeout-minutes: 20 | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: pypi | ||
url: https://pypi.org/p/solace_ai_connector | ||
permissions: | ||
id-token: write | ||
contents: write | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
ssh-key: ${{ secrets.COMMIT_KEY }} | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.x' | ||
|
||
- name: Install hatch | ||
run: | | ||
pip install --upgrade pip | ||
pip install hatch | ||
- name: Get Current Version | ||
run: | | ||
CURRENT_VERSION=$(hatch version) | ||
echo "CURRENT_VERSION=${CURRENT_VERSION}" >> $GITHUB_ENV | ||
- name: Fail if the current version doesn't exist | ||
if: env.CURRENT_VERSION == '' | ||
run: exit 1 | ||
|
||
- name: Build project for distribution | ||
run: hatch build | ||
|
||
- name: Publish package distributions to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
|
||
- name: Create Release | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
artifacts: "dist/*.whl" | ||
makeLatest: true | ||
generateReleaseNotes: true | ||
tag: ${{ env.CURRENT_VERSION }} | ||
|
||
- name: Bump Version | ||
run: | | ||
hatch version "${{ github.event.inputs.version }}" | ||
NEW_VERSION=$(hatch version) | ||
echo "NEW_VERSION=${NEW_VERSION}" >> $GITHUB_ENV | ||
- name: Commit new version | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "GitHub Action" | ||
git commit -a -m "[ci skip] Bump version to $NEW_VERSION" | ||
git push | ||
uses: SolaceDev/solace-public-workflows/.github/workflows/[email protected] | ||
with: | ||
version: ${{ github.event.inputs.version }} | ||
pypi-project: solace-ai-connector | ||
secrets: | ||
COMMIT_KEY: ${{ secrets.COMMIT_KEY }} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# FileOutput | ||
|
||
File output component | ||
|
||
## Configuration Parameters | ||
|
||
```yaml | ||
component_name: <user-supplied-name> | ||
component_module: file_output | ||
component_config: | ||
``` | ||
No configuration parameters | ||
## Component Input Schema | ||
``` | ||
{ | ||
content: <string>, | ||
file_path: <string>, | ||
mode: <string> | ||
} | ||
``` | ||
| Field | Required | Description | | ||
| --- | --- | --- | | ||
| content | True | | | ||
| file_path | True | The path to the file to write to | | ||
| mode | False | The mode to open the file in: w (write), a (append). Default is w. | |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,5 +22,9 @@ component_config: | |
## Component Output Schema | ||
``` | ||
|
||
<<<<<<< HEAD | ||
<None> | ||
======= | ||
<any> | ||
>>>>>>> origin/main | ||
``` |
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.