11name : Pull request checks
22
33on :
4- pull_request :
54 workflow_dispatch :
5+ pull_request :
6+ branches :
7+ - main
8+ - release/*
69
710jobs :
811 check-unique-standard-names :
12+ name : Check for duplicates in standard names
913 runs-on : ubuntu-latest
1014 steps :
11- - uses : actions/checkout@v4
15+ - name : Checkout repository
16+ uses : actions/checkout@v4
1217
13- - uses : actions/setup-python@v4
18+ - name : Setup Python
19+ uses : actions/setup-python@v4
1420 with :
1521 python-version : " 3.x"
1622
17- - name : Install xmllint
23+ - name : Install dependencies
1824 run : |
19- sudo apt-get update
20- sudo apt-get -y install libxml2-utils
25+ sudo apt-get update
26+ sudo apt-get -y install libxml2-utils
2127
2228 - name : Check for duplicate standard names, descriptions
2329 run : |
@@ -32,42 +38,66 @@ jobs:
3238 - name : Checkout repository
3339 uses : actions/checkout@v4
3440
35- - uses : actions/setup-python@v4
41+ - name : Setup Python
42+ uses : actions/setup-python@v4
3643 with :
3744 python-version : " 3.x"
3845
39- # Install dependencies
4046 - name : Install dependencies
4147 run : |
4248 sudo apt-get update
4349 sudo apt-get -y install libxml2-utils
4450
45-
4651 - name : Checks standard names against character rules
4752 run : |
4853 python3 tools/check_name_rules.py -s standard_names.xml
4954
50- check-rerendered-markdown :
55+ test-rendering :
56+ name : Test rendering xml file to markdown and yaml
5157 runs-on : ubuntu-latest
5258 steps :
53- - uses : actions/checkout@v4
59+ - name : Checkout repository
60+ uses : actions/checkout@v4
5461
55- - uses : actions/setup-python@v4
62+ - name : Setup Python
63+ uses : actions/setup-python@v4
5664 with :
5765 python-version : " 3.x"
5866
59- - name : Install xmllint
67+ - name : Install dependencies
6068 run : |
61- sudo apt-get update
62- sudo apt-get -y install libxml2-utils
69+ sudo apt-get update
70+ sudo apt-get -y install libxml2-utils
71+ python -m pip install --upgrade pip
72+ python -m pip install PyYaml
6373
64- - name : Check markdown has been rerendered
74+ - name : Test rendering xml file to markdown
6575 run : |
66- # Checks if the saved markdown matches freshly rendered markdown.
67- # If this fails you have likely forgotten to rerun the write script
68- # after adding a new name, or updating its description.
69- checksum=$(sha256sum Metadata-standard-names.md)
70- tools/write_standard_name_table.py standard_names.xml
71- test "$checksum" = "$(sha256sum Metadata-standard-names.md)"
72-
76+ # Checks if the saved markdown matches freshly rendered markdown.
77+ # If this fails, prompt user to update
78+ tools/write_standard_name_table.py --output-format md standard_names.xml
79+ if ! git diff --exit-code --quiet; then
80+ echo "❌ Detected that Metadata-standard-names.md is not consistent with standard_names.xml"
81+ echo "✅ To fix: Run the following command locally and commit the result:"
82+ echo " tools/write_standard_name_table.py --output-format md standard_names.xml"
83+ echo "📘 This script requires the pyyaml Python package; to install with pip use command:"
84+ echo " python -m pip install PyYaml"
85+ echo "📘 For conda users, environment file tools/environment.yml is provided."
86+ echo
87+ exit 1
88+ fi
89+
90+ - name : Test rendering xml file to yaml
91+ run : |
92+ tools/write_standard_name_table.py --output-format yaml standard_names.xml
93+ if ! git diff --exit-code --quiet; then
94+ echo "❌ Detected that Metadata-standard-names.yaml is not consistent with standard_names.xml"
95+ echo "✅ To fix: Run the following command locally and commit the result:"
96+ echo " tools/write_standard_name_table.py --output-format yaml standard_names.xml"
97+ echo "📘 This script requires the pyyaml Python package; to install with pip use command:"
98+ echo " python -m pip install PyYaml"
99+ echo "📘 For conda users, environment file tools/environment.yml is provided."
100+ echo
101+ exit 1
102+ fi
73103
0 commit comments