fix: resume queue in content-publishing when Capacity is available #158
Workflow file for this run
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
name: Load Tests | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
jobs: | |
service-matrix: | |
runs-on: ubuntu-latest | |
outputs: | |
changes: ${{ steps.determine-matrix.outputs.changes }} | |
# IF you add a new filter it ALSO needs to be here | |
services: >- | |
["account", "graph", "content-publishing", "content-watcher"] | |
# Resolves to true if it should run everything, aka when common files change | |
run-all: ${{ steps.determine-matrix.outputs.changes.common }} | |
steps: | |
- name: Check Out Repo | |
uses: actions/checkout@v4 | |
- uses: dorny/paths-filter@v3 | |
id: determine-matrix | |
with: | |
# Adding a filter? Check for the need to add to the outputs as well | |
filters: | | |
common: | |
- 'packages/**' | |
- 'Docker/**' | |
- 'tools/ci-k6/**' | |
- '.github/**' | |
- 'docker-compose.yaml' | |
account: | |
- 'services/account/**' | |
- 'docker-compose-k6.account.yaml' | |
graph: | |
- 'services/graph/**' | |
- 'docker-compose-k6.graph.yaml' | |
content-publishing: | |
- 'services/content-publishing/**' | |
- 'docker-compose-k6.content-publishing.yaml' | |
content-watcher: | |
- 'services/content-watcher/**' | |
- 'docker-compose-k6.content-watcher.yaml' | |
build: | |
name: '[${{ matrix.service }}] Load Test' | |
runs-on: ubuntu-latest | |
needs: service-matrix | |
strategy: | |
fail-fast: false | |
matrix: | |
service: ${{ fromJson(needs.service-matrix.outputs.services) }} | |
steps: | |
- name: Run or Skip | |
id: should | |
run: echo "RUN=${{ needs.service-matrix.outputs.run-all || contains(fromJson(needs.service-matrix.outputs.changes), matrix.service) }}" >> "$GITHUB_OUTPUT" | |
- name: Checkout | |
if: ${{ steps.should.outputs.RUN == 'true' }} | |
uses: actions/checkout@v4 | |
- name: Install Node.js | |
if: ${{ steps.should.outputs.RUN == 'true' }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'npm' | |
registry-url: 'https://registry.npmjs.org' | |
cache-dependency-path: tools/ci-k6/package-lock.json | |
- name: Install dependencies | |
if: ${{ steps.should.outputs.RUN == 'true' }} | |
working-directory: tools/ci-k6 | |
run: npm ci | |
- name: Set up Docker Buildx | |
if: ${{ steps.should.outputs.RUN == 'true' }} | |
uses: docker/setup-buildx-action@v3 | |
# Use GitHub Container Registry instead due to rate limits | |
with: | |
config-inline: | | |
[registry."ghcr.io"] | |
- name: Login to DockerHub | |
if: ${{ steps.should.outputs.RUN == 'true' }} | |
uses: docker/login-action@v3 | |
with: | |
username: ${{secrets.DOCKERHUB_USERNAME}} | |
password: ${{secrets.DOCKERHUB_TOKEN}} | |
- name: Start Frequency | |
if: ${{ steps.should.outputs.RUN == 'true' }} | |
run: | | |
docker compose -f docker-compose.yaml -f docker-compose-k6.${{ matrix.service }}.yaml up -d frequency | |
sleep 5 | |
- name: Generate Provider and Capacity | |
if: ${{ steps.should.outputs.RUN == 'true' }} | |
working-directory: tools/ci-k6 | |
run: npm run main | |
# Just start the services we need... | |
- name: Start All Services | |
if: ${{ steps.should.outputs.RUN == 'true' }} | |
run: docker compose -f docker-compose.yaml -f docker-compose-k6.${{ matrix.service }}.yaml up -d | |
- name: Wait for API to be ready | |
if: ${{ steps.should.outputs.RUN == 'true' }} | |
uses: cygnetdigital/wait_for_response@v2.0.0 | |
with: | |
url: 'http://localhost:3000/readyz' | |
responseCode: '200' | |
timeout: 120000 | |
interval: 2000 | |
- name: Setup K6 | |
if: ${{ steps.should.outputs.RUN == 'true' }} | |
uses: grafana/setup-k6-action@v1 | |
- name: Run k6 Tests | |
if: ${{ steps.should.outputs.RUN == 'true' }} | |
run: | | |
for test_file in services/${{ matrix.service }}/k6-test/*.k6.js; do | |
k6 run --no-color --quiet --no-usage-report "$test_file" || exit 1 | |
done | |
- name: Stop Docker Compose | |
if: ${{ steps.should.outputs.RUN == 'true' || failure() }} | |
run: docker compose -f docker-compose.yaml -f docker-compose-k6.${{ matrix.service }}.yaml down |