chore: various fixes to get e2e tests working for account service #1
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 }} | |
# NOTE: only account E2E tests enabled in pipeline currently; add other services as they are updated | |
# IF you add a new filter it ALSO needs to be here | |
services: >- | |
["account"] | |
# 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: | |
- 'Docker/**' | |
- 'tools/ci-k6/**' | |
- '.github/**' | |
- 'docker-compose.yaml' | |
- 'docker-compose-e2e.*.yaml' | |
- 'libs/types' | |
account: | |
- 'apps/account-api/**' | |
- 'apps/account-worker/**' | |
- 'libs/account-lib/**' | |
graph: | |
- 'apps/graph-api/**' | |
- 'apps/graph-worker/**' | |
- 'libs/graph-lib/**' | |
content-publishing: | |
- 'apps/content-publishing-api/**' | |
- 'apps/content-publishing-worker/**' | |
- 'libs/content-publishing-lib/**' | |
content-watcher: | |
- 'apps/content-watcher/**' | |
- 'libs/content-watcher-lib/**' | |
build: | |
name: '[${{ matrix.service }}] E2E Tests' | |
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: 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: | |
buildkitd-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-e2e.${{ matrix.service }}.yaml --profile e2e up -d | |
sleep 15 | |
# TODO: make a service-agnostic setup script, or make service-specific setup scripts all in one place | |
- name: Generate Provider and Capacity | |
if: ${{ steps.should.outputs.RUN == 'true' }} | |
working-directory: apps/account-api/test/setup | |
run: npm i && npm run main | |
- name: Run k6 Tests | |
if: ${{ steps.should.outputs.RUN == 'true' }} | |
run: npm run test:e2e:${{ matrix.service }} | |
- name: Stop Docker Compose | |
if: ${{ steps.should.outputs.RUN == 'true' || failure() }} | |
run: docker compose -f docker-compose.yaml -f docker-compose-e2e.${{ matrix.service }}.yaml --profile e2e down |