Skip to content

Commit

Permalink
ci: check if types for frontend are up-to-date (#986)
Browse files Browse the repository at this point in the history
When `backend` makes changes this script will make sure
that the affected `typescript types` have been updated for
the `frontend`.

See: BEDS-90
  • Loading branch information
guybrush authored Oct 18, 2024
1 parent 1d4f7d4 commit d43767c
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 86 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/backend-converted-types-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Backend-Converted-Types-Check
on:
push:
paths:
- 'backend/**'
- 'frontend/types/api/**'
branches:
- main
- staging
pull_request:
paths:
- 'backend/**'
- 'frontend/types/api/**'
branches:
- '*'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read
pull-requests: read
checks: write

jobs:
build:
name: converted-types-check
runs-on: self-hosted
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version-file: 'backend/go.mod'
cache-dependency-path: 'backend/go.sum'
- name: Check if all backend-types have been converted to frontend-types
working-directory: backend
run: |
currHash=$(find ../frontend/types/api -type f -print0 | sort -z | xargs -0 sha1sum | sha256sum | head -c 64)
make frontend-types
newHash=$(find ../frontend/types/api -type f -print0 | sort -z | xargs -0 sha1sum | sha256sum | head -c 64)
if [ "$currHash" != "$newHash" ]; then
echo "frontend-types have changed, please commit the changes"
exit 1
fi
89 changes: 3 additions & 86 deletions frontend/types/api/machine_metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,92 +5,9 @@ import type { ApiDataResponse } from './common'
//////////
// source: machine_metrics.go

export interface MachineMetricSystem {
timestamp?: number /* uint64 */;
exporter_version?: string;
/**
* system
*/
cpu_cores?: number /* uint64 */;
cpu_threads?: number /* uint64 */;
cpu_node_system_seconds_total?: number /* uint64 */;
cpu_node_user_seconds_total?: number /* uint64 */;
cpu_node_iowait_seconds_total?: number /* uint64 */;
cpu_node_idle_seconds_total?: number /* uint64 */;
memory_node_bytes_total?: number /* uint64 */;
memory_node_bytes_free?: number /* uint64 */;
memory_node_bytes_cached?: number /* uint64 */;
memory_node_bytes_buffers?: number /* uint64 */;
disk_node_bytes_total?: number /* uint64 */;
disk_node_bytes_free?: number /* uint64 */;
disk_node_io_seconds?: number /* uint64 */;
disk_node_reads_total?: number /* uint64 */;
disk_node_writes_total?: number /* uint64 */;
network_node_bytes_total_receive?: number /* uint64 */;
network_node_bytes_total_transmit?: number /* uint64 */;
misc_node_boot_ts_seconds?: number /* uint64 */;
misc_os?: string;
/**
* do not store in bigtable but include them in generated model
*/
machine?: string;
}
export interface MachineMetricValidator {
timestamp?: number /* uint64 */;
exporter_version?: string;
/**
* process
*/
cpu_process_seconds_total?: number /* uint64 */;
memory_process_bytes?: number /* uint64 */;
client_name?: string;
client_version?: string;
client_build?: number /* uint64 */;
sync_eth2_fallback_configured?: boolean;
sync_eth2_fallback_connected?: boolean;
/**
* validator
*/
validator_total?: number /* uint64 */;
validator_active?: number /* uint64 */;
/**
* do not store in bigtable but include them in generated model
*/
machine?: string;
}
export interface MachineMetricNode {
timestamp?: number /* uint64 */;
exporter_version?: string;
/**
* process
*/
cpu_process_seconds_total?: number /* uint64 */;
memory_process_bytes?: number /* uint64 */;
client_name?: string;
client_version?: string;
client_build?: number /* uint64 */;
sync_eth2_fallback_configured?: boolean;
sync_eth2_fallback_connected?: boolean;
/**
* node
*/
disk_beaconchain_bytes_total?: number /* uint64 */;
network_libp2p_bytes_total_receive?: number /* uint64 */;
network_libp2p_bytes_total_transmit?: number /* uint64 */;
network_peers_connected?: number /* uint64 */;
sync_eth1_connected?: boolean;
sync_eth2_synced?: boolean;
sync_beacon_head_slot?: number /* uint64 */;
sync_eth1_fallback_configured?: boolean;
sync_eth1_fallback_connected?: boolean;
/**
* do not store in bigtable but include them in generated model
*/
machine?: string;
}
export interface MachineMetricsData {
system_metrics: (MachineMetricSystem | undefined)[];
validator_metrics: (MachineMetricValidator | undefined)[];
node_metrics: (MachineMetricNode | undefined)[];
system_metrics: (any /* types.MachineMetricSystem */ | undefined)[];
validator_metrics: (any /* types.MachineMetricValidator */ | undefined)[];
node_metrics: (any /* types.MachineMetricNode */ | undefined)[];
}
export type GetUserMachineMetricsRespone = ApiDataResponse<MachineMetricsData>;

0 comments on commit d43767c

Please sign in to comment.