File tree Expand file tree Collapse file tree 6 files changed +45
-9
lines changed
Expand file tree Collapse file tree 6 files changed +45
-9
lines changed Original file line number Diff line number Diff line change 1818 id : version
1919 run : echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT
2020
21+ - name : Verify tag and single-header are in sync
22+ run : |
23+ expected_tag="$(make -s print_version_tag)"
24+ if [ "${GITHUB_REF_NAME}" != "${expected_tag}" ]; then
25+ echo "error: tag ${GITHUB_REF_NAME} does not match src/api.h version ${expected_tag}"
26+ exit 1
27+ fi
28+
29+ make ffc.h
30+ git diff --exit-code ffc.h
31+
2132 - name : Generate checksum
2233 run : sha256sum ffc.h > ffc.h.sha256
2334
Original file line number Diff line number Diff line change 1- .PHONY : test example exhaustive fetch-supplemental-data supplemental_tests
1+ .PHONY : test example exhaustive fetch-supplemental-data supplemental_tests print_version_tag
22
33# Detect linux and define _DEFAULT_SOURCE if so
44UNAME_S := $(shell uname -s)
@@ -17,6 +17,12 @@ out/example: ffc.h example.c | out
1717example : out/example
1818 ./out/example
1919
20+ out/print_version_tag : tools/print_version_tag.c src/api.h | out
21+ clang $(CLANG_FLAGS ) -I. tools/print_version_tag.c -o out/print_version_tag
22+
23+ print_version_tag : out/print_version_tag
24+ ./out/print_version_tag
25+
2026out :
2127 mkdir -p out
2228
@@ -61,4 +67,3 @@ exhaustive: out/test_exhaustive_runner
6167
6268out/test_exhaustive_runner : ffc.h test_src/test_exhaustive.c | out
6369 clang $(CLANG_FLAGS ) -pthread -I. -Itest_src test_src/test_exhaustive.c -o out/test_exhaustive_runner -lm
64-
Original file line number Diff line number Diff line change @@ -115,8 +115,14 @@ extern "C" {
115115
116116#define FFC_VERSION_YEAR 26
117117#define FFC_VERSION_MONTH 03
118- #define FFC_VERSION_BUILD 02
118+ #define FFC_VERSION_BUILD 03
119119#define FFC_VERSION ((FFC_VERSION_YEAR << 16 ) | (FFC_VERSION_MONTH << 8 ) | (FFC_VERSION_BUILD))
120+ #define FFC_VERSION_STRINGIFY_ (x ) #x
121+ #define FFC_VERSION_STRINGIFY (x ) FFC_VERSION_STRINGIFY_(x)
122+ #define FFC_VERSION_STRING \
123+ FFC_VERSION_STRINGIFY (FFC_VERSION_YEAR) "." \
124+ FFC_VERSION_STRINGIFY(FFC_VERSION_MONTH) "." \
125+ FFC_VERSION_STRINGIFY(FFC_VERSION_BUILD)
120126
121127#include < stddef.h>
122128#include < stdint.h>
Original file line number Diff line number Diff line change 33
44#define FFC_VERSION_YEAR 26
55#define FFC_VERSION_MONTH 03
6- #define FFC_VERSION_BUILD 02
6+ #define FFC_VERSION_BUILD 03
77#define FFC_VERSION ((FFC_VERSION_YEAR << 16 ) | (FFC_VERSION_MONTH << 8 ) | (FFC_VERSION_BUILD))
8+ #define FFC_VERSION_STRINGIFY_ (x ) #x
9+ #define FFC_VERSION_STRINGIFY (x ) FFC_VERSION_STRINGIFY_(x)
10+ #define FFC_VERSION_STRING \
11+ FFC_VERSION_STRINGIFY (FFC_VERSION_YEAR) "." \
12+ FFC_VERSION_STRINGIFY(FFC_VERSION_MONTH) "." \
13+ FFC_VERSION_STRINGIFY(FFC_VERSION_BUILD)
814
915#include < stddef.h>
1016#include < stdint.h>
Original file line number Diff line number Diff line change 1+ #include "src/api.h"
2+
3+ #include <stdio.h>
4+
5+ int main (void ) {
6+ printf ("v" FFC_VERSION_STRING "\n" );
7+ return 0 ;
8+ }
Original file line number Diff line number Diff line change 11set -e
22set -x
33
4- if [ -z " $1 " ]; then
5- echo " usage: $0 <n> "
4+ if [ " $# " -ne 0 ]; then
5+ echo " usage: $0 "
66 exit 1
77fi
88
9- year= " $( date +%y ) "
10- month= " $( date +%m ) "
11- tag=" v ${year} . ${month} . $1 "
9+ make ffc.h
10+ git diff --exit-code ffc.h
11+ tag=" $( make -s print_version_tag ) "
1212
1313echo " releasing version ${tag} "
1414git tag -a " ${tag} " -m " ${tag} "
You can’t perform that action at this time.
0 commit comments