Skip to content

feat: docker image with integration tests and flow to build it #1141

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: feat/vaults
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
.env

artifacts/
cache/
coverage/
node_modules/
typechain-types/

docs/
foundry/
./*.md
foundry.toml
pyproject.toml

test/*
!test/common
!test/deploy
!test/hooks
!test/integration
!test/suite

deployed-*.json
upgrade-parameters-mainnet.json

.husky/
.github/

.idea/
.vscode/
.yarn/
38 changes: 38 additions & 0 deletions .github/workflows/tests-integration-build-image.yml.disabled
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Build and push integration tests image

on:
push:
branches:
- feat/docker-tests

permissions:
contents: read
packages: write

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to ghcr.io
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push the image
uses: docker/[email protected]
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ghcr.io/lidofinance/core-integration-tests:latest
16 changes: 10 additions & 6 deletions .github/workflows/tests-integration-mainnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,13 @@ jobs:
env:
RPC_URL: http://localhost:8555

- name: Run integration tests
run: yarn test:integration
env:
LOG_LEVEL: debug
RPC_URL: http://localhost:8555
NETWORK_STATE_FILE: deployed-mainnet-upgrade.json
- name: Run Core Integration Tests
run: |
docker run \
--env RPC_URL=http://host.docker.internal:8555 \
--env NETWORK_STATE_FILE=deployed-mainnet-upgrade.json \
--add-host=host.docker.internal:host-gateway \
-i \
-v $(pwd)/deployed-mainnet-upgrade.json:/app/deployed-mainnet-upgrade.json \
ghcr.io/lidofinance/core-integration-tests:latest
# host.docker.internal:host-gateway is workaround for accessing host on linux
25 changes: 25 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# syntax=docker/dockerfile:1
# Build an image with core integration tests

ARG NODE_VERSION=lts
FROM node:${NODE_VERSION}-alpine

ENV NODE_ENV=production

WORKDIR /app

COPY . .

RUN corepack enable \
&& corepack prepare "yarn@$(node -p "require('./package.json').packageManager.split('@')[1]")" --activate

# Use bind mounts for yarn.lock and package.json only during dependency resolution
# Use a cache mount to speed up repeated dependency installs
RUN --mount=type=cache,target=/usr/local/share/.cache/yarn \
--mount=type=bind,source=package.json,target=package.json \
--mount=type=bind,source=yarn.lock,target=yarn.lock \
yarn install --immutable

RUN yarn compile

CMD ["yarn", "test:integration"]
2 changes: 1 addition & 1 deletion test/integration/core/happy-path.integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

const AMOUNT = ether("100");

describe("Scenario: Protocol Happy Path", () => {
describe.only("Scenario: Protocol Happy Path", () => {

Check warning on line 23 in test/integration/core/happy-path.integration.ts

View workflow job for this annotation

GitHub Actions / ESLint

describe.only not permitted
let ctx: ProtocolContext;
let snapshot: string;

Expand Down
Loading