-
Notifications
You must be signed in to change notification settings - Fork 17
153 lines (129 loc) · 4.97 KB
/
pull_request_ci.yml
File metadata and controls
153 lines (129 loc) · 4.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
name: Pull request checks
on:
workflow_dispatch:
pull_request:
branches:
- main
- release/*
jobs:
check-tools:
name: Pylint all python files under tools/
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pylint pyyaml
- name: Run pylint
run: |
pylint tools/**py
validate-xml:
name: Use xmlllint to validate the xml file against the schema file
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get -y install libxml2-utils
- name: Run xmllint
run: |
xmllint --schema standard_names.xsd standard_names.xml --noout
check-unique-standard-names:
name: Check for duplicates in standard names
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get -y install libxml2-utils
- name: Check for duplicate standard names, descriptions
run: |
tools/check_xml_unique.py -s standard_names.xml
tools/check_xml_unique.py -s standard_names.xml --field="description"
tools/check_xml_unique.py -s standard_names.xml --field="cfname"
check-name-rules:
name: Check standard names against rules
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get -y install libxml2-utils
- name: Checks standard names against character rules
run: |
tools/check_name_rules.py -s standard_names.xml
test-rendering:
name: Test rendering xml file to markdown and yaml
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get -y install libxml2-utils
python -m pip install --upgrade pip
python -m pip install PyYaml
- name: Test that sections are alphabetized
run: |
tools/sort_standard_names.py -s standard_names.xml
if ! git diff --exit-code --quiet; then
echo "❌ Standard Names are not alphabetized within each section"
echo "Run tools/sort_standard_names.py and commit changes"
echo "✅ To fix: Run the following command locally and commit the result:"
echo " tools/sort_standard_names.py standard_names.xml"
echo
exit 1
fi
- name: Test rendering xml file to markdown
run: |
# Checks if the saved markdown matches freshly rendered markdown.
# If this fails, prompt user to update
tools/write_standard_name_table.py --output-format md -s standard_names.xml
if ! git diff --exit-code --quiet; then
echo "❌ Detected that Metadata-standard-names.md is not consistent with standard_names.xml"
echo "✅ To fix: Run the following command locally and commit the result:"
echo " tools/write_standard_name_table.py --output-format md -s standard_names.xml"
echo "📘 This script requires the pyyaml Python package; to install with pip use command:"
echo " python -m pip install PyYaml"
echo "📘 For conda users, environment file tools/environment.yml is provided."
echo
exit 1
fi
- name: Test rendering xml file to yaml
run: |
tools/write_standard_name_table.py --output-format yaml -s standard_names.xml
if ! git diff --exit-code --quiet; then
echo "❌ Detected that Metadata-standard-names.yaml is not consistent with standard_names.xml"
echo "✅ To fix: Run the following command locally and commit the result:"
echo " tools/write_standard_name_table.py --output-format yaml -s standard_names.xml"
echo "📘 This script requires the pyyaml Python package; to install with pip use command:"
echo " python -m pip install PyYaml"
echo "📘 For conda users, environment file tools/environment.yml is provided."
echo
exit 1
fi