name: Conformance Tests
on:
workflow_dispatch:
pull_request:
paths:
- 'src/**'
- 'conformance/**'
- 'Cargo.toml'
- 'Cargo.lock'
- '.github/workflows/conformance.yml'
env:
CARGO_TERM_COLOR: always
jobs:
conformance:
name: Run Conformance Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-conformance-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-conformance-
- name: Cache conformance test data
uses: actions/cache@v4
with:
path: conformance/data
key: conformance-data-v1
- name: Download test data
run: |
mkdir -p conformance/data
# Download W3C XML Conformance Test Suite
if [ ! -d "conformance/data/w3c-xml" ]; then
echo "Downloading W3C XML test suite..."
curl -sL https://www.w3.org/XML/Test/xmlts20130923.tar.gz -o /tmp/xmlts.tar.gz
mkdir -p conformance/data/w3c-xml
tar -xzf /tmp/xmlts.tar.gz -C conformance/data/w3c-xml
fi
# Clone W3C XSD Test Suite (shallow)
if [ ! -d "conformance/data/w3c-xsd" ]; then
echo "Cloning W3C XSD test suite..."
git clone --depth 1 https://github.com/w3c/xsdtests.git conformance/data/w3c-xsd/xsdtests
fi
- name: Build conformance tests
run: cargo build --release -p fastxml-conformance --tests
- name: Run W3C XML conformance tests (DOM + Streaming)
run: cargo test --release -p fastxml-conformance --test w3c_xml -- --nocapture
- name: Run W3C XSD conformance tests (DOM + Streaming)
run: cargo test --release -p fastxml-conformance --test w3c_xsd -- --nocapture
- name: Run basic XPath unit tests
run: cargo test --release -p fastxml-conformance --test xpath_basic -- --nocapture
- name: Generate report
run: cargo run --release -p fastxml-conformance --bin report -- --json > conformance-report.json
- name: Upload report artifact
uses: actions/upload-artifact@v4
if: always()
with:
name: conformance-report
path: conformance-report.json
retention-days: 30