Skip to content

Commit

Permalink
Fix Github Actions docs check
Browse files Browse the repository at this point in the history
  • Loading branch information
taliaga committed Jul 4, 2022
1 parent ab28907 commit 9aafb25
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/delivery.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Build and Test
shell: bash
run: |
git clone --depth 1 --recursive --shallow-submodules https://github.com/eth-cscs/sarus && cd sarus
git clone --branch ${GITHUB_REF_NAME} --depth 1 --recursive --shallow-submodules https://github.com/eth-cscs/sarus && cd sarus
CI/check_host.sh
. ./CI/utility_docker_functions.bash Release gcc.cmake $(pwd) $(pwd)/cache standalone-build standalone-run
sarus-build-images
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- name: Check Version and Docs
shell: bash
run: |
git clone --depth 1 --recursive --shallow-submodules https://github.com/eth-cscs/sarus && cd sarus
git clone --branch ${GITHUB_REF_NAME} --depth 1 --recursive --shallow-submodules https://github.com/eth-cscs/sarus && cd sarus
. CI/utility_docker_functions.bash
sarus-build-images
sarus-check-version-and-docs $(pwd)
2 changes: 1 addition & 1 deletion .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Build and Test
shell: bash
run: |
git clone --depth 1 --recursive --shallow-submodules https://github.com/eth-cscs/sarus && cd sarus
git clone --branch ${GITHUB_REF_NAME} --depth 1 --recursive --shallow-submodules https://github.com/eth-cscs/sarus && cd sarus
CI/check_host.sh
. ./CI/utility_docker_functions.bash Release gcc.cmake $(pwd) $(pwd)/cache standalone-build standalone-run
sarus-build-images
Expand Down
2 changes: 1 addition & 1 deletion CI/check_version_from_cmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ check_git_repo() {
fail_on_error "failed to run CMake on git repo"
log " Config successful, checking version string"
version_from_cmake=$(cat cmake_stdout.txt | grep "Sarus version" | awk -F ": " '{print $2}')
version_from_git=$(git describe --tags --dirty)
version_from_git=$(git describe --tags --dirty --always)
log " Version from CMake: ${version_from_cmake}"
log " Version from git : ${version_from_git}"
[ "$version_from_git" == "$version_from_cmake" ]
Expand Down
2 changes: 1 addition & 1 deletion CI/run_documentation_build_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ check_git_repo() {
log "Building documentation from git repository"
cp -rT $sarus_src_dir /home/docker/sarus-git
cd /home/docker/sarus-git/doc
version_from_git=$(git describe --tags --dirty)
version_from_git=$(git describe --tags --dirty --always)
check_docs ${version_from_git}
}

Expand Down
21 changes: 17 additions & 4 deletions CI/src/integration_tests/test_command_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,21 @@ def test_command_version(self):
self._test_command_version(command=["sarus", "version"])

def _test_command_version(self, command):
out = subprocess.check_output(command).decode()
lines = util.command_output_without_trailing_new_lines(out)
try:
out = subprocess.check_output(command).decode()
lines = util.command_output_without_trailing_new_lines(out)
except Exception:
assert False, "failed to get sarus version from sarus"

assert len(lines) == 1
assert re.match(r"^\d+(\.\d+)?(\.\d+)?([-+]+.*)?$", lines[0]) is not None \
or lines[0] == "VERSION-NOT-AVAILABLE"
version_obtained = lines[0]

# This test is intended to test either an official release or a development version, both of which are always git describable.
# The git working directory (/sarus-source) is set in CI scripts.
try:
out = subprocess.check_output(["git", "-C", "/sarus-source", "describe", "--tags", "--dirty", "--always"]).decode()
version_expected = util.command_output_without_trailing_new_lines(out)[0]
except Exception as e:
assert False, f"failed to get sarus version from git. {e}"

assert version_obtained == version_expected
2 changes: 1 addition & 1 deletion CI/utility_functions.bash
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ build_sarus_archive() {

mkdir -p ${build_dir} && cd ${build_dir}

local git_description=$(git describe --tags --dirty || echo "git_version_not_available")
local git_description=$(git describe --tags --dirty --always || echo "git_version_not_available")
local prefix_dir=${build_dir}/install/${git_description}-${build_type}
cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchain_files/${toolchain_file} \
-DCMAKE_BUILD_TYPE=${build_type} \
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ include_directories(${Boost_INCLUDE_DIRS})

find_program(GIT_PATH git)

execute_process(COMMAND ${GIT_PATH} -C ${CMAKE_SOURCE_DIR} describe --tags --dirty
execute_process(COMMAND ${GIT_PATH} -C ${CMAKE_SOURCE_DIR} describe --tags --dirty --always
OUTPUT_VARIABLE LATEST_GIT_TAG
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT LATEST_GIT_TAG)
Expand Down
2 changes: 1 addition & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
# Retrieve the version string
# Search git repo for added information about untagged snapshots
try:
full_version = subprocess.check_output(["git", "describe", '--tags'],
full_version = subprocess.check_output(["git", "describe", '--tags', '--dirty', '--always'],
universal_newlines=True)
except:
full_version = "VERSION-NOT-AVAILABLE"
Expand Down

0 comments on commit 9aafb25

Please sign in to comment.