Skip to content

Unify commit link styling #76

Unify commit link styling

Unify commit link styling #76

Workflow file for this run

name: Build, Test, and Deploy Dashboard
on:
push:
branches:
- main
pull_request:
branches:
- main
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-and-test:
runs-on: ubuntu-latest
name: Build and test testboard
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install fpm
run: |
wget -q 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
- name: Install gfortran
run: sudo apt-get update && sudo apt-get install -y gfortran
- name: Generate embedded templates
run: make templates
- name: Build testboard
run: fpm build
- name: Run unit tests
run: fpm test
- name: Create test artifacts (mock PNG and JPG files)
run: |
mkdir -p build/test/plots
# Create some dummy image files for demonstration
# In a real project, these would be generated by your tests
if command -v convert &> /dev/null; then
convert -size 400x300 xc:blue -pointsize 40 -fill white -gravity center \
-annotate +0+0 "Test Plot 1\n(PNG)" build/test/plots/test1.png
convert -size 400x300 xc:green -pointsize 40 -fill white -gravity center \
-annotate +0+0 "Test Plot 2\n(PNG)" build/test/plots/test2.png
convert -size 400x300 xc:red -pointsize 40 -fill white -gravity center \
-annotate +0+0 "Test Plot 3\n(JPG)" build/test/plots/test3.jpg
convert -size 400x300 xc:orange -pointsize 40 -fill white -gravity center \
-annotate +0+0 "Test Plot 4\n(JPEG)" build/test/plots/test4.jpeg
else
# Fallback: create minimal valid image files
echo "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==" | base64 -d > build/test/plots/test1.png
echo "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==" | base64 -d > build/test/plots/test2.png
# Minimal valid JPEG (1x1 pixel)
echo "/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAIBAQIBAQICAgICAgICAwUDAwMDAwYEBAMFBwYHBwcGBwcICQsJCAgKCAcHCg0KCgsMDAwMBwkODw0MDgsMDAz/2wBDAQICAgMDAwYDAwYMCAcIDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAz/wAARCAABAAEDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlbaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD9/KKKKAP/2Q==" | base64 -d > build/test/plots/test3.jpg
echo "/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAIBAQIBAQICAgICAgICAwUDAwMDAwYEBAMFBwYHBwcGBwcICQsJCAgKCAcHCg0KCgsMDAwMBwkODw0MDgsMDAz/2wBDAQICAgMDAwYDAwYMCAcIDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAz/wAARCAABAAEDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlbaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD9/KKKKAP/2Q==" | base64 -d > build/test/plots/test4.jpeg
fi
- name: Upload test artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: test-plots
path: |
build/test/**/*.png
build/test/**/*.jpg
build/test/**/*.jpeg
if-no-files-found: warn
dashboard:
name: Build test dashboard
needs: build-and-test
if: ${{ needs.build-and-test.result == 'success' }}
runs-on: ubuntu-latest
permissions:
contents: read
pages: write
id-token: write
pull-requests: read
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install fpm
run: |
wget -q 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
- name: Install gfortran
run: sudo apt-get update && sudo apt-get install -y gfortran
- name: Generate embedded templates
run: make templates
- name: Build testboard executable
run: fpm build
- name: Download image artifacts
uses: actions/download-artifact@v4
with:
name: test-plots
path: image-artifacts
- name: Restore previously published site
run: |
set -euo pipefail
rm -rf dashboard
mkdir -p dashboard
if curl --silent --head --fail https://lazy-fortran.github.io/testboard/test/index.html >/dev/null 2>&1; then
echo "Existing site found, restoring..."
rm -rf dashboard_existing
mkdir -p dashboard_existing
if wget --quiet --recursive --no-parent --no-host-directories --cut-dirs=2 \
--directory-prefix dashboard_existing https://lazy-fortran.github.io/testboard/test/ 2>&1; then
if [ -n "$(ls -A dashboard_existing)" ]; then
echo "Restoring $(find dashboard_existing -type f | wc -l) files"
rsync -a dashboard_existing/ dashboard/
fi
else
echo "wget failed, starting with empty dashboard"
fi
rm -rf dashboard_existing
else
echo "No existing site found, starting fresh"
fi
- name: Generate dashboard
env:
GH_TOKEN: ${{ github.token }}
GITHUB_HEAD_REF: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || '' }}
GITHUB_PR_NUMBER: ${{ github.event_name == 'pull_request' && github.event.pull_request.number || '' }}
GITHUB_PR_TITLE: ${{ github.event_name == 'pull_request' && github.event.pull_request.title || '' }}
GITHUB_PR_DRAFT: ${{ github.event_name == 'pull_request' && github.event.pull_request.draft || '' }}
run: |
set -euo pipefail
fpm run testboard -- \
--image-root image-artifacts \
--output dashboard \
--branch "${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref_name }}" \
--commit "${{ github.sha }}" \
--run-id "${{ github.run_id }}" \
--repo "${{ github.repository }}" \
--project-name "testboard"
- name: Configure Pages
if: ${{ github.event_name == 'push' }}
uses: actions/configure-pages@v5
- name: Upload dashboard artifact
uses: actions/upload-pages-artifact@v3
with:
path: './dashboard'
deploy:
name: Deploy to GitHub Pages
needs: dashboard
runs-on: ubuntu-latest
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy
id: deployment
uses: actions/deploy-pages@v4