Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/last_tested_fds_version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
FDS-6.8.0
53 changes: 53 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: CI

on:
push:
branches: [master]
paths:
- "fdsreader/**"
- "tests/**"
- "pyproject.toml"
- ".github/workflows/ci.yml"
pull_request:
paths:
- "fdsreader/**"
- "tests/**"
- "pyproject.toml"

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: pip install ruff
- run: ruff check fdsreader/
- run: ruff format --check fdsreader/

test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
with:
lfs: true
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: Install dependencies
run: pip install -e ".[dev]"
- name: Prepare test cases
run: cd tests/cases && for f in *.tgz; do tar -xzvf "$f"; done
- name: Run tests
run: pytest tests/ --cov=fdsreader --cov-report=xml --cov-report=term-missing
- name: Upload coverage
if: matrix.python-version == '3.12'
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
81 changes: 81 additions & 0 deletions .github/workflows/fds_compat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: FDS Compatibility Check

on:
workflow_dispatch:
inputs:
fds_version:
description: "FDS version tag (e.g. FDS-6.10.1) — leave empty for latest"
required: false
schedule:
- cron: "0 6 * * 1" # Every Monday 06:00 UTC

jobs:
detect-version:
runs-on: ubuntu-latest
outputs:
run_compat: ${{ steps.check.outputs.run_compat }}
fds_version: ${{ steps.check.outputs.fds_version }}
steps:
- uses: actions/checkout@v4
- id: check
run: |
if [ -n "${{ inputs.fds_version }}" ]; then
echo "fds_version=${{ inputs.fds_version }}" >> $GITHUB_OUTPUT
echo "run_compat=true" >> $GITHUB_OUTPUT
else
LATEST=$(gh api repos/firemodels/fds/releases/latest --jq '.tag_name')
LAST=$(cat .github/last_tested_fds_version.txt 2>/dev/null || echo "none")
echo "fds_version=$LATEST" >> $GITHUB_OUTPUT
if [ "$LATEST" != "$LAST" ]; then
echo "run_compat=true" >> $GITHUB_OUTPUT
else
echo "run_compat=false" >> $GITHUB_OUTPUT
fi
fi
env:
GH_TOKEN: ${{ github.token }}

check-compat:
needs: detect-version
if: needs.detect-version.outputs.run_compat == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
lfs: true
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Download FDS
run: |
VERSION=${{ needs.detect-version.outputs.fds_version }}
wget -q https://github.com/firemodels/fds/releases/download/${VERSION}/FDS-${VERSION#FDS-}_SMV-${VERSION#FDS-}_lnx.sh \
-O fds_install.sh || \
wget -q https://github.com/firemodels/fds/releases/download/${VERSION}/FDS-6.10.1_SMV-6.10.1_lnx.sh \
-O fds_install.sh
echo "" | bash fds_install.sh --prefix=$HOME/fds
- name: Run test simulations
run: |
FDS=$HOME/fds/bin/fds_openmp
for dir in tests/cases/fds_inputs/*.fds; do
name=$(basename "$dir" .fds)
mkdir -p /tmp/fds_out/$name
cd /tmp/fds_out/$name
$FDS "$GITHUB_WORKSPACE/$dir" || true
cd $GITHUB_WORKSPACE
done
- name: Install fdsreader and run tests
run: |
pip install ".[dev]"
cd tests/cases && for f in *.tgz; do tar -xzvf "$f"; done
cd ../..
pytest tests/ -v
- name: Update tracked FDS version
if: success()
run: |
echo "${{ needs.detect-version.outputs.fds_version }}" > .github/last_tested_fds_version.txt
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add .github/last_tested_fds_version.txt
git diff --staged --quiet || git commit -m "chore: update last tested FDS version to ${{ needs.detect-version.outputs.fds_version }}"
git push
5 changes: 4 additions & 1 deletion .github/workflows/publish_n_pack.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI

on: push
on:
push:
tags:
- "v*"

jobs:
build:
Expand Down
65 changes: 65 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Release

on:
push:
tags:
- "v*"

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- run: pip install build
- run: python -m build
- uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/

publish-testpypi:
if: contains(github.ref, 'b') || contains(github.ref, 'a') || contains(github.ref, 'rc')
needs: build
runs-on: ubuntu-latest
environment:
name: testpypi
url: https://test.pypi.org/p/fdsreader
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/

publish-pypi:
if: "!contains(github.ref, 'a') && !contains(github.ref, 'b') && !contains(github.ref, 'rc')"
needs: build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/fdsreader
permissions:
id-token: write
contents: write
steps:
- uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- uses: pypa/gh-action-pypi-publish@release/v1
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
gh release create '${{ github.ref_name }}' dist/** \
--repo '${{ github.repository }}' \
--generate-notes
42 changes: 0 additions & 42 deletions .github/workflows/testsuite.yml

This file was deleted.

27 changes: 26 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -508,4 +508,29 @@ examples/
!examples/**/*.fds

/docs/build/
Dockerfile
Dockerfile

# fdsreader specific
# Extracted test case directories (only .tgz archives are tracked)
tests/cases/steckler_data/
tests/cases/bndf_data/
tests/cases/devc_data/
tests/cases/geom_data/
tests/cases/part_data/
tests/cases/pl3d_data/
tests/cases/steckler_data_fds*/
tests/cases/bndf_data_fds*/
tests/cases/devc_data_fds*/
tests/cases/geom_data_fds*/
tests/cases/geom_data_new/
tests/cases/part_data_fds*/
tests/cases/pl3d_data_fds*/

# Pickle cache files
*.pickle

# Ruff cache
.ruff_cache/

# Claude Code internal directory
.claude/
17 changes: 17 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.11.9
hooks:
- id: ruff
args: [--fix]
- id: ruff-format

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
args: [--maxkb=10000]
exclude: ^tests/cases/
17 changes: 17 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: 2

build:
os: ubuntu-24.04
tools:
python: "3.12"

sphinx:
configuration: docs/conf.py
fail_on_warning: false

python:
install:
- method: pip
path: .
extra_requirements:
- docs
Loading
Loading