Skip to content

Commit ecb60be

Browse files
committed
Refactor into matrix for concurrent run
1 parent a50006d commit ecb60be

File tree

1 file changed

+57
-141
lines changed

1 file changed

+57
-141
lines changed

.github/workflows/build.yml

Lines changed: 57 additions & 141 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build slims
1+
name: Build slims (Matrix)
22
on:
33
workflow_dispatch:
44
pull_request:
@@ -18,17 +18,21 @@ on:
1818
schedule:
1919
- cron: 1 0 1 1-12 *
2020
jobs:
21-
build:
21+
setup:
2222
runs-on: ubuntu-latest
23+
outputs:
24+
slimmer: ${{ steps.config.outputs.slimmer }}
25+
robot: ${{ steps.config.outputs.robot }}
26+
robot_jar: ${{ steps.config.outputs.robot_jar }}
2327
steps:
2428
- name: Check out repository
2529
uses: actions/checkout@v3
2630
with:
27-
token: ${{ secrets.PAT }}
31+
token: ${{ secrets.PAT }}
2832
- name: Convert slimmer config to ROBOT term files
2933
run: bash scripts/build-workflow/slimmer2robot.sh
30-
# Get slimmer and robot
31-
- name: add slimmer and robot URLs to environment
34+
- name: Extract config values
35+
id: config
3236
run: |
3337
echo $(java --version)
3438
config_file="config.yaml"
@@ -54,142 +58,55 @@ jobs:
5458
echo SLIMMER: $slimmer
5559
echo ROBOT JAR: $robot_jar
5660
echo ROBOT WRAPPER: $robot
57-
echo 'slimmer='${slimmer}'' >> $GITHUB_ENV
58-
echo 'robot='${robot}'' >> $GITHUB_ENV
59-
echo 'robot_jar='${robot_jar}'' >> $GITHUB_ENV
61+
echo "slimmer=${slimmer}" >> $GITHUB_OUTPUT
62+
echo "robot=${robot}" >> $GITHUB_OUTPUT
63+
echo "robot_jar=${robot_jar}" >> $GITHUB_OUTPUT
64+
- name: Authorize running build scripts
65+
run: chmod 755 scripts/build-workflow/*.sh
66+
67+
build:
68+
needs: setup
69+
runs-on: ubuntu-latest
70+
strategy:
71+
fail-fast: false
72+
matrix:
73+
ontology: [aopo, bao, bfo, bto, ccont, cheminf, chebi, chmo, clo, efo, envo, fabio, go, iao, ncit, npo, oae, obcs, obi, pato, sio, uberon, uo, msio]
74+
steps:
75+
- name: Check out repository
76+
uses: actions/checkout@v3
77+
with:
78+
token: ${{ secrets.PAT }}
6079
- name: get slimmer
61-
run: wget ${{ env.slimmer }}
80+
run: wget ${{ needs.setup.outputs.slimmer }}
6281
- name: get robot
6382
run: |
64-
wget ${{ env.robot }}
65-
wget ${{ env.robot_jar}}
66-
67-
# build all ontologies
68-
# Authorize running build script
69-
- name: authorize running build scripts
70-
run: chmod 755 scripts/build-workflow/*.sh
71-
72-
# build aopo
73-
- name: build-aopo
74-
if: always()
75-
run: bash scripts/build-workflow/build.sh aopo
76-
77-
# build bao
78-
- name: build-bao
79-
if: always()
80-
run: bash scripts/build-workflow/build.sh bao
81-
82-
# build bfo
83-
- name: build-bfo
84-
if: always()
85-
run: bash scripts/build-workflow/build.sh bfo
86-
87-
# build bto
88-
- name: build-bto
89-
if: always()
90-
run: bash scripts/build-workflow/build.sh bto
91-
92-
# build ccont
93-
- name: build-ccont
94-
if: always()
95-
run: bash scripts/build-workflow/build.sh ccont
96-
97-
# build cheminf
98-
- name: build-cheminf
99-
if: always()
100-
run: bash scripts/build-workflow/build.sh cheminf
101-
102-
# build chebi
103-
- name: build-chebi
104-
if: always()
105-
run: bash scripts/build-workflow/build.sh chebi
106-
107-
# build chmo
108-
- name: build-chmo
109-
if: always()
110-
run: bash scripts/build-workflow/build.sh chmo
111-
112-
# build clo
113-
- name: build-clo
114-
if: always()
115-
run: bash scripts/build-workflow/build.sh clo
116-
117-
# build efo
118-
- name: build-efo
119-
if: always()
120-
run: bash scripts/build-workflow/build.sh efo
121-
122-
# build envo
123-
- name: build-envo
124-
if: always()
125-
run: bash scripts/build-workflow/build.sh envo
126-
127-
# build fabio
128-
- name: build-fabio
129-
if: always()
130-
run: bash scripts/build-workflow/build.sh fabio
131-
132-
# build go
133-
- name: build-go
134-
if: always()
135-
run: bash scripts/build-workflow/build.sh go
136-
137-
# build iao
138-
- name: build-iao
139-
if: always()
140-
run: bash scripts/build-workflow/build.sh iao
141-
142-
# build ncit
143-
- name: build-ncit
144-
if: always()
145-
run: bash scripts/build-workflow/build.sh ncit
146-
147-
# build npo
148-
- name: build-npo
149-
if: always()
150-
run: bash scripts/build-workflow/build.sh npo
151-
152-
# build oae
153-
- name: build-oae
154-
if: always()
155-
run: bash scripts/build-workflow/build.sh oae
156-
157-
# build obcs
158-
- name: build-obcs
159-
if: always()
160-
run: bash scripts/build-workflow/build.sh obcs
161-
162-
# build obi
163-
- name: build-obi
164-
if: always()
165-
run: bash scripts/build-workflow/build.sh obi
166-
167-
# build pato
168-
- name: build-pato
169-
if: always()
170-
run: bash scripts/build-workflow/build.sh pato
171-
172-
# build sio
173-
- name: build-sio
174-
if: always()
175-
run: bash scripts/build-workflow/build.sh sio
176-
177-
# build uberon
178-
- name: build-uberon
179-
if: always()
180-
run: bash scripts/build-workflow/build.sh uberon
181-
182-
# build uo
183-
- name: build-uo
184-
if: always()
185-
run: bash scripts/build-workflow/build.sh uo
186-
187-
# build msio
188-
- name: build-msio
189-
if: always()
190-
run: bash scripts/build-workflow/build.sh msio
83+
wget ${{ needs.setup.outputs.robot }}
84+
wget ${{ needs.setup.outputs.robot_jar }}
85+
- name: build-${{ matrix.ontology }}
86+
run: bash scripts/build-workflow/build.sh ${{ matrix.ontology }}
87+
- name: Upload built ontology
88+
uses: actions/upload-artifact@v3
89+
with:
90+
name: ${{ matrix.ontology }}-owl
91+
path: external-dev/${{ matrix.ontology }}.owl
92+
retention-days: 1
19193

192-
# Commit and push
94+
commit:
95+
needs: [setup, build]
96+
runs-on: ubuntu-latest
97+
steps:
98+
- name: Check out repository
99+
uses: actions/checkout@v3
100+
with:
101+
token: ${{ secrets.PAT }}
102+
- name: Download all built ontologies
103+
uses: actions/download-artifact@v3
104+
with:
105+
path: artifacts
106+
- name: Move artifacts to external-dev
107+
run: |
108+
mkdir -p external-dev
109+
find artifacts -name "*.owl" -exec cp {} external-dev/ \;
193110
- name: Commit OWL files
194111
run: |
195112
if [[ "${{ github.ref_name }}" == *"merge"* ]]; then
@@ -204,14 +121,13 @@ jobs:
204121
if git diff-index --quiet HEAD --; then
205122
echo "No changes to commit."
206123
else
207-
git commit -m "Actions - build updated" ./external-dev/*.owl || true
208-
fi
124+
git commit -m "Actions - build updated" ./external-dev/*.owl || true
125+
fi
209126
# Check if there are changes to push
210127
if [[ $(git rev-parse --abbrev-ref HEAD) == "${{ github.ref_name }}" ]]; then
211128
if [ -n "$(git cherry -v)" ]; then
212129
git push || echo "Push failed."
213130
else
214131
echo "No changes to push."
215132
fi
216-
fi
217-
133+
fi

0 commit comments

Comments
 (0)