-
Notifications
You must be signed in to change notification settings - Fork 158
121 lines (99 loc) · 4.39 KB
/
formatting.yml
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
# Workflow for CI tests
name: CI-documentation-and-format
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master, maint_*, release* ]
pull_request:
branches: [ master, maint_*, release* ]
# Allows you to run this workflow manually from the Actions tab
# workflow_dispatch:
defaults:
run:
shell: bash
working-directory: Buildings
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
test-formatting:
# Skip if the commit message contains "ci skip"
if: "!contains(github.event.head_commit.message, 'ci skip')"
runs-on: ubuntu-20.04
steps:
# Checks-out repository under $GITHUB_WORKSPACE, so job can access it
- name: Checkout code
uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.8.10' # Version range or exact version of a Python version to use, using SemVer's version range syntax
architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified
- name: "Install pip"
run: pip3 install --upgrade pip wheel
- name: "Install BuildingsPy"
run: pip3 install git+https://github.com/lbl-srg/[email protected]
- name: Check for UTF-8 BOM
run : |
for ff in `grep -rlI --exclude="ffd.vcxproj" --exclude-dir="\.git" $'^\xEF\xBB\xBF' .`; do
echo "::error file=${ff}:: Found BOM in ${ff}."
done;
test -z "${ff}"
- name: "Test html syntax"
run : ../bin/runUnitTests.py --validate-html-only
- name: "Test experiment setup"
run : ../bin/runUnitTests.py --validate-experiment-setup
- name: "Test if package.order are correct"
run : |
python -c 'import buildingspy.development.refactor as r; r.write_package_order(".", recursive=True)'
git diff --exit-code .
- name: "Verify files for invalid strings"
run: ${GITHUB_WORKSPACE}/bin/verifyFiles.py
- name: "Verify that all OpenModelica scripts are up to date, and no old scripts exist"
run : |
rm Resources/Scripts/OpenModelica/compareVars/*.mos
python -c 'import buildingspy.development.regressiontest as u; u.Tester().writeOpenModelicaResultDictionary()'
git status --porcelain Resources/Scripts/OpenModelica
test -z "$(git status --porcelain Resources/Scripts/OpenModelica)"
- name: "Test user guide"
run : (cd Resources/Documentation/userGuide; make regressiontest)
- name: "Test heat pump documentation"
run : (cd Resources/src/fluid/heatpumps/calibration/doc; make regressiontest)
- name: "Check for UnitConversion package to be consistent with the script that generates it"
run : |
cd ..
python Buildings/Resources/src/Controls/OBC/UnitConversions/unit_converters.py
git diff --exit-code Buildings
- name: Check for file permissions
run : |
set -o noglob
LIST="*.mo *.mos *.fmu *.json *.txt *.jar *.c *.h *.def *.cc *.vcxproj \
*.so *.exe \
*.java package-list element-list \
*.csv *.dat *.TMY *.mat \
*.cfd *.ffd *.mcr \
*.rst *.svg *.png *.gif *.jpg *.tiff *.xcf *.ico *.psd *.pdf *.odp \
*.tex *.md *.html *.css \
*.bat *.linux *.darwin \
*.js *.map *.eot *.ttf *.woff *.woff2 *.inv \
*.idd *.idf *.epw \
*.dll *.lib \
*.zip
package.order Makefile makefile RootMakefile"
for tt in ${LIST}; do
for ff in `find . -type f -name ${tt}`; do
chmod u=rw,og=r $ff
done
done
LIST="spawn dymola *.sh"
for tt in ${LIST}; do
for ff in `find . -type f -name ${tt}`; do
chmod u=rwx,og=rx $ff
done
done
git diff --exit-code
# The Windows compiler generates files with u=rw,og=rw permission
LIST="*.dll"
for tt in ${LIST}; do
for ff in `find . -type f -name ${tt}`; do
chmod u=rw,og=rw $ff
done
done