-
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 412-retiremsa
- Loading branch information
Showing
34 changed files
with
2,847 additions
and
2,262 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,102 @@ | ||
name: E2E 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.16.0 | ||
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' }} | ||
run: npm ci | ||
|
||
- name: Start Frequency | ||
if: ${{ steps.should.outputs.RUN == 'true' }} | ||
# NOTE: the 'sleep' below can be shortened or possibly eliminated once we switch from the 'dsnp/instant-seal-node-with-deployed-schemas' | ||
# to the 'frequencychain/standalone-node' with schemas in the genesis block (after Frequency 1.13 is deployed to Mainnet & the image is updated) | ||
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 ci && npm run main | ||
|
||
- name: Run E2E 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 |
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,38 @@ | ||
# Stage 1: Build the application using static linking with the GNU toolchain | ||
FROM rust:bullseye AS builder | ||
|
||
# Set the working directory inside the container | ||
WORKDIR /app | ||
|
||
# Copy the Cargo.toml and Cargo.lock files to cache dependencies | ||
COPY rust-webhook-server/Cargo.toml rust-webhook-server/Cargo.lock ./ | ||
|
||
# Create a dummy main.rs to allow Cargo to fetch dependencies | ||
RUN mkdir src && echo "fn main() {}" > src/main.rs | ||
|
||
# Fetch dependencies | ||
RUN cargo build --release && rm -rf src target/release/rust-webhook-server | ||
|
||
# Copy the rest of the application source code | ||
COPY rust-webhook-server/ . | ||
RUN touch src/main.rs | ||
|
||
# Build the actual Rust application, enabling static linking for the standard library | ||
RUN cargo build --release | ||
|
||
# Stage 2: Use a minimal base image to run the application | ||
FROM debian:bullseye | ||
|
||
RUN apt-get update & apt-get install -y extra-runtime-dependencies & rm -rf /var/lib/apt/lists/* | ||
|
||
# Set the working directory inside the container | ||
WORKDIR /app | ||
|
||
# Copy the statically linked binary from the builder stage | ||
COPY --from=builder /app/target/release/rust-webhook-server . | ||
|
||
# Expose the port your application will run on (adjust as necessary) | ||
EXPOSE 3001 | ||
|
||
# Run the binary | ||
CMD ["./rust-webhook-server"] |
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.