From f449967b7662b1e866792b4227cd51f9292eb94e Mon Sep 17 00:00:00 2001 From: sidore_m Date: Wed, 25 Jun 2025 00:48:05 +0200 Subject: [PATCH 1/4] fix(test): fix valgrind build and run no sanitize flag, rm extra -g --- Makefile | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 072ff3f..1ddf337 100644 --- a/Makefile +++ b/Makefile @@ -9,8 +9,8 @@ SRC = libtrasher/trasher.c CFLAGS = -Wall -Wextra LDFLAGS = -L. -ltrasher LDFLAGS_CUNIT = -L. -ltrasher -lcunit -CDEBUGFLAGS = -Wall -Wextra -g -CDEBUGFLAGSFSANITIZE = -Wall -Wextra -g -fsanitize=address +CDEBUGFLAGS = -O0 -Wall -Wextra -g +CDEBUGFLAGSFSANITIZE = -O0 -Wall -Wextra -g -fsanitize=address TEST_SRC_KO = test/test_mem_ko.c TEST_SRC_OK = test/test_mem_ok.c @@ -47,12 +47,15 @@ lib_debug: clean ar -rc ${LIB} trasher.o rm trasher.o - lib_debug_fsanitize: clean ${CC} -c ${SRC} ${CDEBUGFLAGSFSANITIZE} -o trasher.o ar -rc ${LIB} trasher.o rm trasher.o +lib_debug_valgrind: clean + ${CC} -c ${SRC} ${CDEBUGFLAGS} -o trasher.o + ar -rc ${LIB} trasher.o + rm trasher.o test: lib_debug test_ok test_simple test_mix_pools_names_ids test_memcheck_ok_fsanitize test_memcheck_ok_valgrind test_unit clean @@ -61,48 +64,48 @@ test_all_except_cunit_tests: lib_debug test_ok test_simple test_mix_pools_names_ test_ko: lib_debug cp libtrasher/trasher.h test/ - $(CC) $(CDEBUGFLAGS) -g ${TEST_SRC_KO} -o ${TEST_BIN_KO} $(LDFLAGS) + $(CC) $(CDEBUGFLAGS) ${TEST_SRC_KO} -o ${TEST_BIN_KO} $(LDFLAGS) ./${TEST_BIN_KO} test_ok: lib_debug cp libtrasher/trasher.h test/ - $(CC) $(CDEBUGFLAGS) -g ${TEST_SRC_OK} -o ${TEST_BIN_OK} $(LDFLAGS) + $(CC) $(CDEBUGFLAGS) ${TEST_SRC_OK} -o ${TEST_BIN_OK} $(LDFLAGS) ./${TEST_BIN_OK} test_simple: lib_debug cp libtrasher/trasher.h test/ - $(CC) $(CDEBUGFLAGS) -g ${TEST_SRC_SIMPLE} -o ${TEST_BIN_SIMPLE} $(LDFLAGS) + $(CC) $(CDEBUGFLAGS) ${TEST_SRC_SIMPLE} -o ${TEST_BIN_SIMPLE} $(LDFLAGS) ./${TEST_BIN_SIMPLE} test_mix_pools_names_ids: lib_debug cp libtrasher/trasher.h test/ - $(CC) $(CDEBUGFLAGS) -g ${TEST_SRC_MIX} -o ${TEST_BIN_MIX} $(LDFLAGS) + $(CC) $(CDEBUGFLAGS) ${TEST_SRC_MIX} -o ${TEST_BIN_MIX} $(LDFLAGS) ./${TEST_BIN_MIX} test_memcheck_ok_fsanitize: lib_debug_fsanitize cp libtrasher/trasher.h test/ - $(CC) $(CDEBUGFLAGSFSANITIZE) -g ${TEST_SRC_MEM} -o ${TEST_BIN_MEM} $(LDFLAGS) + $(CC) $(CDEBUGFLAGSFSANITIZE) ${TEST_SRC_MEM} -o ${TEST_BIN_MEM} $(LDFLAGS) ./${TEST_BIN_MEM} -test_memcheck_ok_valgrind: lib_debug +test_memcheck_ok_valgrind: lib_debug_valgrind cp libtrasher/trasher.h test/ - $(CC) $(CDEBUGFLAGSFSANITIZE) -g ${TEST_SRC_MEM} -o ${TEST_BIN_MEM} $(LDFLAGS) + $(CC) $(CDEBUGFLAGS) ${TEST_SRC_MEM} -o ${TEST_BIN_MEM} $(LDFLAGS) valgrind -s --track-origins=yes --leak-check=full ./${TEST_BIN_MEM} # Requires CUNIT lib installed test_unit: lib_debug cp libtrasher/trasher.h test/ - $(CC) $(CDEBUGFLAGS) -g $(TEST_SRC_UNIT) -o $(TEST_BIN_UNIT) $(LDFLAGS_CUNIT) + $(CC) $(CDEBUGFLAGS) $(TEST_SRC_UNIT) -o $(TEST_BIN_UNIT) $(LDFLAGS_CUNIT) ./$(TEST_BIN_UNIT) test_unit_verbose: lib_debug cp libtrasher/trasher.h test/ - $(CC) $(CDEBUGFLAGS) -D SHOW_POOLS_STATUS -g $(TEST_SRC_UNIT) -o $(TEST_BIN_UNIT) $(LDFLAGS) + $(CC) $(CDEBUGFLAGS) -D SHOW_POOLS_STATUS $(TEST_SRC_UNIT) -o $(TEST_BIN_UNIT) $(LDFLAGS) ./$(TEST_BIN_UNIT) test_free_5x: lib_debug cp libtrasher/trasher.h test/ - $(CC) $(CDEBUGFLAGS) -g $(TEST_SRC_FREE_5X) -o $(TEST_BIN_FREE_5X) $(LDFLAGS) + $(CC) $(CDEBUGFLAGS) $(TEST_SRC_FREE_5X) -o $(TEST_BIN_FREE_5X) $(LDFLAGS) ./${TEST_BIN_FREE_5X} test_perf: lib From 3bba4cb32160360092310e1798911c39be7dc582 Mon Sep 17 00:00:00 2001 From: sidore_m Date: Wed, 25 Jun 2025 01:17:28 +0200 Subject: [PATCH 2/4] feat(test): refactor output with macro suppression --- Makefile | 20 +++++++------- test/test_free_x5.c | 17 ++++++++---- test/test_mem_ko.c | 22 +++++++++++---- test/test_mem_mix_pools_names_ids.c | 10 ++++++- test/test_mem_ok.c | 43 +++++++++++++++++------------ test/test_mem_simple.c | 9 +++++- test/test_mem_unit_test.c | 13 +++++++-- test/test_mem_valgrind.c | 28 ++++++++++++------- test/test_speed_perf.c | 15 +++++++--- 9 files changed, 120 insertions(+), 57 deletions(-) diff --git a/Makefile b/Makefile index 1ddf337..adcb76f 100644 --- a/Makefile +++ b/Makefile @@ -64,53 +64,53 @@ test_all_except_cunit_tests: lib_debug test_ok test_simple test_mix_pools_names_ test_ko: lib_debug cp libtrasher/trasher.h test/ - $(CC) $(CDEBUGFLAGS) ${TEST_SRC_KO} -o ${TEST_BIN_KO} $(LDFLAGS) + $(CC) -DSUPPRESS_PRINT $(CDEBUGFLAGS) ${TEST_SRC_KO} -o ${TEST_BIN_KO} $(LDFLAGS) ./${TEST_BIN_KO} test_ok: lib_debug cp libtrasher/trasher.h test/ - $(CC) $(CDEBUGFLAGS) ${TEST_SRC_OK} -o ${TEST_BIN_OK} $(LDFLAGS) + $(CC) -DSUPPRESS_PRINT $(CDEBUGFLAGS) ${TEST_SRC_OK} -o ${TEST_BIN_OK} $(LDFLAGS) ./${TEST_BIN_OK} test_simple: lib_debug cp libtrasher/trasher.h test/ - $(CC) $(CDEBUGFLAGS) ${TEST_SRC_SIMPLE} -o ${TEST_BIN_SIMPLE} $(LDFLAGS) + $(CC) -DSUPPRESS_PRINT $(CDEBUGFLAGS) ${TEST_SRC_SIMPLE} -o ${TEST_BIN_SIMPLE} $(LDFLAGS) ./${TEST_BIN_SIMPLE} test_mix_pools_names_ids: lib_debug cp libtrasher/trasher.h test/ - $(CC) $(CDEBUGFLAGS) ${TEST_SRC_MIX} -o ${TEST_BIN_MIX} $(LDFLAGS) + $(CC) -DSUPPRESS_PRINT $(CDEBUGFLAGS) ${TEST_SRC_MIX} -o ${TEST_BIN_MIX} $(LDFLAGS) ./${TEST_BIN_MIX} test_memcheck_ok_fsanitize: lib_debug_fsanitize cp libtrasher/trasher.h test/ - $(CC) $(CDEBUGFLAGSFSANITIZE) ${TEST_SRC_MEM} -o ${TEST_BIN_MEM} $(LDFLAGS) + $(CC) -DSUPPRESS_PRINT $(CDEBUGFLAGSFSANITIZE) ${TEST_SRC_MEM} -o ${TEST_BIN_MEM} $(LDFLAGS) ./${TEST_BIN_MEM} test_memcheck_ok_valgrind: lib_debug_valgrind cp libtrasher/trasher.h test/ - $(CC) $(CDEBUGFLAGS) ${TEST_SRC_MEM} -o ${TEST_BIN_MEM} $(LDFLAGS) + $(CC) -DSUPPRESS_PRINT $(CDEBUGFLAGS) ${TEST_SRC_MEM} -o ${TEST_BIN_MEM} $(LDFLAGS) valgrind -s --track-origins=yes --leak-check=full ./${TEST_BIN_MEM} # Requires CUNIT lib installed test_unit: lib_debug cp libtrasher/trasher.h test/ - $(CC) $(CDEBUGFLAGS) $(TEST_SRC_UNIT) -o $(TEST_BIN_UNIT) $(LDFLAGS_CUNIT) + $(CC) -DSUPPRESS_PRINT $(CDEBUGFLAGS) $(TEST_SRC_UNIT) -o $(TEST_BIN_UNIT) $(LDFLAGS_CUNIT) ./$(TEST_BIN_UNIT) test_unit_verbose: lib_debug cp libtrasher/trasher.h test/ - $(CC) $(CDEBUGFLAGS) -D SHOW_POOLS_STATUS $(TEST_SRC_UNIT) -o $(TEST_BIN_UNIT) $(LDFLAGS) + $(CC) -DSUPPRESS_PRINT $(CDEBUGFLAGS) -D SHOW_POOLS_STATUS $(TEST_SRC_UNIT) -o $(TEST_BIN_UNIT) $(LDFLAGS) ./$(TEST_BIN_UNIT) test_free_5x: lib_debug cp libtrasher/trasher.h test/ - $(CC) $(CDEBUGFLAGS) $(TEST_SRC_FREE_5X) -o $(TEST_BIN_FREE_5X) $(LDFLAGS) + $(CC) -DSUPPRESS_PRINT $(CDEBUGFLAGS) $(TEST_SRC_FREE_5X) -o $(TEST_BIN_FREE_5X) $(LDFLAGS) ./${TEST_BIN_FREE_5X} test_perf: lib cp libtrasher/trasher.h test/ - $(CC) $(CFLAGS) -g $(TEST_SRC_PERF) -o $(TEST_BIN_PERF) $(LDFLAGS) + $(CC) -DSUPPRESS_PRINT $(CFLAGS) -g $(TEST_SRC_PERF) -o $(TEST_BIN_PERF) $(LDFLAGS) ./${TEST_BIN_PERF} clean: diff --git a/test/test_free_x5.c b/test/test_free_x5.c index 842407e..fd995ed 100644 --- a/test/test_free_x5.c +++ b/test/test_free_x5.c @@ -1,15 +1,22 @@ #include "trasher.h" +// Power Printing macro to make pretty tests +#ifdef SUPPRESS_PRINT +#define POOL_STATUS() ((void)0) +#else +#define POOL_STATUS() pool_status() +#endif + int main() { // Test multiple free - pool_status(); + POOL_STATUS(); free_pool_all(); - pool_status(); + POOL_STATUS(); free_pool_all(); - pool_status(); + POOL_STATUS(); free_pool_all(); mem(100); - pool_status(); + POOL_STATUS(); free_pool_all(); - pool_status(); + POOL_STATUS(); } diff --git a/test/test_mem_ko.c b/test/test_mem_ko.c index fe054ac..dedff34 100644 --- a/test/test_mem_ko.c +++ b/test/test_mem_ko.c @@ -1,8 +1,18 @@ #include #include "trasher.h" +// Power Printing macro to make pretty tests +#ifdef SUPPRESS_PRINT +#define PRINT(fmt, ...) ((void)0) +#define POOL_STATUS() ((void)0) +#else +#define PRINT(fmt, ...) printf(fmt, ##__VA_ARGS__) +#define POOL_STATUS() pool_status() +#endif + + int main() { - printf("Hello World!\n\n"); + PRINT("Hello World!\n\n"); size_t buffer_size = 10000; char* buffer = mem(buffer_size); @@ -13,7 +23,7 @@ int main() { j++; } - // printf("%s\n", buffer); + // PRINT("%s\n", buffer); int* array_IDS = mem_id(33, 5); @@ -22,12 +32,12 @@ int main() { array_IDS[4] = 25; array_ids_2[3] = 232; - printf("%d\n", array_ids_2[3]); + PRINT("%d\n", array_ids_2[3]); free_id(2); - printf("array_IDS access : %d\n", array_IDS[4]); - printf("array_ids_2 : %d", array_ids_2[3]); // Memcheck Valgrind shoudl notify invalid read! + PRINT("array_IDS access : %d\n", array_IDS[4]); + PRINT("array_ids_2 : %d", array_ids_2[3]); // Memcheck Valgrind shoudl notify invalid read! // Named Pools : Tag int *speed_array = mem_name(20, "cars"); @@ -41,7 +51,7 @@ int main() { free_name("cars"); - pool_status(); + POOL_STATUS(); free_name("cars"); diff --git a/test/test_mem_mix_pools_names_ids.c b/test/test_mem_mix_pools_names_ids.c index a0e4a98..5a3eafe 100644 --- a/test/test_mem_mix_pools_names_ids.c +++ b/test/test_mem_mix_pools_names_ids.c @@ -1,13 +1,21 @@ #include #include "trasher.h" +// Power Printing macro to make pretty tests +#ifdef SUPPRESS_PRINT +#define POOL_STATUS() ((void)0) +#else +#define POOL_STATUS() pool_status() +#endif + + int main() { mem_id(50, 1); mem(100); mem_name(200, "Buffers"); mem_id(300, 2); - pool_status(); + POOL_STATUS(); return 0; } diff --git a/test/test_mem_ok.c b/test/test_mem_ok.c index 070a499..cf4c8d6 100644 --- a/test/test_mem_ok.c +++ b/test/test_mem_ok.c @@ -1,6 +1,15 @@ #include #include "trasher.h" +// Power Printing macro to make pretty tests +#ifdef SUPPRESS_PRINT +#define PRINT(fmt, ...) ((void)0) +#define POOL_STATUS() ((void)0) +#else +#define PRINT(fmt, ...) printf(fmt, ##__VA_ARGS__) +#define POOL_STATUS() pool_status() +#endif + struct btree { int value; struct btree *left; @@ -18,7 +27,7 @@ struct btree *init_btree(int value, struct btree *left, struct btree *right) { void display_btree(struct btree *root, char* suffix) { if (root == NULL) return; - printf("%d %s", root->value, suffix); + PRINT("%d %s", root->value, suffix); display_btree(root->left, " "); display_btree(root->right, " \n"); } @@ -27,7 +36,7 @@ int main() { mem_id(50, 1); - printf("Test mem stupid usage\n"); + PRINT("Test mem stupid usage\n"); // You should get the result of mem to do something with it mem(10); @@ -37,41 +46,41 @@ int main() { mem_id(100, 1); - pool_status(); + POOL_STATUS(); - printf("Test mem normal usage\n"); + PRINT("Test mem normal usage\n"); - printf("Small Tree\n"); + PRINT("Small Tree\n"); struct btree *root_small = init_btree(30, NULL, NULL); display_btree(root_small, "\n"); - printf("Big Tree Init"); + PRINT("Big Tree Init"); struct btree *root = init_btree(0, init_btree(2, NULL, NULL), init_btree(42, NULL, init_btree(67, NULL, NULL))); - printf("Print B Tree\n"); + PRINT("Print B Tree\n"); display_btree(root, "\n"); - printf("Check pool\n"); - pool_status(); + PRINT("Check pool\n"); + POOL_STATUS(); - printf("Free btrees pool\n"); + PRINT("Free btrees pool\n"); free_name("btrees"); - pool_status(); - printf("Create new pools, id=10, then with name=arguments\n"); + POOL_STATUS(); + PRINT("Create new pools, id=10, then with name=arguments\n"); mem_id(16, 10); mem_name(64, "arguments"); - printf("Re-use free pool 'btrees', with a new tree:\n"); + PRINT("Re-use free pool 'btrees', with a new tree:\n"); struct btree *other_root = init_btree(5, init_btree(2, NULL, NULL), init_btree(6, NULL, NULL)); display_btree(other_root, "\n"); - printf("Check pool\n"); - pool_status(); + PRINT("Check pool\n"); + POOL_STATUS(); - printf("Free all\n"); + PRINT("Free all\n"); free_pool_all(); // Should close all pool functions for memory safety - printf("End Test\n"); + PRINT("End Test\n"); } diff --git a/test/test_mem_simple.c b/test/test_mem_simple.c index 64f8fde..a68ad6a 100644 --- a/test/test_mem_simple.c +++ b/test/test_mem_simple.c @@ -1,6 +1,13 @@ #include #include "trasher.h" +// Power Printing macro to make pretty tests +#ifdef SUPPRESS_PRINT +#define POOL_STATUS() ((void)0) +#else +#define POOL_STATUS() pool_status() +#endif + int main() { size_t buffer_size = 10; char* buffer = mem(buffer_size); @@ -14,7 +21,7 @@ int main() { mem(50); - pool_status(); + POOL_STATUS(); free_pool_all(); return 0; diff --git a/test/test_mem_unit_test.c b/test/test_mem_unit_test.c index a2be75e..02c8a9e 100644 --- a/test/test_mem_unit_test.c +++ b/test/test_mem_unit_test.c @@ -3,6 +3,13 @@ #include #include "trasher.h" +// Power Printing macro to make pretty tests +#ifdef SUPPRESS_PRINT +#define POOL_STATUS() ((void)0) +#else +#define POOL_STATUS() pool_status() +#endif + // Init Suite int init_unit_test_suite() { // Open, init,vars or file used by tests @@ -19,7 +26,7 @@ void print_pools(); #ifdef SHOW_POOLS_STATUS void print_pools() { - pool_status(); + POOL_STATUS(); } #endif #ifndef SHOW_POOLS_STATUS @@ -122,11 +129,11 @@ void testPoolNameBehaviour() { mem_name(2, "HOMES"); mem_name(84, "HOMES"); CU_ASSERT_NOT_EQUAL(pool_give_id_from_name("HOMES"), 0); - // pool_status_debug(); + // POOL_STATUS_debug(); CU_ASSERT_EQUAL(pool_give_id_from_name("HOMES"), 1); CU_ASSERT_EQUAL(pool_give_number_blocks(0), 0); CU_ASSERT_EQUAL(pool_give_number_blocks(1), 3); - // pool_status_debug(); + // POOL_STATUS_debug(); free_pool_all(); } diff --git a/test/test_mem_valgrind.c b/test/test_mem_valgrind.c index dc7a6ff..57472c9 100644 --- a/test/test_mem_valgrind.c +++ b/test/test_mem_valgrind.c @@ -1,17 +1,25 @@ #include #include "trasher.h" -int main() { +// Power Printing macro to make pretty tests +#ifdef SUPPRESS_PRINT +#define PRINT(fmt, ...) ((void)0) +#define POOL_STATUS() ((void)0) +#else +#define PRINT(fmt, ...) printf(fmt, ##__VA_ARGS__) +#define POOL_STATUS() pool_status() +#endif +int main() { unsigned sizes_len = 0; const int sizes[] = { 1, 16, 32, 64, 128, 512, 1024, 1024, 1024, 1024, 2048, 2048, 16384, 20000, 65536, 0 }; while (sizes[sizes_len++] != 0) {} mem(42); - pool_status(); + POOL_STATUS(); - printf("Generate Mo of data into multiple pools\n"); + PRINT("Generate Mo of data into multiple pools\n"); const char* names[] = { "CARS", "PLANES", "BIKES", "BOATS", NULL }; @@ -21,16 +29,16 @@ int main() { } } - printf("Filled pools...\n"); + PRINT("Filled pools...\n"); - pool_status(); + POOL_STATUS(); - printf("Free all\n"); + PRINT("Free all\n"); free_pool_all(); // Should close all pool functions for memory safety - printf("Second free should do no effects\n"); + PRINT("Second free should do no effects\n"); free_pool_all(); // Should close all pool functions for memory safety - printf("Generate Mo of data into multiple pools... 2nd phase\n"); + PRINT("Generate Mo of data into multiple pools... 2nd phase\n"); const char* names_2nd[] = { "HOMES", "COMPANIES", "STOCKS", "TABLES", "PENS", "SYSTEMS", "WEBS", NULL }; const int sizes_2nd[] = { 16, 1024, 1024, 2048, 2048, 16384, 200, 200, 200, 200, 200, 636, 0 }; @@ -49,7 +57,7 @@ int main() { free_pool(); - pool_status(); + POOL_STATUS(); free_id(5); free_id(5); @@ -58,5 +66,5 @@ int main() { free_pool_all(); // Should close all pool functions for memory safety - printf("End Test\n"); + PRINT("End Test\n"); } diff --git a/test/test_speed_perf.c b/test/test_speed_perf.c index 5cc1a77..d65db95 100644 --- a/test/test_speed_perf.c +++ b/test/test_speed_perf.c @@ -3,6 +3,13 @@ #include "trasher.h" +// Power Printing macro to make pretty tests +#ifdef SUPPRESS_PRINT +#define PRINT(fmt, ...) ((void)0) +#else +#define PRINT(fmt, ...) printf(fmt, ##__VA_ARGS__) +#endif + #define BLOCKS 2000 #define BLOCK_SIZE 1024 @@ -45,15 +52,15 @@ double speed_tester(const char *lib_tested, void (*function_to_test)()) { cpu_time_used_sum += ((double) (end - start)) / CLOCKS_PER_SEC; } cpu_time_used_average = cpu_time_used_sum / i; - printf("Average time for %10s lib : %f\n", lib_tested, cpu_time_used_average); + PRINT("Average time for %10s lib : %f\n", lib_tested, cpu_time_used_average); return cpu_time_used_average; } int main() { - printf("Test timing and diff with malloc basic\n"); + PRINT("Test timing and diff with malloc basic\n"); double time_avg_malloc = speed_tester("malloc", test_malloc); double time_avg_trasher = speed_tester("trasher", test_trasher); double pourcentage = (time_avg_malloc / time_avg_trasher) * 100; - printf("Difference in %% : %f %% less efficient than malloc\n", pourcentage); - printf("End Test\n"); + PRINT("Difference in %% : %f %% less efficient than malloc\n", pourcentage); + PRINT("End Test\n"); } From 1e4234cd359e31179187dc82f77bd7a778c07d14 Mon Sep 17 00:00:00 2001 From: sidore_m Date: Wed, 25 Jun 2025 01:36:09 +0200 Subject: [PATCH 3/4] feat(actions): update workflow to allow auto release --- .github/workflows/makefile.yml | 14 ------------ .github/workflows/release.yml | 41 ++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/makefile.yml b/.github/workflows/makefile.yml index e7d2a15..cbac6aa 100644 --- a/.github/workflows/makefile.yml +++ b/.github/workflows/makefile.yml @@ -32,17 +32,3 @@ jobs: - name: Tests (except CUnit test's) run: make test_all_except_cunit_tests -# test: -# runs-on: ubuntu-latest -# -# steps: -# - uses: actions/checkout@v3 -# -# - name: Cunit -# run: git clone https://github.com/wpdk/CUnit ; cd CUnit ; make -# -# - name: Run tests ok -# run: make test_ok -# -# - name: Run all tests -# run: make test diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..a2c5314 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,41 @@ +name: Release + +on: + push: + tags: + - 'v*' + branches: [ "master" ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Make + run: | + make + mkdir -p release + cp libtrasher.a release/ + + - name: Create a GitHub Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + draft: false + prerelease: false + + - name: Upload Release Asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./release/libtrasher.a + asset_name: libtrasher.a + asset_content_type: application/x-archive + From 38682b988f7946283b8eca9361bdf76560f5ec44 Mon Sep 17 00:00:00 2001 From: sidore_m Date: Wed, 25 Jun 2025 01:47:34 +0200 Subject: [PATCH 4/4] fix(actions): fix trigger for version release --- .github/workflows/release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a2c5314..1787c48 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,7 +4,8 @@ on: push: tags: - 'v*' - branches: [ "master" ] + branches: + - master jobs: build: