Skip to content

Tweak supp file captions #407

Tweak supp file captions

Tweak supp file captions #407

Workflow file for this run

name: Verify API
on:
pull_request:
push:
branches:
- master
tags:
- '*'
jobs:
check-api-build:
runs-on: ubuntu-latest
if: github.ref != 'refs/heads/master'
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install node dependencies
run: yarn
- name: Run jest tests
run: yarn test
- name: Run api in docker container
run: |
docker buildx build -t epp-biorxiv-xslt:api --target api .
docker run -d --name api-container -p 3000:80 epp-biorxiv-xslt:api
- name: Verify that api is healthy
run: |
reps=60; s=5; i=0
while [ "$(docker inspect --format='{{.State.Health.Status}}' api-container)" != "healthy" ]; do
if [ $i -ge $reps ]; then
echo "API is not healthy after $(($reps * $s)) seconds"
exit 1
fi
echo "Waiting for API to become healthy $(($i * $s))s"
sleep $s
i=$((i+1))
done
echo "API is healthy"
- name: Check api (passthrough)
run: |
output=$(curl --location 'http://localhost:3000' -H 'X-Passthrough: true' --data '<root><child>content</child></root>')
expected_output='{"xml":"<root><child>content</child></root>","logs":["Passthrough mode!"]}';
if [ "$output" != "$expected_output" ]; then
exit 1
fi
echo "$output" | jq
- name: Check api
run: |
output=$(curl --location 'http://localhost:3000' --data '<root><child>content</child></root>')
expected_output='{"xml":"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n<root><child>content</child></root>\n",';
if echo "$output" | grep -q "Passthrough mode"; then
exit 1
fi
echo "$output" | jq
- name: Stop running containers
run: |
docker stop $(docker ps -q)
build-and-push:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
run: |
GITHASH=$(git log -1 --pretty=format:"%H")
GITSHORTHASH=$(git log -1 --pretty=format:"%H" | head -c 8)
DATETIME=$(date -u '+%Y%m%d.%H%M')
GITBRANCH=$(git branch --show-current)
docker buildx build \
-t ghcr.io/elifesciences/enhanced-preprints-biorxiv-xslt-api:latest \
-t ghcr.io/elifesciences/enhanced-preprints-biorxiv-xslt-api:$GITHASH \
-t ghcr.io/elifesciences/enhanced-preprints-biorxiv-xslt-api:$GITBRANCH-$GITSHORTHASH-$DATETIME \
--platform linux/amd64,linux/arm64 --target api --push .