Skip to content

Test CI

Test CI #32

Workflow file for this run

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
pull_request:
branches:
- main
# Allows you to run this workflow manually
workflow_dispatch:
jobs:
build-test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Prepare
run: |
ssh-keygen -t rsa -q -f ~/.ssh/id_rsa -P '' -C 'Host'
# Rename example .env file
mv .env.example .env
# Remove carriage returns in file
sed -i 's/\r$//' .env
# Set environment variables from .env file
set -a; source .env; set +a
# Generate ssh keys
mkdir -p ./ocrd/manager/.ssh
ssh-keygen -t rsa -q -f $MANAGER_KEY -P '' -C 'OCR-D Manager'
# Create authorized_keys file with public key of host
cp ~/.ssh/id_rsa.pub ./ocrd/manager/.ssh/authorized_keys
# Create controller directories
mkdir -p ./ocrd/controller/.ssh/ ./ocrd/controller/models
# Download necessary files from master of OCR-D Controller repository
wget -O .env.ocrd-controller https://raw.githubusercontent.com/slub/ocrd_controller/master/.env.example
wget -O docker-compose-controller.yml https://raw.githubusercontent.com/slub/ocrd_controller/master/docker-compose.yml
# Remove carriage returns in file
sed -i 's/\r$//' .env.ocrd-controller
# Set environment variables from .env.ocrd-controller file
set -a; source .env.ocrd-controller; set +a
# Add public key of OCR-D Manager
cp ${MANAGER_KEY}.pub ${CONTROLLER_KEYS}
# Download controller model
wget -P ${CONTROLLER_MODELS} https://ub-backup.bib.uni-mannheim.de/~stweil/tesstrain/frak2021/tessdata_best/frak2021-0.905.traineddata
- name: Build OCR-D Manager
run: docker compose build
- name: Start OCR-D Controller
run: docker compose --env-file=.env.ocrd-controller -f docker-compose-controller.yml up -d
- name: Start OCR-D Manager
run: docker compose up -d
- name: Test
run: make test
- name: Setup upterm session when failure
if: ${{ failure() && github.event_name == 'workflow_dispatch' }}
uses: lhotari/action-upterm@v1