-
Notifications
You must be signed in to change notification settings - Fork 6
162 lines (132 loc) · 5.67 KB
/
makefile-ci.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
name: Makefile CI
on:
# Triggers the workflow on push and pull request events but only for pull_requests on the main branch
push:
branches:
- main
- stable
pull_request:
branches:
- main
# Allows you to run this workflow manually
workflow_dispatch:
jobs:
build-test:
runs-on: ubuntu-latest
steps:
- name: Remove unwanted to provide more disk space
# https://github.com/marketplace/actions/maximize-build-disk-space
# https://github.com/actions/runner-images/issues/2840
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- name: Install nvidia-container-runtime
run: |
curl -s -L https://nvidia.github.io/nvidia-container-runtime/gpgkey | sudo apt-key add -
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
curl -s -L https://nvidia.github.io/nvidia-container-runtime/$distribution/nvidia-container-runtime.list | sudo tee /etc/apt/sources.list.d/nvidia-container-runtime.list
sudo apt-get update
sudo apt-get install -y nvidia-container-toolkit
sudo systemctl restart docker
- name: Checkout repository and submodules
uses: actions/checkout@v3
with:
submodules: recursive
- name: Prepare
run: make prepare
- name: Build images from submodules
run: make build
- name: Start
run: make start
- name: Test
run: make test
- name: Clean testdata
run: make clean-testdata
- name: Test parallel using multiple workers
run: CONTROLLER_WORKERS=3 make -j test
- name: Setup upterm session when failure
if: ${{ failure() && github.event_name == 'workflow_dispatch' }}
uses: lhotari/action-upterm@v1
deploy-pull-test:
needs: build-test
if: github.event_name != 'pull_request'
environment: OCRD_KITODO
runs-on: ubuntu-latest
steps:
- name: Remove unwanted to provide more disk space
# https://github.com/marketplace/actions/maximize-build-disk-space
# https://github.com/actions/runner-images/issues/2840
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- name: Install nvidia-container-runtime
run: |
curl -s -L https://nvidia.github.io/nvidia-container-runtime/gpgkey | sudo apt-key add -
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
curl -s -L https://nvidia.github.io/nvidia-container-runtime/$distribution/nvidia-container-runtime.list | sudo tee /etc/apt/sources.list.d/nvidia-container-runtime.list
sudo apt-get update
sudo apt-get install -y nvidia-container-toolkit
sudo systemctl restart docker
- name: Checkout repository and submodules
uses: actions/checkout@v3
with:
submodules: recursive
- name: Read .env file
id: dotenv
uses: falti/[email protected]
with:
log-variables: true
keys-case: bypass
- name: Determination of further environment variables
run: |
# docker image tags
CONTROLLER_IMAGE=${{ steps.dotenv.outputs.CONTROLLER_IMAGE }}; echo "CONTROLLER_IMAGE_TAG=${CONTROLLER_IMAGE#*:}" >> $GITHUB_ENV
MANAGER_IMAGE=${{ steps.dotenv.outputs.MANAGER_IMAGE }}; echo "MANAGER_IMAGE_TAG=${MANAGER_IMAGE#*:}" >> $GITHUB_ENV
MONITOR_IMAGE=${{ steps.dotenv.outputs.MONITOR_IMAGE }}; echo "MONITOR_IMAGE_TAG=${MONITOR_IMAGE#*:}" >> $GITHUB_ENV
# submodule Git references
echo "CONTROLLER_CHECKOUT_REF=`git -C ./_modules/ocrd_controller rev-parse HEAD`" >> $GITHUB_ENV
echo "MANAGER_CHECKOUT_REF=`git -C ./_modules/ocrd_manager rev-parse HEAD`" >> $GITHUB_ENV
echo "MONITOR_CHECKOUT_REF=`git -C ./_modules/ocrd_monitor rev-parse HEAD`" >> $GITHUB_ENV
- name: Dispatch OCR-D Controller workflow and waiting for completion
uses: aurelien-baudet/workflow-dispatch@v2
with:
inputs: '{ "checkout-ref": "${{ env.CONTROLLER_CHECKOUT_REF }}", "image-tag": "${{ env.CONTROLLER_IMAGE_TAG }}", "ocrd-all-version": "${{ steps.dotenv.outputs.CONTROLLER_BASE_VERSION }}" }'
ref: 'master'
repo: slub/ocrd_controller
token: ${{ secrets.SUB_REPO_TOKEN }}
workflow: publish.yml
- name: Dispatch OCR-D Manager workflow and waiting for completion
uses: aurelien-baudet/workflow-dispatch@v2
with:
inputs: '{ "checkout-ref": "${{ env.MANAGER_CHECKOUT_REF }}", "image-tag": "${{ env.MANAGER_IMAGE_TAG }}" }'
ref: 'main'
repo: slub/ocrd_manager
token: ${{ secrets.SUB_REPO_TOKEN }}
workflow: publish.yml
- name: Dispatch OCR-D Monitor workflow and waiting for completion
uses: aurelien-baudet/workflow-dispatch@v2
with:
inputs: '{ "checkout-ref": "${{ env.MONITOR_CHECKOUT_REF }}", "image-tag": "${{ env.MONITOR_IMAGE_TAG }}" }'
ref: 'main'
repo: slub/ocrd_monitor
token: ${{ secrets.SUB_REPO_TOKEN }}
workflow: publish.yml
- name: Prepare
run: make prepare
- name: Start
run: make start
- name: Test
run: make test
- name: Clean testdata
run: make clean-testdata
- name: Test parallel using multiple workers
run: CONTROLLER_WORKERS=3 make -j test
- name: Setup upterm session when failure
if: ${{ failure() && github.event_name == 'workflow_dispatch' }}
uses: lhotari/action-upterm@v1