Skip to content
This repository was archived by the owner on Jul 3, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Run Tests

on:
push:
branches:
- main

pull_request:

jobs:
# Run tests
test:
runs-on: ubuntu-latest

steps:
- name: Check Out Repository
uses: actions/checkout@v3

- name: Log in to package registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}

- name: Dependency Setup
run: ./setup.sh SSH

- name: Docker Setup
run: docker-compose build

- name: Run tests
run: docker-compose run test
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
FROM debian:bookworm AS babel-base

ENV COMPOSE_PROJECT_NAME=babel

# # does not work bookworm - evaluate if it's needed
# RUN sed -i 's/main.*/main contrib non-free/' /etc/apt/sources.list

Expand Down Expand Up @@ -84,6 +86,8 @@ FROM babel-base AS imgsrv-fcgi
WORKDIR /htapps/babel/imgsrv
CMD ["/htapps/babel/imgsrv/bin/startup_imgsrv"]

FROM babel-base AS test

FROM babel-base AS apache

RUN apt-get -y install apache2 libapache2-mod-fcgid
Expand Down
3 changes: 3 additions & 0 deletions bin/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
cd /htapps/babel/imgsrv
prove -lre 'perl -I lib -I vendor/common-lib/lib -I vendor/plack-lib/lib -I vendor/slip-lib/lib' t
32 changes: 30 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
version: '3'

name: babel-firebird

services:

imgsrv:
Expand All @@ -10,6 +8,7 @@ services:
target: imgsrv-fcgi
user: ${CURRENT_USER}
volumes:
- ${BABEL_HOME}/bin:/htapps/babel/bin
- ${BABEL_HOME}/imgsrv:/htapps/babel/imgsrv
- ${BABEL_HOME}/mdp-lib:/htapps/babel/mdp-lib
- ${BABEL_HOME}/slip-lib:/htapps/babel/slip-lib
Expand Down Expand Up @@ -203,6 +202,35 @@ services:
profiles:
- stage_item

test:
build:
context: .
target: test
volumes:
- ${BABEL_HOME}/bin:/htapps/babel/bin
- ${BABEL_HOME}/imgsrv:/htapps/babel/imgsrv
- ${BABEL_HOME}/mdp-lib:/htapps/babel/mdp-lib
- ${BABEL_HOME}/slip-lib:/htapps/babel/slip-lib
- ${BABEL_HOME}/plack-lib:/htapps/babel/plack-lib
- ${BABEL_HOME}/mdp-web:/htapps/babel/mdp-web
- ${BABEL_HOME}/logs:/htapps/babel/logs
- ${BABEL_HOME}/cache:/htapps/babel/cache
- ${BABEL_HOME}/sample-data/sdr1:/sdr1
- ${BABEL_HOME}/sample-data/etc:/htapps/babel/etc
- ${BABEL_HOME}/sample-data/watermarks:/htapps/babel/watermarks
- ${BABEL_HOME}/sample-data:/tmp/sample-data
environment:
- SDRROOT=/htapps/babel
- SDRDATAROOT=/sdr1
- HT_DEV=docker
- REMOTE_ADDR=127.0.0.1
- HTTP_HOST=127.0.0.1
- APACHE_LOG_DIR=/tmp
depends_on:
- mysql-sdr
- solr-sdr-catalog
command: bin/test.sh

# todo: ingest, bound to sample-data

volumes:
Expand Down
13 changes: 9 additions & 4 deletions setup.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
#!/usr/bin/env bash

cat <<EOT
if [[ "$1" == "SSH" ]]; then
proto=$1;
fi

if [[ -z $proto ]]; then
cat <<EOT
Checking out into $PWD

What should the git URL be?
[1] HTTPS: https://github.com/hathitrust (default)
[2] SSH: [email protected]:hathitrust
EOT

echo -n "Your choice? [1]: "

read -n 1 proto
echo -n "Your choice? [1]: "
read -n 1 proto
fi

GIT_BASE="https://github.com/hathitrust"

Expand Down