GitHub Actions - Add v4 back to artifact actions #108
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: Docker - Debian | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- r* | |
jobs: | |
build-docker-debian: | |
name: Build Debian Docker image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v1 | |
with: | |
fetch-depth: 1 | |
- name: Docker build | |
run: docker build -t libki-server -f docker/Dockerfile . | |
- name: Export image to file | |
run: docker save libki-server > ${{ github.sha }}.debian.tar | |
- name: Upload image artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ github.sha }}.debian.tar | |
path: ${{ github.sha }}.debian.tar | |
test-docker-debian: | |
name: Debian Docker image unit tests | |
needs: build-docker-debian | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download image artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: ${{ github.sha }}.debian.tar | |
path: /tmp | |
- name: Import image from file | |
run: docker load --input /tmp/${{ github.sha }}.debian.tar | |
- name: Create docker network | |
run: docker network create libki-net | |
- name: Start database container | |
run: docker run --name libki-mariadb --network libki-net -e MYSQL_ROOT_PASSWORD=password -e MYSQL_DATABASE=libki --rm -d mariadb:10.3.5 | |
- name: Sleep to give database container time to launch | |
run: sleep 30 | |
- name: Start Libki container | |
run: docker run --name libki-test-server --network libki-net -e 'LIBKI_INSTANCE=demo' -e 'LIBKI_DB_DSN=dbi:mysql:libki;host=libki-mariadb;port=3306' -e 'LIBKI_DB_USER=root' -e 'LIBKI_DB_PASSWORD=password' -e 'LIBKI_DB_HOST=libki-mariadb' -e 'LIBKI_DB_PORT=3306' -e 'LIBKI_DB_DATABASE=libki' -d libki-server | |
- name: Sleep to give Libki container time to launch | |
run: sleep 30 | |
- name: List docker containers | |
run: docker ps && docker logs libki-test-server | |
- name: Set up the Libki database | |
run: docker exec -t libki-test-server /app/installer/update_db.pl | |
- name: Run unit tests | |
run: | | |
docker exec -t libki-test-server prove /app/t/01app.t | |
docker exec -t libki-test-server prove /app/t/stdout.t | |
docker exec -t -e TEST_POD=1 libki-test-server prove /app/t/02pod.t | |
docker exec -t -e TEST_POD=1 libki-test-server prove /app/t/03podcoverage.t | |
docker exec -t libki-test-server prove t/controller_API-Client-v1_0.t | |
publish-docker-io-debian: | |
name: Push Debian image (docker.io) | |
needs: test-docker-debian | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download image artifact | |
uses: actions/download-artifact@v4.1.7 | |
with: | |
name: ${{ github.sha }}.debian.tar | |
path: /tmp | |
- name: Import image from file | |
run: docker load --input /tmp/${{ github.sha }}.debian.tar | |
- name: Log in to docker.io | |
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u kylemhall --password-stdin | |
- name: Tag image for docker.io | |
run: docker tag libki-server:latest libki/libki-server:latest | |
- name: Push image to docker.io | |
run: docker push libki/libki-server | |
publish-quay-io-debian: | |
name: Push Debian image (quay.io) | |
needs: test-docker-debian | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download image artifact | |
uses: actions/download-artifact@v4.1.7 | |
with: | |
name: ${{ github.sha }}.debian.tar | |
path: /tmp | |
- name: Import image from file | |
run: docker load --input /tmp/${{ github.sha }}.debian.tar | |
- name: Log in to quay.io | |
run: echo "${{ secrets.QUAY_PASSWORD }}" | docker login quay.io -u kylemhall --password-stdin | |
- name: Tag image for quay.io | |
run: docker tag libki-server:latest quay.io/libki/libki-server:latest | |
- name: Push image to quay.io | |
run: docker push quay.io/libki/libki-server | |
release-docker-io-debian: | |
name: Release Debian image (docker.io) | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/r') | |
needs: [publish-docker-io-debian, publish-quay-io-debian, publish-docker-io-alpine, publish-quay-io-alpine] | |
steps: | |
- name: Download image artifact | |
uses: actions/download-artifact@v4.1.7 | |
with: | |
name: ${{ github.sha }}.debian.tar | |
path: /tmp | |
- name: Import image from file | |
run: docker load --input /tmp/${{ github.sha }}.debian.tar | |
- name: Log in to docker.io | |
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u kylemhall --password-stdin | |
- name: Tag image for docker.io | |
run: docker tag libki-server:latest libki/libki-server:${GITHUB_REF##*/} | |
- name: Push image to docker.io | |
run: docker push libki/libki-server:${GITHUB_REF##*/} | |
release-quay-io-debian: | |
name: Release Debian image (quay.io) | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/r') | |
needs: [publish-docker-io-debian, publish-quay-io-debian, publish-docker-io-alpine, publish-quay-io-alpine] | |
steps: | |
- name: Download image artifact | |
uses: actions/download-artifact@v4.1.7 | |
with: | |
name: ${{ github.sha }}.debian.tar | |
path: /tmp | |
- name: Import image from file | |
run: docker load --input /tmp/${{ github.sha }}.debian.tar | |
- name: Log in to quay.io | |
run: echo "${{ secrets.QUAY_PASSWORD }}" | docker login quay.io -u kylemhall --password-stdin | |
- name: Tag image for quay.io | |
run: docker tag libki-server:latest quay.io/libki/libki-server:${GITHUB_REF##*/} | |
- name: Push image to quay.io | |
run: docker push quay.io/libki/libki-server:${GITHUB_REF##*/} | |
build-docker-alpine: | |
name: Build Docker Alpine image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v1 | |
with: | |
fetch-depth: 1 | |
- name: Docker build | |
run: docker build -t libki-server -f docker/Dockerfile.alpine . | |
- name: Export image to file | |
run: docker save libki-server > ${{ github.sha }}.alpine.tar | |
- name: Upload image artifact | |
uses: actions/upload-artifact@v1 | |
with: | |
name: ${{ github.sha }}.alpine.tar | |
path: ${{ github.sha }}.alpine.tar | |
test-docker-alpine: | |
name: Alpine Docker image unit tests | |
needs: build-docker-alpine | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v1 | |
with: | |
fetch-depth: 1 | |
- name: Download image artifact | |
uses: actions/download-artifact@v4.1.7 | |
with: | |
name: ${{ github.sha }}.alpine.tar | |
path: /tmp | |
- name: Import image from file | |
run: docker load --input /tmp/${{ github.sha }}.alpine.tar | |
- name: Create docker network | |
run: docker network create libki-net | |
- name: Start database container | |
run: docker run --name libki-mariadb --network libki-net -e MYSQL_ROOT_PASSWORD=password -e MYSQL_DATABASE=libki --rm -d mariadb:10.3.5 | |
- name: Sleep to give database container time to launch | |
run: sleep 30 | |
- name: Load database schema | |
run: cat installer/schema.sql | docker exec -i libki-mariadb /usr/bin/mysql -u root --password=password libki | |
- name: Load database default data | |
run: cat installer/data.sql | docker exec -i libki-mariadb /usr/bin/mysql -u root --password=password libki | |
- name: Start Libki container | |
run: docker run --name libki-test-server --network libki-net -e 'LIBKI_INSTANCE=demo' -e 'LIBKI_DB_DSN=dbi:mysql:libki;host=libki-mariadb;port=3306' -e 'LIBKI_DB_USER=root' -e 'LIBKI_DB_PASSWORD=password' -e 'LIBKI_DB_HOST=libki-mariadb' -e 'LIBKI_DB_PORT=3306' -e 'LIBKI_DB_DATABASE=libki' -e 'LIBKI_TZ=America/New_York' -d libki-server | |
- name: Sleep to give Libki container time to launch | |
run: sleep 30 | |
- name: List docker containers | |
run: docker ps && docker logs libki-test-server | |
- name: Set up the Libki database | |
run: docker exec -t libki-test-server /app/installer/update_db.pl | |
- name: Run unit tests | |
run: | | |
docker exec -t libki-test-server prove /app/t/01app.t | |
docker exec -t libki-test-server prove /app/t/stdout.t | |
docker exec -t -e TEST_POD=1 libki-test-server prove /app/t/02pod.t | |
docker exec -t -e TEST_POD=1 libki-test-server prove /app/t/03podcoverage.t | |
docker exec -t libki-test-server prove t/controller_API-Client-v1_0.t | |
publish-docker-io-alpine: | |
name: Push Alpine image (docker.io) | |
needs: test-docker-alpine | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download image artifact | |
uses: actions/download-artifact@v4.1.7 | |
with: | |
name: ${{ github.sha }}.alpine.tar | |
path: /tmp | |
- name: Import image from file | |
run: docker load --input /tmp/${{ github.sha }}.alpine.tar | |
- name: Log in to docker.io | |
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u kylemhall --password-stdin | |
- name: Tag image for docker.io | |
run: docker tag libki-server:latest libki/libki-server:alpine-latest | |
- name: List available docker images | |
run: docker image ls | |
- name: Push image to docker.io | |
run: docker push libki/libki-server:alpine-latest | |
publish-quay-io-alpine: | |
name: Push Alpine image (quay.io) | |
needs: test-docker-alpine | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download image artifact | |
uses: actions/download-artifact@v4.1.7 | |
with: | |
name: ${{ github.sha }}.alpine.tar | |
path: /tmp | |
- name: Import image from file | |
run: docker load --input /tmp/${{ github.sha }}.alpine.tar | |
- name: Log in to quay.io | |
run: echo "${{ secrets.QUAY_PASSWORD }}" | docker login quay.io -u kylemhall --password-stdin | |
- name: Tag image for quay.io | |
run: docker tag libki-server:latest quay.io/libki/libki-server:alpine-latest | |
- name: List available docker images | |
run: docker image ls | |
- name: Push image to quay.io | |
run: docker push quay.io/libki/libki-server:alpine-latest | |
release-docker-io-alpine: | |
name: Release Alpine image (docker.io) | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/r') | |
needs: [publish-docker-io-debian, publish-quay-io-debian, publish-docker-io-alpine, publish-quay-io-alpine] | |
steps: | |
- name: Download image artifact | |
uses: actions/download-artifact@v4.1.7 | |
with: | |
name: ${{ github.sha }}.alpine.tar | |
path: /tmp | |
- name: Import image from file | |
run: docker load --input /tmp/${{ github.sha }}.alpine.tar | |
- name: Log in to docker.io | |
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u kylemhall --password-stdin | |
- name: Tag image for docker.io | |
run: docker tag libki-server:latest libki/libki-server:alpine-${GITHUB_REF##*/} | |
- name: List available docker images | |
run: docker image ls | |
- name: Push image to docker.io | |
run: docker push libki/libki-server:alpine-${GITHUB_REF##*/} | |
release-quay-io-alpine: | |
name: Release Alpine image (quay.io) | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/r') | |
needs: [publish-docker-io-debian, publish-quay-io-debian, publish-docker-io-alpine, publish-quay-io-alpine] | |
steps: | |
- name: Download image artifact | |
uses: actions/download-artifact@v4.1.7 | |
with: | |
name: ${{ github.sha }}.alpine.tar | |
path: /tmp | |
- name: Import image from file | |
run: docker load --input /tmp/${{ github.sha }}.alpine.tar | |
- name: Log in to quay.io | |
run: echo "${{ secrets.QUAY_PASSWORD }}" | docker login quay.io -u kylemhall --password-stdin | |
- name: Tag image for quay.io | |
run: docker tag libki-server:latest quay.io/libki/libki-server:alpine-${GITHUB_REF##*/} | |
- name: List available docker images | |
run: docker image ls | |
- name: Push image to quay.io | |
run: docker push quay.io/libki/libki-server:alpine-${GITHUB_REF##*/} | |
release-server-github: | |
name: Create server release on GitHub | |
if: startsWith(github.ref, 'refs/tags/r') | |
runs-on: ubuntu-latest | |
needs: [release-docker-io-debian, release-quay-io-debian, release-docker-io-alpine, release-quay-io-alpine] | |
steps: | |
- name: Create server release | |
uses: softprops/action-gh-release@v1 | |
with: | |
generate_release_notes: true | |
release-client-github: | |
name: Create client release on GitHub | |
if: startsWith(github.ref, 'refs/tags/r') | |
runs-on: ubuntu-latest | |
needs: [release-docker-io-debian, release-quay-io-debian, release-docker-io-alpine, release-quay-io-alpine] | |
steps: | |
- name: Create client release | |
uses: softprops/action-gh-release@v1 | |
with: | |
generate_release_notes: true | |
repository: Libki/libki-client |