-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into chore-update-docs
- Loading branch information
Showing
81 changed files
with
3,844 additions
and
1,405 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
name: Load Tests | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
determine-service-matrix: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
services: ${{ steps.determine-matrix.outputs.changes }} | ||
steps: | ||
- name: Check Out Repo | ||
uses: actions/checkout@v4 | ||
- uses: dorny/paths-filter@v3 | ||
id: determine-matrix | ||
with: | ||
# Note, 'common' is for future use--when code is factored out into common libraries, | ||
# but it's set up here so that the workflow logic could be tested with it present | ||
filters: | | ||
common: | ||
- '*' | ||
- '.github/**' | ||
account: | ||
- '*' | ||
- '.github/**' | ||
- 'services/account/**' | ||
graph: | ||
- '*' | ||
- '.github/**' | ||
- 'services/graph/**' | ||
content-publishing: | ||
- '*' | ||
- '.github/**' | ||
- 'services/content-publishing/**' | ||
content-watcher: | ||
- '*' | ||
- '.github/**' | ||
- 'services/content-watcher/**' | ||
build: | ||
name: '[${{ matrix.service }}] Load Test' | ||
runs-on: ubuntu-latest | ||
needs: determine-service-matrix | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
service: ${{ fromJson(needs.determine-service-matrix.outputs.services) }} | ||
exclude: | ||
- service: common | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install Node.js | ||
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 | ||
working-directory: tools/ci-k6 | ||
run: npm ci | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Login to DockerHub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{secrets.DOCKERHUB_USERNAME}} | ||
password: ${{secrets.DOCKERHUB_TOKEN}} | ||
|
||
- name: Start Frequency | ||
run: | | ||
docker compose -f docker-compose.yaml -f docker-compose-k6.${{ matrix.service }}.yaml up -d frequency | ||
sleep 5 | ||
- name: Generate Provider and Capacity | ||
working-directory: tools/ci-k6 | ||
run: npm run main | ||
|
||
# Just start the services we need... | ||
- name: Start All Services | ||
run: docker compose -f docker-compose.yaml -f docker-compose-k6.${{ matrix.service }}.yaml up -d | ||
|
||
- name: Wait for API to be ready | ||
uses: cygnetdigital/[email protected] | ||
with: | ||
url: 'http://localhost:3000/readyz' | ||
responseCode: '200' | ||
timeout: 120000 | ||
interval: 2000 | ||
|
||
- name: Setup K6 | ||
uses: grafana/setup-k6-action@v1 | ||
- name: Run k6 Tests | ||
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: always() | ||
run: docker compose -f docker-compose.yaml -f docker-compose-k6.${{ matrix.service }}.yaml down |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Use a multi-stage build for efficiency | ||
FROM node:20 AS builder | ||
|
||
WORKDIR /build/packages | ||
|
||
COPY packages ./ | ||
|
||
WORKDIR /build/services/content-publishing | ||
|
||
COPY services/content-publishing/package* ./ | ||
|
||
RUN npm ci | ||
|
||
COPY services/content-publishing ./ | ||
|
||
# Build the application | ||
RUN npm run build && \ | ||
rm -rf node_modules && \ | ||
npm ci --omit=dev | ||
|
||
# Production stage | ||
FROM node:20 | ||
|
||
ENV NODE_ENV=production | ||
|
||
WORKDIR /app | ||
|
||
COPY --from=builder /build/services/content-publishing/dist ./dist/ | ||
COPY services/content-publishing/package*.json ./ | ||
COPY services/content-publishing/lua ./lua/ | ||
COPY services/content-publishing/scripts/docker-entrypoint.sh ./ | ||
COPY --from=builder /build/services/content-publishing/node_modules ./node_modules/ | ||
RUN chmod +x ./docker-entrypoint.sh | ||
|
||
# We want jq and curl in the final image, but we don't need the support files | ||
RUN apt-get update && \ | ||
apt-get install -y jq curl tini && \ | ||
apt-get clean && \ | ||
rm -rf /usr/share/doc /usr/share/man /usr/share/zsh | ||
|
||
EXPOSE 3000 | ||
|
||
ENV START_PROCESS="api" | ||
|
||
ENTRYPOINT ["/usr/bin/tini", "--", "./docker-entrypoint.sh"] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Use a multi-stage build for efficiency | ||
FROM node:20 AS builder | ||
|
||
WORKDIR /build/packages | ||
|
||
COPY packages ./ | ||
|
||
WORKDIR /build/services/content-watcher | ||
|
||
COPY services/content-watcher/package* ./ | ||
|
||
RUN npm ci | ||
|
||
COPY services/content-watcher ./ | ||
|
||
# Build the application | ||
RUN npm run build && \ | ||
rm -rf node_modules && \ | ||
npm ci --omit=dev | ||
|
||
# Production stage | ||
FROM node:20 | ||
|
||
ENV NODE_ENV=production | ||
|
||
WORKDIR /app | ||
|
||
COPY --from=builder /build/services/content-watcher/dist ./dist/ | ||
COPY services/content-watcher/package*.json ./ | ||
COPY --from=builder /build/services/content-watcher/node_modules ./node_modules/ | ||
|
||
# We want jq and curl in the final image, but we don't need the support files | ||
RUN apt-get update && \ | ||
apt-get install -y jq curl tini && \ | ||
apt-get clean && \ | ||
rm -rf /usr/share/doc /usr/share/man /usr/share/zsh | ||
|
||
EXPOSE 3000 | ||
|
||
ENTRYPOINT [ "/usr/bin/tini", "--", "node", "dist/apps/api/main.js" ] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM node:20 | ||
|
||
WORKDIR /app | ||
|
||
EXPOSE 3000 | ||
|
||
VOLUME [ "/app", "/app/services/account/node_modules", "/app/services/graph/node_modules", "/app/services/content-publishing/node_modules", "/app/services/content-watcher/node_modules" ] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Use a multi-stage build for efficiency | ||
FROM node:20 AS builder | ||
|
||
WORKDIR /build/packages | ||
|
||
COPY packages ./ | ||
|
||
WORKDIR /build/services/graph | ||
|
||
COPY services/graph/package* ./ | ||
|
||
RUN npm ci | ||
|
||
COPY services/graph ./ | ||
|
||
# Build the application | ||
RUN npm run build && \ | ||
rm -rf node_modules && \ | ||
npm ci --omit=dev | ||
|
||
# Production stage | ||
FROM node:20 | ||
|
||
ENV NODE_ENV=production | ||
|
||
WORKDIR /app | ||
|
||
COPY --from=builder /build/services/graph/dist ./dist/ | ||
COPY services/graph/package*.json ./ | ||
COPY services/graph/lua ./lua/ | ||
COPY services/graph/scripts/docker-entrypoint.sh ./ | ||
COPY --from=builder /build/services/graph/node_modules ./node_modules/ | ||
RUN chmod +x ./docker-entrypoint.sh | ||
|
||
# We want jq and curl in the final image, but we don't need the support files | ||
RUN apt-get update && \ | ||
apt-get install -y jq curl tini && \ | ||
apt-get clean && \ | ||
rm -rf /usr/share/doc /usr/share/man /usr/share/zsh | ||
|
||
EXPOSE 3000 | ||
|
||
ENV START_PROCESS="api" | ||
|
||
ENTRYPOINT ["/usr/bin/tini", "--", "./docker-entrypoint.sh", "prod"] |
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
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
Oops, something went wrong.