-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathaction.yml
164 lines (144 loc) · 6.19 KB
/
action.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
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
153
154
155
156
157
158
159
160
161
162
163
164
name: 'OQuaRE metrics calculation module'
description: 'Calculates the metrics of ontology files in the given folder based on the metrics set by the OQuaRE framework'
inputs:
ontology-folders:
description: 'Folders which contains ontology source files'
default: ''
ontology-files:
description: 'Individual ontology files to parse'
default: ''
contents-folder:
description: 'Folder which will contain results and archives'
default: 'OQuaRE'
reasoner:
description: 'Reasoner used by OQuaRE framework'
required: true
default: 'ELK'
ignore-files:
description: 'Files to ignore when calculating metrics'
default: ''
model-plot:
description: 'Indicates if you want oquare model value plots'
default: 'true'
characteristics-plot:
description: 'Indicates if you want characteristics values plots'
default: 'true'
subcharacteristics-plot:
description: 'Indicates if you want characteristics values plots'
default: 'true'
metrics-plot:
description: 'Indicates if you want fine grained metrics plotted'
default: 'true'
evolution-plot:
description: 'Indicates if you want categories evolution plot for each ontology across the latest 20 versions of the ontology'
default: 'true'
release:
description: 'Indicates that this is a release version of ontologies. Scans and extracts metrics from all ontologies'
default: 'false'
force-parse:
description: 'Parses ontologies regardless if they were modified or not'
default: ''
runs:
using: 'composite'
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2
- run: pip install -r $GITHUB_ACTION_PATH/requirements.txt
shell: bash
- name: Generate folder array
id: folder-array
run: |
folders=(${{ inputs.ontology-folders }})
extensions=("/*.owl" "/*.rdf" "/*.ttl" "/*.nt" "/*.n3" "/*.jsonld")
output=""
for folder in ${folders[@]}; do
for extension in ${extensions[@]}; do
output+=" ${folder}${extension}";
done
done
output="${output# }"
echo "folders=${output}" >> $GITHUB_OUTPUT
shell: bash
- name: Check folder status
id: folder-status
run: |
contents_folder="${{ inputs.contents-folder }}"
if [ -z "$(ls -A ./$contents_folder/results)" ]
then
echo "status=true" >> $GITHUB_OUTPUT
else
echo "status=false" >> $GITHUB_OUTPUT
fi
shell: bash
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v40
with:
files_separator: ' '
files_ignore_separator: ' '
files: |
${{ steps.folder-array.outputs.folders }} ${{ inputs.ontology-files }}
files_ignore: |
${{ inputs.ignore-files }}
- name: Setup folders
run: |
mkdir -p ${{ inputs.contents-folder }} && mkdir -p ${{ inputs.contents-folder }}/results && mkdir -p ${{ inputs.contents-folder }}/archives \
&& mkdir -p ${{ inputs.contents-folder }}/temp_results
shell: bash
- name: Checks if its the first run (results empty folder)
if: steps.folder-status.outputs.status == 'true' || inputs.release == 'true'
run: |
chmod u+x $GITHUB_ACTION_PATH/src/fullparse.sh
$GITHUB_ACTION_PATH/src/fullparse.sh "${{ inputs.contents-folder }}" "${{ inputs.ontology-folders }}" "${{ inputs.ignore-files }}" \
"${{ inputs.ontology-files }}" ${{ inputs.reasoner }} ${{ inputs.model-plot }} ${{ inputs.characteristics-plot }} ${{ inputs.subcharacteristics-plot }} \
${{ inputs.metrics-plot }} ${{ inputs.release }} ${{ inputs.evolution-plot }}
shell: bash
- name: Call oquare library if modified ontologies
if: steps.changed-files.outputs.any_changed == 'true' && steps.folder-status.outputs.status == 'false'
run: |
chmod u+x $GITHUB_ACTION_PATH/src/modified.sh
$GITHUB_ACTION_PATH/src/modified.sh "${{ inputs.contents-folder }}" "${{ inputs.ontology-folders }}" "${{ inputs.ignore-files }}" \
"${{ inputs.ontology-files }}" ${{ inputs.reasoner }} ${{ inputs.model-plot }} ${{ inputs.characteristics-plot }} ${{ inputs.subcharacteristics-plot }} \
${{ inputs.metrics-plot }} ${{ inputs.evolution-plot }} "${{ steps.changed-files.outputs.all_changed_files }}"
shell: bash
- name: Force parse ontologies
if: inputs.force-parse != ''
run: |
chmod u+x $GITHUB_ACTION_PATH/src/force.sh
$GITHUB_ACTION_PATH/src/force.sh "${{ inputs.contents-folder }}" "${{ inputs.force-parse }}" ${{ inputs.reasoner }} \
${{ inputs.model-plot }} ${{ inputs.characteristics-plot }} ${{ inputs.subcharacteristics-plot }} \
${{ inputs.metrics-plot }} ${{ inputs.evolution-plot }} "${{ steps.changed-files.outputs.all_changed_files }}"
shell: bash
- name: Archive previous results
if: steps.changed-files.outputs.any_changed == 'true' || inputs.release == 'true' || inputs.force-parse != ''
run: |
if [ "$(ls -A ./${{ inputs.contents-folder }}/results)" ] && [ "$(ls -A ./${{ inputs.contents-folder }}/temp_results)" ]
then
rsync -a ${{ inputs.contents-folder }}/results/ ${{ inputs.contents-folder }}/archives/
rm -rf ${{ inputs.contents-folder }}/results/*
fi
shell: bash
- name: Cleanup tasks
run: |
if [ "$(ls -A ./${{ inputs.contents-folder }}/temp_results)" ]
then
mv -v ${{ inputs.contents-folder }}/temp_results/* ${{ inputs.contents-folder }}/results/
git config user.name github-actions
git config user.email [email protected]
if [ ${{ inputs.release }} == 'true' ]
then
git branch temp_branch
git checkout temp_branch
git add $contents_folder/
git commit -m "Ontology metrics calculated - OQuaRE"
git checkout master
git merge temp_branch
git push origin HEAD:refs/heads/master
else
git add ${{ inputs.contents-folder }}/
git commit -m "Ontology metrics calculated - OQuaRE"
git push
fi
fi
shell: bash