diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1dfd563..f1fd28b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -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 }} @@ -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/codecov-action@v4.5.0 diff --git a/tests/testtypes/consensus-spec-tests/types_basics.go b/tests/testtypes/consensus-spec-tests/types_basics.go index 380c143..f7dfc4f 100644 --- a/tests/testtypes/consensus-spec-tests/types_basics.go +++ b/tests/testtypes/consensus-spec-tests/types_basics.go @@ -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 diff --git a/tests/testtypes/consensus-spec-tests/types_consensus.go b/tests/testtypes/consensus-spec-tests/types_consensus.go index 6e65119..13d06ea 100644 --- a/tests/testtypes/consensus-spec-tests/types_consensus.go +++ b/tests/testtypes/consensus-spec-tests/types_consensus.go @@ -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 diff --git a/tests/testtypes/consensus-spec-tests/types_variation.go b/tests/testtypes/consensus-spec-tests/types_variation.go index 7cc6b5c..ef6b6e3 100644 --- a/tests/testtypes/consensus-spec-tests/types_variation.go +++ b/tests/testtypes/consensus-spec-tests/types_variation.go @@ -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