Skip to content

Commit

Permalink
github, tests: generate coverage for sszgen from test suite (#13)
Browse files Browse the repository at this point in the history
* github, tests: generate coverage for sszgen from test suite

* github: yolo maybe windows works

* github: just drop windows builder, pile of shit
  • Loading branch information
karalabe authored Jul 26, 2024
1 parent afe53d7 commit be92ed9
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 47 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
os: [ubuntu-latest, macos-latest]
go-version: ['stable', 'oldstable']
runs-on: ${{ matrix.os }}

Expand All @@ -32,7 +32,15 @@ jobs:
run: go build -v ./...

- name: Test with coverage
run: go test -v -coverprofile="coverage-${{ matrix.os }}-${{ matrix.go-version }}.txt" -covermode=count ./...
run: go test -v -coverprofile="coverage-${{ matrix.os }}-${{ matrix.go-version }}.txt" -coverpkg=./... ./...

- name: Codegen with coverage
env:
GOCOVERDIR: "${{ github.workspace }}/coverage"
run: |
mkdir coverage
go generate ./...
go tool covdata textfmt -i=coverage -o=coverage-sszgen-${{ matrix.os }}-${{ matrix.go-version }}.txt
- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
Expand Down
4 changes: 2 additions & 2 deletions tests/testtypes/consensus-spec-tests/types_basics.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ package consensus_spec_tests

import "github.com/prysmaticlabs/go-bitfield"

//go:generate go run ../../../cmd/sszgen -type SingleFieldTestStruct -out gen_single_field_test_struct_ssz.go
//go:generate go run ../../../cmd/sszgen -type BitsStruct -out gen_bits_struct_ssz.go
//go:generate go run -cover ../../../cmd/sszgen -type SingleFieldTestStruct -out gen_single_field_test_struct_ssz.go
//go:generate go run -cover ../../../cmd/sszgen -type BitsStruct -out gen_bits_struct_ssz.go

type SingleFieldTestStruct struct {
A byte
Expand Down
80 changes: 40 additions & 40 deletions tests/testtypes/consensus-spec-tests/types_consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,46 +9,46 @@ import (
"github.com/prysmaticlabs/go-bitfield"
)

//go:generate go run ../../../cmd/sszgen -type Checkpoint -out gen_checkpoint_ssz.go
//go:generate go run ../../../cmd/sszgen -type AttestationData -out gen_attestation_data_ssz.go
//go:generate go run ../../../cmd/sszgen -type BeaconBlockHeader -out gen_beacon_block_header_ssz.go
//go:generate go run ../../../cmd/sszgen -type BLSToExecutionChange -out gen_bls_to_execution_change_ssz.go
//go:generate go run ../../../cmd/sszgen -type Attestation -out gen_attestation_ssz.go
//go:generate go run ../../../cmd/sszgen -type AggregateAndProof -out gen_aggregate_and_proof_ssz.go
//go:generate go run ../../../cmd/sszgen -type DepositData -out gen_deposit_data_ssz.go
//go:generate go run ../../../cmd/sszgen -type DepositMessage -out gen_deposit_message_ssz.go
//go:generate go run ../../../cmd/sszgen -type Deposit -out gen_deposit_ssz.go
//go:generate go run ../../../cmd/sszgen -type Eth1Block -out gen_eth1_block_ssz.go
//go:generate go run ../../../cmd/sszgen -type Eth1Data -out gen_eth1_data_ssz.go
//go:generate go run ../../../cmd/sszgen -type ExecutionPayload -out gen_execution_payload_ssz.go
//go:generate go run ../../../cmd/sszgen -type ExecutionPayloadHeader -out gen_execution_payload_header_ssz.go
//go:generate go run ../../../cmd/sszgen -type Fork -out gen_fork_ssz.go
//go:generate go run ../../../cmd/sszgen -type HistoricalBatch -out gen_historical_batch_ssz.go
//go:generate go run ../../../cmd/sszgen -type HistoricalSummary -out gen_historical_summary_ssz.go
//go:generate go run ../../../cmd/sszgen -type IndexedAttestation -out gen_indexed_attestation_ssz.go
//go:generate go run ../../../cmd/sszgen -type AttesterSlashing -out gen_attester_slashing_ssz.go
//go:generate go run ../../../cmd/sszgen -type PendingAttestation -out gen_pending_attestation_ssz.go
//go:generate go run ../../../cmd/sszgen -type SignedBeaconBlockHeader -out gen_signed_beacon_block_header_ssz.go
//go:generate go run ../../../cmd/sszgen -type ProposerSlashing -out gen_proposer_slashing_ssz.go
//go:generate go run ../../../cmd/sszgen -type SignedBLSToExecutionChange -out gen_signed_bls_to_execution_change_ssz.go
//go:generate go run ../../../cmd/sszgen -type SyncAggregate -out gen_sync_aggregate_ssz.go
//go:generate go run ../../../cmd/sszgen -type SyncCommittee -out gen_sync_committee_ssz.go
//go:generate go run ../../../cmd/sszgen -type VoluntaryExit -out gen_voluntary_exit_ssz.go
//go:generate go run ../../../cmd/sszgen -type SignedVoluntaryExit -out gen_signed_voluntary_exit_ssz.go
//go:generate go run ../../../cmd/sszgen -type Validator -out gen_validator_ssz.go
//go:generate go run ../../../cmd/sszgen -type Withdrawal -out gen_withdrawal_ssz.go
//go:generate go run ../../../cmd/sszgen -type ExecutionPayloadCapella -out gen_execution_payload_capella_ssz.go
//go:generate go run ../../../cmd/sszgen -type ExecutionPayloadHeaderCapella -out gen_execution_payload_header_capella_ssz.go
//go:generate go run ../../../cmd/sszgen -type ExecutionPayloadDeneb -out gen_execution_payload_deneb_ssz.go
//go:generate go run ../../../cmd/sszgen -type ExecutionPayloadHeaderDeneb -out gen_execution_payload_header_deneb_ssz.go
//go:generate go run ../../../cmd/sszgen -type BeaconState -out gen_beacon_state_ssz.go
//go:generate go run ../../../cmd/sszgen -type BeaconStateCapella -out gen_beacon_state_capella_ssz.go
//go:generate go run ../../../cmd/sszgen -type BeaconBlockBody -out gen_beacon_block_body_ssz.go
//go:generate go run ../../../cmd/sszgen -type BeaconBlockBodyAltair -out gen_beacon_block_body_altair_ssz.go
//go:generate go run ../../../cmd/sszgen -type BeaconBlockBodyBellatrix -out gen_beacon_block_body_bellatrix_ssz.go
//go:generate go run ../../../cmd/sszgen -type BeaconBlockBodyCapella -out gen_beacon_block_body_capella_ssz.go
//go:generate go run ../../../cmd/sszgen -type BeaconBlockBodyDeneb -out gen_beacon_block_body_deneb_ssz.go
//go:generate go run ../../../cmd/sszgen -type BeaconBlock -out gen_beacon_block_ssz.go
//go:generate go run -cover ../../../cmd/sszgen -type Checkpoint -out gen_checkpoint_ssz.go
//go:generate go run -cover ../../../cmd/sszgen -type AttestationData -out gen_attestation_data_ssz.go
//go:generate go run -cover ../../../cmd/sszgen -type BeaconBlockHeader -out gen_beacon_block_header_ssz.go
//go:generate go run -cover ../../../cmd/sszgen -type BLSToExecutionChange -out gen_bls_to_execution_change_ssz.go
//go:generate go run -cover ../../../cmd/sszgen -type Attestation -out gen_attestation_ssz.go
//go:generate go run -cover ../../../cmd/sszgen -type AggregateAndProof -out gen_aggregate_and_proof_ssz.go
//go:generate go run -cover ../../../cmd/sszgen -type DepositData -out gen_deposit_data_ssz.go
//go:generate go run -cover ../../../cmd/sszgen -type DepositMessage -out gen_deposit_message_ssz.go
//go:generate go run -cover ../../../cmd/sszgen -type Deposit -out gen_deposit_ssz.go
//go:generate go run -cover ../../../cmd/sszgen -type Eth1Block -out gen_eth1_block_ssz.go
//go:generate go run -cover ../../../cmd/sszgen -type Eth1Data -out gen_eth1_data_ssz.go
//go:generate go run -cover ../../../cmd/sszgen -type ExecutionPayload -out gen_execution_payload_ssz.go
//go:generate go run -cover ../../../cmd/sszgen -type ExecutionPayloadHeader -out gen_execution_payload_header_ssz.go
//go:generate go run -cover ../../../cmd/sszgen -type Fork -out gen_fork_ssz.go
//go:generate go run -cover ../../../cmd/sszgen -type HistoricalBatch -out gen_historical_batch_ssz.go
//go:generate go run -cover ../../../cmd/sszgen -type HistoricalSummary -out gen_historical_summary_ssz.go
//go:generate go run -cover ../../../cmd/sszgen -type IndexedAttestation -out gen_indexed_attestation_ssz.go
//go:generate go run -cover ../../../cmd/sszgen -type AttesterSlashing -out gen_attester_slashing_ssz.go
//go:generate go run -cover ../../../cmd/sszgen -type PendingAttestation -out gen_pending_attestation_ssz.go
//go:generate go run -cover ../../../cmd/sszgen -type SignedBeaconBlockHeader -out gen_signed_beacon_block_header_ssz.go
//go:generate go run -cover ../../../cmd/sszgen -type ProposerSlashing -out gen_proposer_slashing_ssz.go
//go:generate go run -cover ../../../cmd/sszgen -type SignedBLSToExecutionChange -out gen_signed_bls_to_execution_change_ssz.go
//go:generate go run -cover ../../../cmd/sszgen -type SyncAggregate -out gen_sync_aggregate_ssz.go
//go:generate go run -cover ../../../cmd/sszgen -type SyncCommittee -out gen_sync_committee_ssz.go
//go:generate go run -cover ../../../cmd/sszgen -type VoluntaryExit -out gen_voluntary_exit_ssz.go
//go:generate go run -cover ../../../cmd/sszgen -type SignedVoluntaryExit -out gen_signed_voluntary_exit_ssz.go
//go:generate go run -cover ../../../cmd/sszgen -type Validator -out gen_validator_ssz.go
//go:generate go run -cover ../../../cmd/sszgen -type Withdrawal -out gen_withdrawal_ssz.go
//go:generate go run -cover ../../../cmd/sszgen -type ExecutionPayloadCapella -out gen_execution_payload_capella_ssz.go
//go:generate go run -cover ../../../cmd/sszgen -type ExecutionPayloadHeaderCapella -out gen_execution_payload_header_capella_ssz.go
//go:generate go run -cover ../../../cmd/sszgen -type ExecutionPayloadDeneb -out gen_execution_payload_deneb_ssz.go
//go:generate go run -cover ../../../cmd/sszgen -type ExecutionPayloadHeaderDeneb -out gen_execution_payload_header_deneb_ssz.go
//go:generate go run -cover ../../../cmd/sszgen -type BeaconState -out gen_beacon_state_ssz.go
//go:generate go run -cover ../../../cmd/sszgen -type BeaconStateCapella -out gen_beacon_state_capella_ssz.go
//go:generate go run -cover ../../../cmd/sszgen -type BeaconBlockBody -out gen_beacon_block_body_ssz.go
//go:generate go run -cover ../../../cmd/sszgen -type BeaconBlockBodyAltair -out gen_beacon_block_body_altair_ssz.go
//go:generate go run -cover ../../../cmd/sszgen -type BeaconBlockBodyBellatrix -out gen_beacon_block_body_bellatrix_ssz.go
//go:generate go run -cover ../../../cmd/sszgen -type BeaconBlockBodyCapella -out gen_beacon_block_body_capella_ssz.go
//go:generate go run -cover ../../../cmd/sszgen -type BeaconBlockBodyDeneb -out gen_beacon_block_body_deneb_ssz.go
//go:generate go run -cover ../../../cmd/sszgen -type BeaconBlock -out gen_beacon_block_ssz.go

// Slot is an alias of uint64
type Slot uint64
Expand Down
6 changes: 3 additions & 3 deletions tests/testtypes/consensus-spec-tests/types_variation.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"math/big"
)

//go:generate go run ../../../cmd/sszgen -type WithdrawalVariation -out gen_withdrawal_variation_ssz.go
//go:generate go run ../../../cmd/sszgen -type HistoricalBatchVariation -out gen_historical_batch_variation_ssz.go
//go:generate go run ../../../cmd/sszgen -type ExecutionPayloadVariation -out gen_execution_payload_variation_ssz.go
//go:generate go run -cover ../../../cmd/sszgen -type WithdrawalVariation -out gen_withdrawal_variation_ssz.go
//go:generate go run -cover ../../../cmd/sszgen -type HistoricalBatchVariation -out gen_historical_batch_variation_ssz.go
//go:generate go run -cover ../../../cmd/sszgen -type ExecutionPayloadVariation -out gen_execution_payload_variation_ssz.go

type WithdrawalVariation struct {
Index uint64
Expand Down

0 comments on commit be92ed9

Please sign in to comment.