Skip to content
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

Improve GHA #2031

Merged
merged 4 commits into from
Apr 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 0 additions & 23 deletions .github/workflows/ok-to-test.yml

This file was deleted.

82 changes: 1 addition & 81 deletions .github/workflows/test-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,9 @@ on:
- update-external-dependencies
- 'release/**'
pull_request:
repository_dispatch:
types: [ok-to-test-command]

jobs:
trusted-test-e2e:
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
test-e2e:
strategy:
fail-fast: false
matrix:
Expand All @@ -33,12 +30,6 @@ jobs:
env:
GOARCH: ${{ matrix.goarch }}

- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build Docker
run: make build-docker

Expand All @@ -49,74 +40,3 @@ jobs:
- name: Test
run: make test-e2e-group-${{ matrix.e2e-group }}
working-directory: test

from-fork-test-e2e:
if:
github.event_name == 'repository_dispatch' &&
github.event.client_payload.slash_command.sha != '' &&
contains(github.event.client_payload.pull_request.head.sha, github.event.client_payload.slash_command.sha)
strategy:
matrix:
go-version: [ 1.18.x ]
goarch: [ "amd64" ]
e2e-group: [ 1, 2, 3, 4, 5, 6, 7 ]
runs-on: ubuntu-latest
steps:
- name: Fork based /ok-to-test checkout
uses: actions/checkout@v3
with:
ref: 'refs/pull/${{ github.event.client_payload.pull_request.number }}/merge'

- name: Install Go
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
env:
GOARCH: ${{ matrix.goarch }}

- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build Docker
run: make build-docker

- name: Compile SCs
run: make compile-scs
working-directory: test

- name: Test
run: make test-e2e-group-${{ matrix.e2e-group }}
working-directory: test

# Update check run
- uses: actions/github-script@v5
id: update-check-run
if: ${{ always() }}
env:
number: ${{ github.event.client_payload.pull_request.number }}
job: ${{ github.job }}
# Conveniently, job.status maps to https://developer.github.com/v3/checks/runs/#update-a-check-run
conclusion: ${{ job.status }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { data: pull } = await github.rest.pulls.get({
...context.repo,
pull_number: process.env.number
});
const ref = pull.head.sha;
const { data: checks } = await github.rest.checks.listForRef({
...context.repo,
ref
});
const check = checks.check_runs.filter(c => c.name === process.env.job);
const { data: result } = await github.rest.checks.update({
...context.repo,
check_run_id: check[0].id,
status: 'completed',
conclusion: process.env.conclusion
});
return result;
52 changes: 0 additions & 52 deletions .github/workflows/test-from-prover.yml

This file was deleted.

82 changes: 1 addition & 81 deletions .github/workflows/test-full-non-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,9 @@ on:
- update-external-dependencies
- 'release/**'
pull_request:
repository_dispatch:
types: [ok-to-test-command]

jobs:
trusted-test-full-non-e2e:
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
test-full-non-e2e:
strategy:
matrix:
go-version: [ 1.18.x ]
Expand All @@ -31,54 +28,6 @@ jobs:
env:
GOARCH: ${{ matrix.goarch }}

- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Compile SCs
run: make compile-scs
working-directory: test

- name: Test
env:
ZKPROVER_URI: 127.0.0.1
run: make test-full-non-e2e
working-directory: test

from-fork-test-full-non-e2e:
if:
github.event_name == 'repository_dispatch' &&
github.event.client_payload.slash_command.sha != '' &&
contains(github.event.client_payload.pull_request.head.sha, github.event.client_payload.slash_command.sha)
strategy:
matrix:
go-version: [ 1.18.x ]
goarch: [ "amd64" ]
runs-on: ubuntu-latest
steps:
- name: Fork based /ok-to-test checkout
uses: actions/checkout@v3
with:
ref: 'refs/pull/${{ github.event.client_payload.pull_request.number }}/merge'

- name: Install Go
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
env:
GOARCH: ${{ matrix.goarch }}

- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build Docker
run: make build-docker

- name: Compile SCs
run: make compile-scs
working-directory: test
Expand All @@ -88,32 +37,3 @@ jobs:
ZKPROVER_URI: 127.0.0.1
run: make test-full-non-e2e
working-directory: test

# Update check run
- uses: actions/github-script@v5
id: update-check-run
if: ${{ always() }}
env:
number: ${{ github.event.client_payload.pull_request.number }}
job: ${{ github.job }}
conclusion: ${{ job.status }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { data: pull } = await github.rest.pulls.get({
...context.repo,
pull_number: process.env.number
});
const ref = pull.head.sha;
const { data: checks } = await github.rest.checks.listForRef({
...context.repo,
ref
});
const check = checks.check_runs.filter(c => c.name === process.env.job);
const { data: result } = await github.rest.checks.update({
...context.repo,
check_run_id: check[0].id,
status: 'completed',
conclusion: process.env.conclusion
});
return result;
2 changes: 0 additions & 2 deletions docs/ci/actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ PR opened and pushing changes to PRs.

Pushes docker images to docker hub, the images pushed are:
* `hermeznetwork/zkevm-node:develop`
* `hermeznetwork/zkprover-mock:develop`

### When is executed

Expand All @@ -33,7 +32,6 @@ Changes pushed to the `develop` branch.

Pushes docker images to docker hub, the images pushed are:
* `hermeznetwork/zkevm-node:latest`
* `hermeznetwork/zkprover-mock:latest`

### When is executed

Expand Down
15 changes: 1 addition & 14 deletions test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ DOCKERCOMPOSEEXPLORERL2 := zkevm-explorer-l2
DOCKERCOMPOSEEXPLORERL2DB := zkevm-explorer-l2-db
DOCKERCOMPOSEEXPLORERRPC := zkevm-explorer-json-rpc
DOCKERCOMPOSEZKPROVER := zkevm-prover
DOCKERCOMPOSEZKPROVERMOCK := zkprover-mock
DOCKERCOMPOSEPERMISSIONLESSDB := zkevm-permissionless-db
DOCKERCOMPOSEPERMISSIONLESSNODE := zkevm-permissionless-node
DOCKERCOMPOSEPERMISSIONLESSZKPROVER := zkevm-permissionless-prover
Expand All @@ -41,7 +40,6 @@ RUNEXPLORERL2 := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEEXPLORERL2)
RUNEXPLORERL2DB := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEEXPLORERL2DB)
RUNEXPLORERJSONRPC := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEEXPLORERRPC)
RUNZKPROVER := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEZKPROVER)
RUNZKPROVERMOCK := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEZKPROVERMOCK)

