Files
infisical/.github/workflows/run-backend-bdd-tests.yml
2025-11-12 09:12:48 -08:00

80 lines
2.5 KiB
YAML

name: "Run backend BDD tests"
on:
pull_request:
types: [opened, synchronize]
paths:
- "backend/**"
- "!backend/README.md"
- "!backend/.*"
- "backend/.eslintrc.js"
workflow_call:
jobs:
check-be-pr:
name: Run BDD tests
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Free up disk space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
docker system prune -af
- name: ☁️ Checkout source
uses: actions/checkout@v3
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Install Python
run: uv python install
- uses: KengoTODA/actions-setup-docker-compose@v1
if: ${{ env.ACT }}
name: Install `docker compose` for local simulations
with:
version: "2.14.2"
- name: 🔧 Setup Node 20
uses: actions/setup-node@v3
with:
node-version: "20"
cache: "npm"
cache-dependency-path: backend/package-lock.json
- name: Install dependencies
run: npm install
working-directory: backend
- name: Output .env file
run: |
echo "ACME_DEVELOPMENT_MODE=true" > .env
echo "ACME_FEATURE_ENABLED=true" >> .env
echo "ACME_DEVELOPMENT_HTTP01_CHALLENGE_HOST_OVERRIDES={\"localhost\": \"host.docker.internal:8087\"}" >> .env
- name: Build Infisical backend Docker image with caching
uses: docker/bake-action@v5
with:
files: docker-compose.dev.yml
targets: backend
set: |
*.cache-from: type=gha,scope=${{ github.ref_name }}-compose # Import cache key (unique per branch)
*.cache-to: type=gha,scope=${{ github.ref_name }}-compose,mode=max # Export full cache
load: true
- name: Start Infisical
run: docker compose -f docker-compose.dev.yml up -d
- name: Wait for service to return 200
uses: nev7n/wait_for_response@v1
with:
url: "http://localhost:8080/api/v1/admin/config" # Replace with your service URL
responseCode: "200"
timeout: 60000
interval: 500
- name: Run bdd tests
run: npm run test:bdd
working-directory: backend
env:
INFISICAL_API_URL: http://localhost:8080
BOOTSTRAP_INFISICAL: "1"
- name: cleanup
run: |
docker compose -f "docker-compose.dev.yml" down