Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@ jobs:
id: version
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT

- name: Verify tag and single-header are in sync
run: |
expected_tag="$(make -s print_version_tag)"
if [ "${GITHUB_REF_NAME}" != "${expected_tag}" ]; then
echo "error: tag ${GITHUB_REF_NAME} does not match src/api.h version ${expected_tag}"
exit 1
fi

make ffc.h
git diff --exit-code ffc.h

- name: Generate checksum
run: sha256sum ffc.h > ffc.h.sha256

Expand Down
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: test example exhaustive fetch-supplemental-data supplemental_tests
.PHONY: test example exhaustive fetch-supplemental-data supplemental_tests print_version_tag

# Detect linux and define _DEFAULT_SOURCE if so
UNAME_S := $(shell uname -s)
Expand All @@ -17,6 +17,12 @@ out/example: ffc.h example.c | out
example: out/example
./out/example

out/print_version_tag: tools/print_version_tag.c src/api.h | out
clang $(CLANG_FLAGS) -I. tools/print_version_tag.c -o out/print_version_tag

print_version_tag: out/print_version_tag
./out/print_version_tag

out:
mkdir -p out

Expand Down Expand Up @@ -61,4 +67,3 @@ exhaustive: out/test_exhaustive_runner

out/test_exhaustive_runner: ffc.h test_src/test_exhaustive.c | out
clang $(CLANG_FLAGS) -pthread -I. -Itest_src test_src/test_exhaustive.c -o out/test_exhaustive_runner -lm

8 changes: 7 additions & 1 deletion ffc.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,14 @@ extern "C" {

#define FFC_VERSION_YEAR 26
#define FFC_VERSION_MONTH 03
#define FFC_VERSION_BUILD 02
#define FFC_VERSION_BUILD 03
#define FFC_VERSION ((FFC_VERSION_YEAR << 16) | (FFC_VERSION_MONTH << 8) | (FFC_VERSION_BUILD))
#define FFC_VERSION_STRINGIFY_(x) #x
#define FFC_VERSION_STRINGIFY(x) FFC_VERSION_STRINGIFY_(x)
#define FFC_VERSION_STRING \
FFC_VERSION_STRINGIFY(FFC_VERSION_YEAR) "." \
FFC_VERSION_STRINGIFY(FFC_VERSION_MONTH) "." \
FFC_VERSION_STRINGIFY(FFC_VERSION_BUILD)

#include <stddef.h>
#include <stdint.h>
Expand Down
8 changes: 7 additions & 1 deletion src/api.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,14 @@

#define FFC_VERSION_YEAR 26
#define FFC_VERSION_MONTH 03
#define FFC_VERSION_BUILD 02
#define FFC_VERSION_BUILD 03
#define FFC_VERSION ((FFC_VERSION_YEAR << 16) | (FFC_VERSION_MONTH << 8) | (FFC_VERSION_BUILD))
#define FFC_VERSION_STRINGIFY_(x) #x
#define FFC_VERSION_STRINGIFY(x) FFC_VERSION_STRINGIFY_(x)
#define FFC_VERSION_STRING \
FFC_VERSION_STRINGIFY(FFC_VERSION_YEAR) "." \
FFC_VERSION_STRINGIFY(FFC_VERSION_MONTH) "." \
FFC_VERSION_STRINGIFY(FFC_VERSION_BUILD)

#include <stddef.h>
#include <stdint.h>
Expand Down
8 changes: 8 additions & 0 deletions tools/print_version_tag.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include "src/api.h"

#include <stdio.h>

int main(void) {
printf("v" FFC_VERSION_STRING "\n");
return 0;
}
10 changes: 5 additions & 5 deletions tools/release.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
set -e
set -x

if [ -z "$1" ]; then
echo "usage: $0 <n>"
if [ "$#" -ne 0 ]; then
echo "usage: $0"
exit 1
fi

year="$(date +%y)"
month="$(date +%m)"
tag="v${year}.${month}.$1"
make ffc.h
git diff --exit-code ffc.h
tag="$(make -s print_version_tag)"

echo "releasing version ${tag}"
git tag -a "${tag}" -m "${tag}"
Expand Down