CI #59
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: CI | |
on: | |
push: | |
pull_request: | |
schedule: | |
- cron: "0 0 1 * *" # run monthly | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
REGISTRY: ghcr.io | |
NAME: piqmie | |
TAG: "1.1.0" | |
BASE_URL: http://127.0.0.1:8080 | |
DATA: a000000000000000000000000000000000000001 | |
steps: | |
- name: Log into registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Run web app in docker | |
run: | | |
docker run -d -p 8080:8080 ${REGISTRY}/${GITHUB_REPOSITORY_OWNER,,}/${NAME}:${TAG} | |
sleep 10 | |
docker ps | |
- name: Test web app endpoints | |
run: | | |
HTTP_CODE=$(curl -I "${BASE_URL}/results/${DATA}" | grep HTTP | cut -f 2 -d " ") | |
echo $HTTP_CODE | |
if [ "$HTTP_CODE" != "200" ]; then | |
exit 1 | |
fi | |
for p in $(echo statpep statprot statgrp statregrp); do | |
url=$(echo "${{ env.APP_BASE_URL }}/rest/${{ env.APP_DATA }}/$p") | |
echo "# $url #" | |
curl -s "$url" | jq . | |
done |