Split taskfiles by components #232
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
# Copyright AGNTCY Contributors (https://github.com/agntcy) | |
# SPDX-License-Identifier: Apache-2.0 | |
name: test-samples | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: ${{ !contains(github.ref, 'release/')}} | |
jobs: | |
detect-changes: | |
runs-on: ubuntu-latest | |
outputs: | |
apps-changed: ${{ steps.detect-changes.outputs.changed-dirs }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Detect changes | |
uses: ./.github/actions/detect-changes | |
id: detect-changes | |
with: | |
dirs: $(find ./samples -mindepth 2 \( -name 'pyproject.toml' -o -name 'Taskfile.yml' \) | xargs -n1 dirname | sort -u) | |
test: | |
name: Test on samples | |
runs-on: ubuntu-latest | |
needs: [detect-changes] | |
if: ${{ needs.detect-changes.outputs.apps-changed != '[]' && needs.detect-changes.outputs.apps-changed != '' }} | |
strategy: | |
fail-fast: false | |
matrix: | |
app: ${{ fromJson(needs.detect-changes.outputs.apps-changed) }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Environment | |
uses: ./.github/actions/setup-env | |
with: | |
python: true | |
python-version: "3.12.9" | |
go: false | |
- name: Setup K8S Tools | |
uses: ./.github/actions/setup-k8s | |
with: | |
kind-version: "0.25.0" | |
- name: Run tests | |
env: | |
AZURE_OPENAI_ENDPOINT: ${{ vars.AZURE_OPENAI_ENDPOINT }} | |
AZURE_MODEL_VERSION: ${{ vars.AZURE_MODEL_VERSION }} | |
AZURE_DEPLOYMENT_NAME: ${{ vars.AZURE_DEPLOYMENT_NAME }} | |
AZURE_OPENAI_API_VERSION: ${{ vars.AZURE_OPENAI_API_VERSION }} | |
AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }} | |
run: | | |
cd ${{ matrix.app }} | |
task run:test | |
shell: bash |