CI #1461
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: | |
branches: | |
- '*' | |
schedule: | |
- cron: "0 4 * * *" | |
jobs: | |
unit_tests: | |
name: Run unit tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Branch name | |
run: echo Running on branch ${GITHUB_REF##*/} | |
- name: Run integration tests | |
run: | | |
cd docker | |
./test_integration.sh -v main | |
build_docker: | |
name: Build docker image | |
runs-on: ubuntu-latest | |
needs: unit_tests | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Log in to Docker Hub | |
env: | |
DOCKER_USER: ${{secrets.DOCKER_USER}} | |
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}} | |
run: docker login -u $DOCKER_USER -p $DOCKER_PASSWORD | |
- name: Run integration tests | |
run: docker build -f docker/Dockerfile --tag bywater/koha-ncip-server:latest . | |
- name: Push to Docker Hub | |
run: docker push bywater/koha-ncip-server | |
- name: Log in to Quay.io | |
env: | |
QUAY_USER: ${{secrets.QUAY_USER}} | |
QUAY_PASSWORD: ${{secrets.QUAY_PASSWORD}} | |
run: docker login quay.io -u $QUAY_USER -p $QUAY_PASSWORD | |
- name: Tag image for quay.io | |
run: docker tag bywater/koha-ncip-server:latest quay.io/bywatersolutions/koha-ncip-server:latest | |
- name: Push image to quay.io | |
run: docker push quay.io/bywatersolutions/koha-ncip-server:latest | |
keepalive: | |
name: Keep Alive | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Check age and push commit if needed | |
run: | | |
LAST_COMMIT=$( git --no-pager log -1 --format=%ct ) | |
NOW=$(date +%s) | |
DIFF=$(($NOW-$LAST_COMMIT)) | |
DAYS=$(($DIFF/86400)) | |
git config --global user.email [email protected] | |
git config --global user.name "Kyle M Hall" | |
git commit --allow-empty -m "Automated commit from keep alive workflow" | |
if [ "$DAYS" -gt "50" ]; then git push; fi |