mirror of
https://github.com/nestriness/cdc-file-transfer.git
synced 2026-01-30 12:25:35 +02:00
[cdc_rsync] Add build id to github workflow
This commit is contained in:
@@ -64,7 +64,10 @@ cc_library(
|
||||
|
||||
cc_library(
|
||||
name = "build_version",
|
||||
srcs = ["build_version.cc"],
|
||||
hdrs = ["build_version.h"],
|
||||
# This definition should be replaced by release flow.
|
||||
copts = ["-DCDC_BUILD_VERSION=DEV"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
|
||||
9
common/build_version.cc
Normal file
9
common/build_version.cc
Normal file
@@ -0,0 +1,9 @@
|
||||
#include "build_version.h"
|
||||
|
||||
#ifdef CDC_BUILD_VERSION
|
||||
#define TO_STR(arg) #arg
|
||||
#define TO_STR_VALUE(arg) TO_STR(arg)
|
||||
const char* BUILD_VERSION = TO_STR_VALUE(CDC_BUILD_VERSION);
|
||||
#else
|
||||
const char* BUILD_VERSION = DEV_BUILD_VERSION;
|
||||
#endif
|
||||
@@ -1,10 +1,7 @@
|
||||
#ifndef BUILD_VERSION
|
||||
#ifndef COMMON_BUILD_VERSION_H_
|
||||
#define COMMON_BUILD_VERSION_H_
|
||||
|
||||
#define DEV_BUILD_VERSION "DEV"
|
||||
#ifdef CDC_BUILD_VERSION
|
||||
#define TO_STR(arg) #arg
|
||||
#define TO_STR_VALUE(arg) TO_STR(arg)
|
||||
#define BUILD_VERSION TO_STR_VALUE(CDC_BUILD_VERSION)
|
||||
#else
|
||||
#define BUILD_VERSION DEV_BUILD_VERSION
|
||||
#endif
|
||||
#endif
|
||||
extern const char* BUILD_VERSION;
|
||||
|
||||
#endif
|
||||
@@ -124,9 +124,30 @@ TEST_F(GameletComponentTest, GetChangedComponents) {
|
||||
|
||||
// Force equal timestamps, so that we don't depend on when the files were
|
||||
// actually written to everyone's drives.
|
||||
// Also force set build_version to developer since otherwise we would skip
|
||||
// component size check.
|
||||
ASSERT_EQ(components.size(), other_components.size());
|
||||
for (size_t n = 0; n < components.size(); ++n) {
|
||||
other_components[n].modified_time = components[n].modified_time;
|
||||
other_components[n].build_version = DEV_BUILD_VERSION;
|
||||
|
||||
EXPECT_NE(components, other_components);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(GameletComponentTest, GetChangedComponents_BuildVersionChanged) {
|
||||
std::vector<GameletComponent> components;
|
||||
EXPECT_OK(GameletComponent::Get({valid_component_path_}, &components));
|
||||
|
||||
std::vector<GameletComponent> other_components;
|
||||
EXPECT_OK(GameletComponent::Get({other_component_path_}, &other_components));
|
||||
|
||||
ASSERT_EQ(components.size(), other_components.size());
|
||||
for (size_t n = 0; n < components.size(); ++n) {
|
||||
other_components[n].modified_time = components[n].modified_time;
|
||||
other_components[n].size = components[n].size;
|
||||
components[n].build_version = "build_version";
|
||||
other_components[n].build_version = "other_build_version";
|
||||
|
||||
EXPECT_NE(components, other_components);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user