Skip to content

Commit

Permalink
Merge branch 'integration-tests' into QA-669-fix-unsigned-step2
Browse files Browse the repository at this point in the history
  • Loading branch information
pcheremu committed Feb 15, 2024
2 parents 4ff09f6 + 946b0f6 commit 3c4f3ce
Show file tree
Hide file tree
Showing 485 changed files with 28,889 additions and 8,450 deletions.
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
**/dist/
**/dist/
**.env
1 change: 0 additions & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,3 @@
- [ ] PR title corresponds to the body of PR (we generate changelog entries from PRs).
- [ ] Tests for the changes have been added / updated.
- [ ] Documentation comments have been added / updated.
- [ ] Code has been formatted via `zk fmt` and `zk lint`.
7 changes: 4 additions & 3 deletions .github/workflows/app-deploy-feature-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,14 @@ jobs:

mainnet:
needs: build
name: Feature Env, Mainnet+
name: Feature on Mainnet + Sepolia
uses: ./.github/workflows/app-e2e.yml
secrets: inherit
permissions:
contents: read
contents: write
with:
targetUrl: ${{ needs.build.outputs.dappUrl }}
testnet_network_value_for_e2e: "/?network=sepolia"
default_network_value_for_e2e: "/?network=mainnet"
publish_to_allure: true
environmentTags: "and not @stagingEnv"
environmentTags: "and not @productionEnv"
6 changes: 3 additions & 3 deletions .github/workflows/app-deploy-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ jobs:
mainnet:
needs: deploy
name: Staging Env, Mainnet+
name: Staging on Mainnet + Sepolia
uses: ./.github/workflows/app-e2e.yml
secrets: inherit
permissions:
contents: read
contents: write
with:
targetUrl: ${{ needs.deploy.outputs.dappUrl }}
testnet_network_value_for_e2e: "/?network=sepolia"
default_network_value_for_e2e: "/?network=mainnet"
publish_to_allure: true
environmentTags: "and not @featureEnv"

77 changes: 55 additions & 22 deletions .github/workflows/app-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ on:
type: string
default: '/?network=mainnet'
required: true
testnet_network_value_for_e2e:
type: string
default: '/?network=sepolia'
required: true
publish_to_allure: #Here we define the variable that can be overwritten by caller workflow
type: boolean
description: "Publish test results to allure"
Expand Down Expand Up @@ -58,7 +62,7 @@ jobs:
name: '${{ matrix.tags }}'
container:
image: mcr.microsoft.com/playwright:v1.27.0-focal
options: --user root
options: --user 1001
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -69,7 +73,7 @@ jobs:
with:
node-version: '18'
cache: 'npm'

- name: Cache node modules
id: cache-nodemodules
uses: actions/cache@v3
Expand Down Expand Up @@ -104,33 +108,27 @@ jobs:
echo "Run tests"
if [ "${{ matrix.tags }}" = "@testnetSmokeSuite" ]; then
echo "Run in testnetSmokeSuite only"
E2ENETWORK='/?network=goerli' npx cucumber-js --tags "${{ matrix.tags }} ${{ inputs.environmentTags }} and not @mainnet"
E2ENETWORK='${{ inputs.testnet_network_value_for_e2e }}' npx cucumber-js --tags "${{ matrix.tags }} ${{ inputs.environmentTags }} and not @mainnet"
else
echo "Run in mainnet"
E2ENETWORK='${{ inputs.default_network_value_for_e2e }}' npx cucumber-js --tags "${{ matrix.tags }} ${{ inputs.environmentTags }} and not @testnet"
fi
- name: Reset tags quotes
- name: Save artifacts to Git
if: always()
run: |
echo "MATRIX_TAG_WITHOUT_QUOTES=$(echo ${{ matrix.tags }} | sed -e 's/@//g' )" >> $GITHUB_ENV
uses: actions/upload-artifact@v3
with:
name: allure-results
path: packages/app/allure-results

