Skip to content

Commit 7df9399

Browse files
committed
Parallel tests
1 parent ac547e7 commit 7df9399

File tree

5 files changed

+133
-79
lines changed

5 files changed

+133
-79
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Compose Tests
2+
on:
3+
pull_request:
4+
push:
5+
branches:
6+
- main*
7+
8+
concurrency:
9+
group: compose-tests-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
compose_tests:
14+
runs-on: charon-ci
15+
steps:
16+
- uses: actions/checkout@v4
17+
- name: Set up QEMU
18+
id: qemu
19+
uses: docker/setup-qemu-action@v3
20+
- uses: docker/setup-buildx-action@v3
21+
with:
22+
driver-opts: "image=moby/buildkit:v0.10.5"
23+
- uses: ./.github/actions/setup-go
24+
- uses: actions/cache@v4
25+
with:
26+
path: |
27+
~/go/pkg/mod
28+
~/.cache/go-build
29+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
30+
restore-keys: |
31+
${{ runner.os }}-go-
32+
- run: |
33+
echo "CHARON_REPO=$(pwd)" >> $GITHUB_ENV
34+
echo "DOCKER_BUILDKIT=1" >> $GITHUB_ENV
35+
- run: go test -race github.com/obolnetwork/charon/testutil/compose/smoke -v -integration -sudo-perms -timeout=20m -log-dir=.
36+
- uses: actions/upload-artifact@v4
37+
if: always()
38+
with:
39+
name: smoke-test-logs
40+
path: testutil/compose/smoke/*.log
41+
retention-days: 3
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Integration Tests
2+
on:
3+
pull_request:
4+
push:
5+
branches:
6+
- main*
7+
8+
concurrency:
9+
group: integration-tests-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
integration_tests:
14+
runs-on: charon-ci
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: ./.github/actions/setup-go
18+
- uses: actions/cache@v4
19+
with:
20+
path: |
21+
~/go/pkg/mod
22+
~/.cache/go-build
23+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
24+
restore-keys: |
25+
${{ runner.os }}-go-
26+
- run: go test -v -timeout=10m -race github.com/obolnetwork/charon/testutil/integration -integration

.github/workflows/test.yml

Lines changed: 0 additions & 78 deletions
This file was deleted.

.github/workflows/unit-tests.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Unit Tests
2+
on:
3+
pull_request:
4+
push:
5+
branches:
6+
- main*
7+
8+
concurrency:
9+
group: unit-tests-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
unit_tests:
14+
runs-on: charon-ci
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: ./.github/actions/setup-go
18+
- uses: actions/cache@v4
19+
with:
20+
path: |
21+
~/go/pkg/mod
22+
~/.cache/go-build
23+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
24+
restore-keys: |
25+
${{ runner.os }}-go-
26+
- run: go test -coverprofile=coverage.out -covermode=atomic -timeout=5m -race ./...
27+
- name: Upload coverage to Codecov
28+
uses: codecov/codecov-action@v5.4.0
29+
with:
30+
token: ${{ secrets.CODECOV_TOKEN }}
31+
files: coverage.out
32+
33+
- name: Cancel other workflows if this one fails
34+
if: failure()
35+
uses: actions/github-script@v6
36+
with:
37+
github-token: ${{ secrets.GITHUB_TOKEN }}
38+
script: |
39+
// Get all workflow runs
40+
const runs = await github.rest.actions.listWorkflowRunsForRepo({
41+
owner: context.repo.owner,
42+
repo: context.repo.repo,
43+
status: 'in_progress',
44+
branch: context.payload.pull_request?.head.ref,
45+
});
46+
47+
for (const run of runs.data.workflow_runs) {
48+
if (run.id === context.runId) {
49+
continue;
50+
}
51+
if (run.name !== 'Integration Tests' && run.name !== 'Compose Tests') {
52+
continue;
53+
}
54+
console.log(`Attempting to cancel workflow run ${run.id} (${run.name})`);
55+
try {
56+
const result = await github.rest.actions.cancelWorkflowRun({
57+
owner: context.repo.owner,
58+
repo: context.repo.repo,
59+
run_id: run.id
60+
});
61+
console.log(`Cancellation API response status: ${result.status}`);
62+
} catch (error) {
63+
console.error(`Error cancelling workflow ${run.id}:`, error.message);
64+
}
65+
}

core/fetcher/graffiti_internal_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func TestFetchBeaconNodeToken(t *testing.T) {
4343
eth2Cl := mocks.NewClient(t)
4444
eth2Cl.On("NodeVersion", mock.Anything, mock.Anything).Return(&eth2api.Response[string]{Data: "Lighthouse/v0.1.5 (Linux x86_64)"}, nil).Once()
4545
token := fetchBeaconNodeToken(eth2Cl)
46-
require.Equal(t, "LH", token)
46+
require.Equal(t, "LHH", token)
4747
})
4848
}
4949

0 commit comments

Comments
 (0)