Update README.md #11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test 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 | |
- stable | |
# 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@v4 | |
with: | |
submodules: recursive | |
- name: Prepare | |
run: make prepare | |
- name: Build images from submodules | |
run: make build | |
- name: Start | |
run: make start | |
- name: Status | |
run: | | |
make status | grep ocrd-database | |
make status | grep ocrd-manager | |
make status | grep ocrd-monitor | |
make status | grep ocrd-logview | |
make status | grep ocrd-database | |
make status | grep ocrd-database-management | |
make status | grep ocrd-controller | |
make status | grep kitodo-app | |
make status | grep kitodo-db | |
make status | grep kitodo-es | |
make status | grep kitodo-mq | |
- 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: Collect docker logs on failure | |
if: failure() | |
uses: jwalton/gh-docker-logs@v2 | |
with: | |
dest: './docker-logs' | |
- name: Tar docker logs on failure | |
if: failure() | |
run: tar cvzf ./docker-logs.tgz ./docker-logs | |
- name: Upload docker logs to GitHub | |
if: failure() | |
uses: actions/upload-artifact@master | |
with: | |
name: docker-logs.tgz | |
path: ./docker-logs.tgz | |
- name: Setup upterm session on 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@v4 | |
with: | |
submodules: recursive | |
- name: Read .env file | |
id: dotenv | |
uses: falti/dotenv-action@v1.0.4 | |
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 }}", "ocrd-core-version": "${{ steps.dotenv.outputs.MANAGER_BASE_VERSION }}" }' | |
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: Collect docker logs on failure | |
if: failure() | |
uses: jwalton/gh-docker-logs@v2 | |
with: | |
dest: './docker-logs' | |
- name: Tar docker logs on failure | |
if: failure() | |
run: tar cvzf ./docker-logs.tgz ./docker-logs | |
- name: Upload docker logs to GitHub | |
if: failure() | |
uses: actions/upload-artifact@master | |
with: | |
name: docker-logs.tgz | |
path: ./docker-logs.tgz | |
- name: Setup upterm session when failure | |
if: ${{ failure() && github.event_name == 'workflow_dispatch' }} | |
uses: lhotari/action-upterm@v1 |