diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000000..5a568045af --- /dev/null +++ b/.dockerignore @@ -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/ diff --git a/.github/workflows/tests-integration-build-image.yml.disabled b/.github/workflows/tests-integration-build-image.yml.disabled new file mode 100644 index 0000000000..a3a7ad791a --- /dev/null +++ b/.github/workflows/tests-integration-build-image.yml.disabled @@ -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/build-push-action@v6.1.0 + with: + context: . + platforms: linux/amd64,linux/arm64 + push: true + tags: ghcr.io/lidofinance/core-integration-tests:latest diff --git a/.github/workflows/tests-integration-mainnet.yml b/.github/workflows/tests-integration-mainnet.yml index 75038f6a35..715ffd85f2 100644 --- a/.github/workflows/tests-integration-mainnet.yml +++ b/.github/workflows/tests-integration-mainnet.yml @@ -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 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000..c60159138c --- /dev/null +++ b/Dockerfile @@ -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"] diff --git a/test/integration/core/happy-path.integration.ts b/test/integration/core/happy-path.integration.ts index b5b9e802e9..53244729e7 100644 --- a/test/integration/core/happy-path.integration.ts +++ b/test/integration/core/happy-path.integration.ts @@ -20,7 +20,7 @@ import { LogDescriptionExtended } from "../../../lib/protocol/types"; const AMOUNT = ether("100"); -describe("Scenario: Protocol Happy Path", () => { +describe.only("Scenario: Protocol Happy Path", () => { let ctx: ProtocolContext; let snapshot: string;