From d00de8fb1eb7b3f7eaf003141570a215e6514a77 Mon Sep 17 00:00:00 2001 From: project-repo Date: Thu, 6 Apr 2023 22:32:23 +0200 Subject: [PATCH] Add Hashes.md test --- README.md | 7 +++++++ meson.build | 1 + test/hashes-md | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+) create mode 100644 test/hashes-md diff --git a/README.md b/README.md index f933980..e66bfe1 100644 --- a/README.md +++ b/README.md @@ -312,6 +312,11 @@ There are four test suites: * Note that this is only expected to pass just before a release. This checks mostly administrative things to check that a release is ready. + * Note that non-auto tests are files in `release-non-auto-checks` + and have to contain the release version and current date in + YYYY-mm-dd format on seperate lines. This is our imperfect attempt + to guarantee some hard-to-automate checks are carried out before + a release is undertaken. Every commit should pass at least the basic and devel suites. @@ -457,6 +462,7 @@ The release procedure outlines the process for a release to occur. * [ ] `git pull origin development` * [ ] `git push origin development` * [ ] New semantic version number determined + * [ ] `meson test -C build/` just to get an overview * [ ] Adjust version number * [ ] meson.build * [ ] git tag @@ -503,6 +509,7 @@ The release procedure outlines the process for a release to occur. * [ ] `git commit` and insert message * [ ] `git tag -u keyid version HEAD` and insert message * [ ] `git tag -v version` and check output + * [ ] `meson test -C build/` last check before the push * [ ] `git push --tags origin master` * [ ] `git checkout development` (merge to development depends on whether release was a hotfix) * [ ] `git merge master` diff --git a/meson.build b/meson.build index 393a439..65576da 100644 --- a/meson.build +++ b/meson.build @@ -355,4 +355,5 @@ test('Scan-build (static analysis)', find_program('test/scan-build'), env : [ '' test('Arguments', find_program('test/arguments'), args : [ meson.project_version() ], env : [ ''.join('MESONCURRENTCONFIGDIR=', meson.current_source_dir()) ], suite: 'basic') test('Environment Variables', find_program('test/environment-variables'), env : [ ''.join('MESONCURRENTCONFIGDIR=', meson.current_source_dir()) ], suite: 'basic') test('Semantic versioning', find_program('test/versions'), args : [ meson.project_version() ], env : [ ''.join('MESONCURRENTCONFIGDIR=', meson.current_source_dir()) ], suite: 'release') +test('Hashes.md', find_program('test/hashes-md'), args : [ meson.project_version() ], env : [ ''.join('MESONCURRENTCONFIGDIR=', meson.current_source_dir()) ], suite: 'release') test('Non-auto tests', find_program('test/non-auto-tests'), args : [ meson.project_version() ], env : [ ''.join('MESONCURRENTCONFIGDIR=', meson.current_source_dir()) ], suite: 'release') diff --git a/test/hashes-md b/test/hashes-md new file mode 100644 index 0000000..30a5529 --- /dev/null +++ b/test/hashes-md @@ -0,0 +1,53 @@ +#!/bin/bash +# Copyright 2023, project-repo and the cagebreak contributors +# SPDX-License-Identifier: MIT + +VERSION=$1 +RESULT=0 + +# shellcheck disable=2164 +cd "${MESONCURRENTCONFIGDIR}" + +cb256=$(sha256sum build/cagebreak | cut -d " " -f1 ) +cb256man1=$(sha256sum build/cagebreak.1 | cut -d " " -f1 ) +cb256man5=$(sha256sum build/cagebreak-config.5 | cut -d " " -f1 ) +cb256man7=$(sha256sum build/cagebreak-socket.7 | cut -d " " -f1 ) +cb512=$(sha512sum build/cagebreak | cut -d " " -f1 ) +cb512man1=$(sha512sum build/cagebreak.1 | cut -d " " -f1 ) +cb512man5=$(sha512sum build/cagebreak-config.5 | cut -d " " -f1 ) +cb512man7=$(sha512sum build/cagebreak-socket.7 | cut -d " " -f1 ) + +hashesdoc=$(head -21 Hashes.md) + +testdoc="# Hashes + +$VERSION cagebreak + + * sha 256: ${cb256} + * sha 512: ${cb512} + +$VERSION cagebreak.1 + + * sha 256: ${cb256man1} + * sha 512: ${cb512man1} + +$VERSION cagebreak-config.5 + + * sha 256: ${cb256man5} + * sha 512: ${cb512man5} + +$VERSION cagebreak-socket.7 + + * sha 256: ${cb256man7} + * sha 512: ${cb512man7}" + +# email key +if [[ "${hashesdoc}" = "${testdoc}" ]] +then + echo "[x] Hashes.md" +else + RESULT=1 + echo "[ ] Hashes.md" +fi + +exit "${RESULT}"