- name: Create launch ID
- name: Upload test results to Allure reporter
if: always()
env:
ALLURE_LAUNCH_NAME: "#${{ github.run_number }} ${{ env.MATRIX_TAG_WITHOUT_QUOTES }}"
ALLURE_LAUNCH_TAGS: "${{ env.ALLURE_BASIC_TAGS }}, ${{ env.MATRIX_TAG_WITHOUT_QUOTES }}"
ALLURE_TOKEN: ${{ secrets.ALLURE_TOKEN }}
run: |
echo "ALLURE_LAUNCH_ID=$(./allurectl launch create --launch-name '${{ env.ALLURE_LAUNCH_NAME }}' --no-header --format ID | tail -n1)" >> $GITHUB_ENV
- name: Upload tests to the Allure proj
if: always() && inputs.publish_to_allure == true
env:
ALLURE_TOKEN: ${{ secrets.ALLURE_TOKEN }}
run: |
./allurectl upload allure-results --launch-id ${{ env.ALLURE_LAUNCH_ID }}
./allurectl launch close ${{ env.ALLURE_LAUNCH_ID }}
./allurectl upload allure-results
echo "*Public report link: https://raw.githack.com/matter-labs/block-explorer/gh-pages/${{ github.run_number }}/index.html"
echo "*Public report link will be available when the 'Allure Report' job will be succesfully executed."
- if: failure()
name: Save artifacts
Expand All @@ -140,18 +138,53 @@ jobs:
path: packages/app/tests/e2e/artifacts/*

publish:
name: Publish Allure link to GIT
name: Allure Report
runs-on: ubuntu-latest
permissions:
contents: read
contents: write
needs: e2e
if: always()
steps:
- uses: actions/checkout@v3

- uses: actions/download-artifact@v2
with:
name: allure-results
path: packages/app/allure-results

- name: Get Allure history
uses: actions/checkout@v3
if: always()
continue-on-error: true
with:
ref: gh-pages
path: gh-pages

- name: Allure Report action from marketplace
uses: simple-elf/[email protected]
if: always()
id: allure-report
with:
allure_results: packages/app/allure-results
gh_pages: gh-pages
allure_report: allure-report
allure_history: allure-history
keep_reports: 10

- name: Deploy report to Github Pages
if: always()
uses: peaceiris/actions-gh-pages@v2
env:
PERSONAL_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PUBLISH_BRANCH: gh-pages
PUBLISH_DIR: allure-history

- name: Prepare a link
run: |
echo "BASE64_SEARCH_REQUEST=$(echo '${{ env.ALLURE_SEARCH_REQUEST }}' | base64)" >> $GITHUB_ENV
- name: Publish Allure link to GIT Summary
run: |
LINK="${{ vars.ALLURE_ENDPOINT }}project/${{ vars.ALLURE_PROJECT_ID }}/launches?search=${{ env.BASE64_SEARCH_REQUEST }}"
echo "Allure [e2e tests]($LINK) :rocket: in git run #${{ github.run_number }}" >> $GITHUB_STEP_SUMMARY
LINK1="${{ vars.ALLURE_ENDPOINT }}project/${{ vars.ALLURE_PROJECT_ID }}/launches?search=${{ env.BASE64_SEARCH_REQUEST }}"
LINK2="https://raw.githack.com/matter-labs/block-explorer/gh-pages/${{ github.run_number }}/index.html"
echo "Allure [Private]($LINK1) and [Public]($LINK2) links:rocket: in git run #${{ github.run_number }}" >> $GITHUB_STEP_SUMMARY
61 changes: 61 additions & 0 deletions .github/workflows/integration-tests-api.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Integration test - API
on: pull_request

jobs:
runTests:
timeout-minutes: 30
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
checks: write
strategy:
matrix:
node-version: ['lts/*'] # 18.17.1 or lts/*
test-pattern:
- accounts.test.ts
- addresses.test.ts
- batches.test.ts
- blocks.test.ts
- contracts.test.ts
- logs.test.ts
- stats.test.ts
- tokens.test.ts
- transactions.test.ts
name: 'API test set: ${{ matrix.test-pattern}} / Node: ${{ matrix.node-version}}'
steps:
- name: Checkout with Submodule
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: npm

- name: Install dependencies
run: |
npm ci --no-audit
npx playwright install --with-deps chromium
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Start docker containers
run: |
docker-compose -f "docker-compose.yaml" up -d --build
- name: List running containers
run: docker ps

- name: API tests run (parallel)
run: |
cd packages/integration-tests
npx jest --verbose --testPathPattern=${{ matrix.test-pattern }}
- name: Stop containers
if: always()
run: |
docker-compose -f "docker-compose.yaml" down
28 changes: 28 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,34 @@ jobs:
file: packages/worker/Dockerfile
no-cache: true

- name: Build and push Docker image for Data Fetcher
uses: docker/build-push-action@v4
with:
push: true
tags: |
"matterlabs/block-explorer-data-fetcher:latest"
"matterlabs/block-explorer-data-fetcher:v${{ needs.createReleaseVersion.outputs.releaseVersion }}"
"matterlabs/block-explorer-data-fetcher:${{ steps.setVersionForFlux.outputs.imageTag }}"
"us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/block-explorer-data-fetcher:latest"
"us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/block-explorer-data-fetcher:v${{ needs.createReleaseVersion.outputs.releaseVersion }}"
"us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/block-explorer-data-fetcher:${{ steps.setVersionForFlux.outputs.imageTag }}"
file: packages/data-fetcher/Dockerfile
no-cache: true

- name: Build and push Docker image for App
uses: docker/build-push-action@v4
with:
push: true
tags: |
"matterlabs/block-explorer-app:latest"
"matterlabs/block-explorer-app:v${{ needs.createReleaseVersion.outputs.releaseVersion }}"
"matterlabs/block-explorer-app:${{ steps.setVersionForFlux.outputs.imageTag }}"
"us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/block-explorer-app:latest"
"us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/block-explorer-app:v${{ needs.createReleaseVersion.outputs.releaseVersion }}"
"us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/block-explorer-app:${{ steps.setVersionForFlux.outputs.imageTag }}"
file: packages/app/Dockerfile
no-cache: true

deployFrontendToStaging:
name: Deploy Block Explorer frontend to staging
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/validate-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ jobs:
packages/app/junit.xml
packages/api/junit.xml
packages/worker/junit.xml
packages/data-fetcher/junit.xml
check_run_annotations: all tests, skipped tests
report_individual_runs: "true"
check_name: Unit Test Results
Expand Down
16 changes: 9 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,17 @@ volumes
cypress/videos/
cypress/screenshots/
tests/e2e/reports/
tests/e2e/artifacts/
**/tests/e2e/artifacts/
**/playbook/artifacts-zk/
**/playbook/artifacts/
**/playbook/buffer/
**/playbook/cache-zk/
**/playbook/cache/

# Logs
logs
!/packages/worker/test/logs/
!/packages/data-fetcher/test/logs/
*.log
npm-debug.log*
yarn-debug.log*
Expand Down Expand Up @@ -53,12 +60,7 @@ lerna-debug.log*
!.vscode/extensions.json

# Allure
#Allure results and artifacts
**/allure-results/
**/e2e/artifacts/
**/playbook/artifacts*
**/playbook/cache*
**/buffer/*.txt
**allure-results/

# App hyperchain config
hyperchain.config.json
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"typescript.tsdk": "node_modules/typescript/lib",
"editor.tabSize": 2
}
Loading

0 comments on commit 3c4f3ce

Please sign in to comment.