Skip to content
Closed
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
47 changes: 47 additions & 0 deletions .github/workflows/pr_diff.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: DD XML diffs

on:
pull_request:
types: [opened, synchronize, reopened, edited]

jobs:
build:
name: Generate diff
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # checkout full repository
- name: Install java and SaxonHE
run: |
sudo apt update
sudo apt install -y libsaxonhe-java
- name: Make (merged branch)
run: |
export CLASSPATH=/usr/share/java/Saxon-HE.jar
make dd_data_dictionary.xml
mkdir build
mv dd_data_dictionary.xml build/merged.xml
- name: Make (base branch)
run: |
git checkout ${{ github.base_ref }}
export CLASSPATH=/usr/share/java/Saxon-HE.jar
make dd_data_dictionary.xml
mv dd_data_dictionary.xml build/base.xml
- name: Text diff
id: text_diff
run: |
cd build

# Set up custom hunk headers for the diff
echo "*.xml diff=ddxml" > .gitattributes
git config --add diff.ddxml.xfuncname '(<(IDS|utilities).*)'

# Generate line diff
git diff --no-index -p base.xml merged.xml | tee diff.txt

# Display line diff in step summary
echo '### Changes in generated Data Dictionary XML file' >> $GITHUB_STEP_SUMMARY
echo '```diff' >> $GITHUB_STEP_SUMMARY
cat diff.txt >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
34 changes: 34 additions & 0 deletions .github/workflows/pr_diff_comment_on_pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Comment on Pull Request with XML diff link

on:
workflow_run:
workflows: [DD XML diffs]
types: [completed]

permissions:
pull-requests: write # Required to comment on PRs
issues: write # Required for PR comments via issues API

jobs:
comment:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Comment on PR
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const jobs = await github.rest.actions.listJobsForWorkflowRunAttempt({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.payload.workflow_run.id,
attempt_number: context.payload.workflow_run.run_attempt
})
let job = jobs.data.jobs[jobs.data.jobs.length - 1]
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `[Diff of generated Data Dictionary XML file](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}#summary-${job.id})`
})
30 changes: 15 additions & 15 deletions schemas/core_profiles/dd_core_profiles.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,6 @@
<xs:documentation>Various ion global quantities</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="t_i_volume_average">
<xs:annotation>
<xs:documentation>Volume averaged temperature of this ion species (averaged over the plasma volume up to the LCFS)</xs:documentation>
<xs:appinfo>
<coordinate1>/time</coordinate1>
<units>eV</units>
<type>dynamic</type>
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:group ref="FLT_1D"/>
</xs:complexType>
</xs:element>
<xs:element name="n_i_volume_average">
<xs:annotation>
<xs:documentation>Volume averaged density of this ion species (averaged over the plasma volume up to the LCFS)</xs:documentation>
Expand All @@ -44,10 +31,10 @@
<xs:sequence>
<xs:element name="ip">
<xs:annotation>
<xs:documentation>Total plasma current (toroidal component). Positive sign means anti-clockwise when viewed from above.</xs:documentation>
<xs:documentation>Changing some properties. Total plasma current (toroidal component). Positive sign means anti-clockwise when viewed from above.</xs:documentation>
<xs:appinfo>
<coordinate1>../../time</coordinate1>
<units>A</units>
<units>A.m^2.m^-2</units>
<type>dynamic</type>
<cocos_label_transformation>ip_like</cocos_label_transformation>
<cocos_transformation_expression>.sigma_ip_eff</cocos_transformation_expression>
Expand All @@ -58,6 +45,19 @@
<xs:group ref="FLT_1D"/>
</xs:complexType>
</xs:element>
<xs:element name="test">
<xs:annotation>
<xs:documentation>Test adding a new quantity.</xs:documentation>
<xs:appinfo>
<coordinate1>../../time</coordinate1>
<units>1</units>
<type>dynamic</type>
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:group ref="FLT_1D"/>
</xs:complexType>
</xs:element>
<xs:element name="current_non_inductive">
<xs:annotation>
<xs:documentation>Total non-inductive current (toroidal component). Positive sign means anti-clockwise when viewed from above.</xs:documentation>
Expand Down