Skip to content

CI: Use macos-14 for GMT Dev Tests workflow #12148

CI: Use macos-14 for GMT Dev Tests workflow

CI: Use macos-14 for GMT Dev Tests workflow #12148

Workflow file for this run

# Code lint and style checks
#
# This workflow runs code style and lint checks to check if the codes have
# consistent code style and are high-quality.
#
# It is run on every commit to the main and pull request branches. It is also
# scheduled to run daily on the main branch.
#
name: Style Checks
on:
push:
branches: [ main ]
pull_request:
# Schedule daily tests
schedule:
- cron: '0 0 * * *'
jobs:
style_check:
name: Style Checks
runs-on: ubuntu-latest
steps:
# Checkout current git repository
- name: Checkout
uses: actions/checkout@v4.1.1
# Setup Python
- name: Set up Python
uses: actions/setup-python@v5.0.0
with:
python-version: '3.12'
- name: Install packages
run: |
python -m pip install ruff
python -m pip list
sudo apt-get install dos2unix
- name: Formatting check (ruff)
run: make check
- name: Ensure files use UNIX line breaks and have 644 permission
run: |
find . -type f -not -path '*/\.git/*' -exec grep -Iq . {} \; -exec dos2unix --quiet {} \;
find . -type f -not -path '*/\.git/*' -exec grep -Iq . {} \; -exec chmod 644 {} \;
if [[ $(git ls-files -m) ]]; then git --no-pager diff HEAD; exit 1; fi
- name: Ensure example scripts have at least one code block separator
run: |
grep --files-without-match '# %%' $(find 'examples' -name '*.py') > output.txt
nfiles=$(wc --lines output.txt | awk '{print $1}')
if [[ $nfiles > 0 ]]; then
echo "Code block separator '# %%' is required in following example files:"
cat output.txt
rm output.txt
exit $nfiles
fi