Skip to content

Integration Test

Integration Test #148

---
name: Integration Test
permissions: read-all
on:
pull_request_review:
types: [submitted]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
container-build:
if: >
github.event.review.state == 'approved' ||
contains(github.event.pull_request.assignees.*.login, 'tylertitsworth')
permissions:
packages: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/login-action@v3
with:
registry: ghcr.io/${{ github.repository_owner }}/${{ github.repository }}
username: ${{ github.actor }}
password: ${{ github.token }}
- uses: docker/metadata-action@v5
id: meta
with:
images: ghcr.io/${{ github.repository_owner }}/${{ github.repository }}
- uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
container-scan:
needs: [container-build]
permissions:
contents: read # for actions/checkout to fetch code
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
runs-on: ubuntu-latest
steps:
- uses: docker/login-action@v3
with:
registry: ghcr.io/${{ github.repository_owner }}/${{ github.repository }}
username: ${{ github.actor }}
password: ${{ github.token }}
- uses: aquasecurity/[email protected]
with:
image-ref: ghcr.io/${{ github.repository_owner }}/${{ github.repository }}:pr-${{ github.event.pull_request.number }}
format: sarif
output: trivy-results-pr-${{ github.event.pull_request.number }}.sarif
- uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: trivy-results-pr-${{ github.event.pull_request.number }}.sarif
embed-test:
needs: [container-build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download Sources and Data
run: |
python -m pip install -U "huggingface-hub[cli]" hf_transfer
huggingface-cli login --token ${{ secrets.HF_TOKEN }}
huggingface-cli download --repo-type space TotalSundae/dungeons-and-dragons \
--include *.xml \
--local-dir . \
--local-dir-use-symlinks False
huggingface-cli download --repo-type space TotalSundae/dungeons-and-dragons \
--include data/* \
--local-dir . \
--local-dir-use-symlinks False
env:
HF_HUB_ENABLE_HF_TRANSFER: 1
- name: Test Embedding and Chain Creation
run: |
docker run --shm-size=7GB \
-u root -w /home/user/app \
-v $PWD/data:/home/user/app/test_data \
-v $PWD/sources:/home/user/app/sources \
ghcr.io/${{ github.repository_owner }}/${{ github.repository }}:pr-${{ github.event.pull_request.number }} \
bash -c "pip install pytest && pytest test/test_embed.py -W ignore::DeprecationWarning"
env:
OLLAMA_HOST: "https://totalsundae-ollama.hf.space"
LANGCHAIN_API_KEY: ${{ secrets.LANGCHAIN_API_KEY }}
e2e-test:
needs: [embed-test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Python Requirements
run: python -m pip install -r requirements.txt
- name: Setup Ollama
run: |
curl https://ollama.ai/install.sh | sh
sleep 5
ollama create volo -f ./Modelfile
env:
OLLAMA_HOST: "https://totalsundae-ollama.hf.space"
- name: Download Data
run: |
python -m pip install -U "huggingface-hub[cli]" hf_transfer
huggingface-cli login --token ${{ secrets.HF_TOKEN }}
huggingface-cli download --repo-type space TotalSundae/dungeons-and-dragons \
--include data/* \
--local-dir . \
--local-dir-use-symlinks False
env:
HF_HUB_ENABLE_HF_TRANSFER: 1
- name: Move Data
run: |
mkdir test_data
mv data/* test_data/
- uses: cypress-io/github-action@v6
with:
config-file: ${{ github.workspace }}/cypress/cypress.config.ts
record: true
start: chainlit run app.py -h
wait-on: 'http://localhost:8000'
wait-on-timeout: 10
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ github.token }}
LANGCHAIN_API_KEY: ${{ secrets.LANGCHAIN_API_KEY }}
TEST: true
OLLAMA_HOST: "https://totalsundae-ollama.hf.space"