Skip to content

fix: clip annotation arrows to plot boundary (fixes #1693) (#1819) #3007

fix: clip annotation arrows to plot boundary (fixes #1693) (#1819)

fix: clip annotation arrows to plot boundary (fixes #1693) (#1819) #3007

Workflow file for this run

name: CI
on:
push:
branches: ["main"]
pull_request:
permissions:
contents: read
# Cancel previous runs on new commits to the same PR/branch
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: ${{ matrix.os == 'ubuntu-latest' && 'test' || 'test (windows)' }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Root artifact hygiene check (Issue #990)
if: matrix.os == 'ubuntu-latest'
run: bash scripts/check_root_artifacts.sh
# ---------- Ubuntu setup ----------
- name: Cache and install apt packages (Ubuntu)
if: matrix.os == 'ubuntu-latest'
uses: awalsh128/cache-apt-pkgs-action@v1.5.3
with:
packages: gfortran cmake make ffmpeg pngcheck python3-pil imagemagick poppler-utils ghostscript
version: 1
- name: Install FPM (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
cd /tmp
wget --timeout=30 https://github.com/fortran-lang/fpm/releases/download/v0.12.0/fpm-0.12.0-linux-x86_64-gcc-12 \
&& chmod +x fpm-0.12.0-linux-x86_64-gcc-12 \
&& sudo mv fpm-0.12.0-linux-x86_64-gcc-12 /usr/local/bin/fpm \
&& fpm --version || exit 1
# Python setup for utility scripts (Ubuntu)
- name: Setup Python (Ubuntu)
if: matrix.os == 'ubuntu-latest'
uses: actions/setup-python@v5
with:
python-version: '3.x'
# ---------- Windows setup ----------
- name: Configure git line endings (Windows)
if: runner.os == 'Windows'
shell: bash
run: git config --global core.autocrlf input
- name: Define MSYS2_DIR (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
# Place a reusable MSYS2 install next to the workspace (works on C: or D:)
$msys2Dir = Join-Path (Split-Path $env:GITHUB_WORKSPACE -Parent) '_msys2'
echo "MSYS2_DIR=$msys2Dir" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Cache full MSYS2 installation (Windows)
if: runner.os == 'Windows'
id: msys2_cache
uses: actions/cache@v4
with:
path: ${{ env.MSYS2_DIR }}
key: ${{ runner.os }}-msys2-full-MINGW64-${{ hashFiles('.github/workflows/ci.yml') }}
restore-keys: |
${{ runner.os }}-msys2-full-MINGW64-
- name: Detect existing MSYS2 installation
if: runner.os == 'Windows'
id: msys2_detect
shell: pwsh
run: |
$root = "$env:MSYS2_DIR"
$msysPath = Join-Path $root 'msys64'
if (Test-Path $msysPath) {
"present=true" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
Write-Host "Detected existing MSYS2 at $msysPath"
} else {
"present=false" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
Write-Host "No existing MSYS2 at $msysPath"
}
- name: Setup MSYS2 (Windows)
if: runner.os == 'Windows' && steps.msys2_detect.outputs.present != 'true'
id: msys2
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true # Only runs when MSYS2 not present; safe to update
path-type: inherit
cache: true # Use builtin package cache for reliability
release: true # Install from release tarball into location
location: ${{ env.MSYS2_DIR }}
install: >-
mingw-w64-x86_64-gcc-fortran
mingw-w64-x86_64-gcc
mingw-w64-x86_64-ffmpeg
mingw-w64-x86_64-imagemagick
git
- name: Add MinGW to PATH (Windows)
if: runner.os == 'Windows'
run: |
$msysLoc = "${{ steps.msys2.outputs.msys2-location }}"
if (-not $msysLoc) { $msysLoc = "$env:MSYS2_DIR" }
echo (Join-Path $msysLoc 'mingw64\bin') | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
shell: pwsh
- name: Install FPM (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$msysLoc = "${{ steps.msys2.outputs.msys2-location }}"
if (-not $msysLoc) { $msysLoc = "$env:MSYS2_DIR" }
$destDir = Join-Path $msysLoc 'mingw64\bin'
if (-not (Test-Path $destDir)) { New-Item -ItemType Directory -Path $destDir -Force | Out-Null }
$dest = Join-Path $destDir 'fpm.exe'
if (Test-Path $dest) {
& $dest --version
} else {
Invoke-WebRequest -UseBasicParsing -Uri "https://github.com/fortran-lang/fpm/releases/download/v0.12.0/fpm-0.12.0-windows-x86_64-gcc-12.exe" -OutFile $dest
& $dest --version
}
# ---------- Build & Test ----------
- name: Create test directories
shell: bash
run: |
mkdir -p build/test
mkdir -p test/output
mkdir -p output/example/fortran/basic_plots
mkdir -p output/example/fortran/legend_demo
mkdir -p output/example/fortran/marker_demo
- name: Verify file size compliance (limits)
if: matrix.os == 'ubuntu-latest'
run: make verify-size-compliance
- name: Build project
shell: bash
run: |
if [ "$RUNNER_OS" = "Windows" ]; then
fpm build --flag "-cpp -fmax-stack-var-size=65536 -Wno-implicit-interface"
else
make build
fi
- name: Build required examples for tests (Linux only)
if: matrix.os == 'ubuntu-latest'
shell: bash
run: |
make example ARGS="basic_plots"
make example ARGS="legend_demo"
make example ARGS="contour_demo"
make example ARGS="marker_demo"
make example ARGS="format_string_demo"
- name: Verify artifacts (Linux only)
if: matrix.os == 'ubuntu-latest'
shell: bash
run: |
make verify-artifacts
- name: Run tests
shell: bash
run: |
if [ "$RUNNER_OS" = "Windows" ]; then
export FORTPLOT_ENABLE_FFMPEG=1
export OMP_NUM_THREADS=2
timeout 15m fpm test --flag "-cpp -fmax-stack-var-size=65536 -Wno-implicit-interface"
else
export FORTPLOT_ENABLE_FFMPEG=0
export OMP_NUM_THREADS=2
mkdir -p /tmp/test
timeout 10m make test-ci
fi
- name: Run antialiasing quality tests with ImageMagick (optional)
shell: bash
run: |
if magick -version > /dev/null 2>&1; then
if [ "$RUNNER_OS" = "Windows" ]; then
timeout 5m fpm test test_antialiasing_restoration --flag "-cpp -fmax-stack-var-size=65536 -Wno-implicit-interface" || echo "Antialiasing tests optional on Windows"
timeout 5m fpm test test_antialiasing_comprehensive --flag "-cpp -fmax-stack-var-size=65536 -Wno-implicit-interface" || echo "Antialiasing tests optional on Windows"
else
fpm test test_antialiasing_restoration
fpm test test_antialiasing_comprehensive
fi
else
echo "ImageMagick not found - skipping graphics quality tests"
fi
- name: Test FPM and CMake examples (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
timeout 2m fpm test --target test_system_fpm_example || echo "FPM example test skipped due to timeout"
timeout 2m fpm test --target test_system_cmake_example || echo "CMake example test skipped due to timeout"
flang-macos:
name: flang (macOS)
if: github.event_name == 'pull_request'
runs-on: macos-15
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Cache Homebrew downloads (macOS)
uses: actions/cache@v4
with:
path: ~/Library/Caches/Homebrew
key: ${{ runner.os }}-${{ runner.arch }}-homebrew-flang-fpm-${{ hashFiles('.github/workflows/ci.yml') }}
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-homebrew-flang-fpm-
- name: Install flang and fpm (macOS)
shell: bash
env:
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
run: |
brew list --versions flang >/dev/null 2>&1 || brew install flang
brew list --versions fpm >/dev/null 2>&1 || brew install fpm
flang-new --version
fpm --version
- name: Verify flang build (macOS)
shell: bash
run: |
fpm build --compiler=flang-new
# Coverage job removed intentionally; no coverage analysis for now