Skip to content

Add GMT_IS_IMAGE case #10967

Add GMT_IS_IMAGE case

Add GMT_IS_IMAGE case #10967

Workflow file for this run

# Validate the consistency of the codes.
#
# It checks:
#
# 1. PSL_strings.h is up-to-date
# 2. gmt_enum_dict.h is up-to-date
# 3. Module purposes are up-to-date
# 4. GMT_VERSION_YEAR matches the current year
# 5. Bash scripts have executable permissions
# 6. Bash scripts have correct shebang (#!/usr/bin/env bash)
on:
push:
branches:
- master
- '[0-9]+.[0-9]+'
paths:
- 'src/**'
- 'cmake/**'
- '**/*.sh'
- '.github/workflows/code-validator.yml'
pull_request:
paths:
- 'src/**'
- 'cmake/**'
- '**/*.sh'
- '.github/workflows/code-validator.yml'
name: Code Validator
jobs:
code-validator:
name: Code Validator
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/[email protected]
- name: Check PSL_strings.h
run: |
cd src/
bash gmt_make_PSL_strings.sh
if [[ $(git ls-files -m) ]]; then git --no-pager diff HEAD; exit 1; fi
cd ..
- name: Check gmt_enum_dict.h
run: |
cd src/
bash gmt_make_enum_dicts.sh
if [[ $(git ls-files -m) ]]; then git --no-pager diff HEAD; exit 1; fi
cd ..
- name: Check module purposes
run: |
cd src/
bash gmt_make_module_purpose.sh
if [[ $(git ls-files -m) ]]; then git --no-pager diff HEAD; exit 1; fi
cd ..
- name: Check GMT version year
run: |
current_year=$(date +%Y)
gmt_version_year=$(grep GMT_VERSION_YEAR cmake/ConfigDefault.cmake | awk -F'"' '{print $2}')
if [ "$current_year" != "$gmt_version_year" ]; then exit 1; fi
- name: Check execute permission of bash scripts
run: |
scripts=$(find . -name "*.sh" ! -path "./share/tools/gmt_functions.sh" ! -executable)
if [[ -n "$scripts" ]]; then
echo "Following bash scripts do not have execute permission:"
echo "$scripts"
exit 1
fi
- name: Check shebang of bash scripts
run: |
error=0
echo "Checking shebang in bash scripts..."
for file in $(find . -name "*.sh" ! -path "./share/tools/gmt_functions.sh" ! -path "./test/invalidate_modules.sh"); do
if [[ "$(head -n1 "$file")" != '#!/usr/bin/env bash' ]]; then
((++error))
echo "$file: incorrect shebang '$(head -n1 "$file")'"
fi
done
if [[ $error -gt 0 ]]; then echo "Found $error files with incorrect shebang"; exit 1; fi