RUNPERMISSIONLESSDB := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEPERMISSIONLESSDB)
RUNPERMISSIONLESSNODE := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEPERMISSIONLESSNODE)
Expand Down Expand Up @@ -71,7 +69,6 @@ STOPEXPLORERL2 := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEEXPLORERL2) && $(DOCKERCO
STOPEXPLORERL2DB := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEEXPLORERL2DB) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEEXPLORERL2DB)
STOPEXPLORERJSONRPC := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEEXPLORERRPC) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEEXPLORERRPC)
STOPZKPROVER := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEZKPROVER) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEZKPROVER)
STOPZKPROVERMOCK := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEZKPROVERMOCK) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEZKPROVERMOCK)

STOPPERMISSIONLESSDB := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEPERMISSIONLESSDB) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEPERMISSIONLESSDB)
STOPPERMISSIONLESSNODE := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEPERMISSIONLESSNODE) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEPERMISSIONLESSNODE)
Expand All @@ -89,9 +86,7 @@ test-full-non-e2e: stop ## Runs non-e2e tests checking race conditions
$(RUNPOOLDB)
$(RUNEVENTDB)
$(RUNZKPROVER)
sleep 5
$(RUNZKPROVERMOCK)
sleep 2
sleep 7
$(RUNL1NETWORK)
sleep 15
docker logs $(DOCKERCOMPOSEZKPROVER)
Expand Down Expand Up @@ -259,14 +254,6 @@ run-zkprover: ## Runs zkprover
stop-zkprover: ## Stops zkprover
$(STOPZKPROVER)

.PHONY: run-zkprover-mock
run-zkprover-mock: ## Runs zkprover-mock
$(RUNZKPROVERMOCK)

.PHONY: stop-zkprover-mock
stop-zkprover-mock: ## Stops zkprover-mock
$(STOPZKPROVERMOCK)

.PHONY: run-l1-explorer
run-l1-explorer: ## Runs L1 blockscan explorer
$(RUNEXPLORERL1DB)
Expand Down
2 changes: 1 addition & 1 deletion test/operations/wait.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const (
// DefaultInterval is a time interval
DefaultInterval = 2 * time.Millisecond
// DefaultDeadline is a time interval
DefaultDeadline = 30 * time.Second
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO the problems with the tests are not related to a timeout, but to some components (usually the executor do not start) or take too much time. As far as I know this deadline does not affect that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this is the thing that makes the timeout happen, but could be. In just 30s a lot of things need to happen:

  • Pull the fake L1 docker image and start it (unreliable amount of time)
  • Send and verify a tx with the L1
  • Start another ~5 containers
  • Wait for the jsonRPC to be responsive

30s seems a bit tight to me. Also, after this change all actions completed at firs try. It was a long time since this happened to me, but of course it could have been coinicidence

DefaultDeadline = 2 * time.Minute
// DefaultTxMinedDeadline is a time interval
DefaultTxMinedDeadline = 5 * time.Second
)
Expand Down
11 changes: 0 additions & 11 deletions tools/zkevmprovermock/Dockerfile

This file was deleted.

12 changes: 0 additions & 12 deletions tools/zkevmprovermock/cmd/client.go

This file was deleted.