ci-build-deploy #218
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-build-deploy | |
on: | |
push: | |
branches: | |
- "main" | |
schedule: | |
- cron: 0 0 * * 0 | |
jobs: | |
docker: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
strategy: | |
fail-fast: false | |
matrix: | |
project: | |
[ | |
"hdl", | |
"sw", | |
"libiio-debian-bullseye", | |
"libiio-ubuntu-18.04", | |
"libiio-ubuntu-20.04", | |
"libiio-ubuntu-22.04", | |
"libiio-fedora-34", | |
"libiio-fedora-28", | |
"libiio-centos-7", | |
"libiio-opensuse-15.4", | |
"test-harness", | |
"pyadi-iio-python-3_7", | |
"pyadi-iio-python-3_8", | |
"pyadi-iio-python-3_9", | |
"pyadi-iio-python-3_10", | |
"pyadi-iio-python-3_11", | |
] | |
include: | |
- project: "hdl" | |
DOCKERFILE: "Dockerfile-hdl" | |
TAG_ROOT: "hdl-ci" | |
- project: "sw" | |
DOCKERFILE: "Dockerfile-sw" | |
TAG_ROOT: "sw-ci" | |
- project: "libiio-ubuntu-18.04" | |
DOCKERFILE: "libiio/Dockerfile-ubuntu-18.04" | |
TAG_ROOT: "libiio_ubuntu_18_04-ci" | |
- project: "libiio-ubuntu-20.04" | |
DOCKERFILE: "libiio/Dockerfile-ubuntu-20.04" | |
TAG_ROOT: "libiio_ubuntu_20_04-ci" | |
- project: "libiio-ubuntu-22.04" | |
DOCKERFILE: "libiio/Dockerfile-ubuntu-22.04" | |
TAG_ROOT: "libiio_ubuntu_22_04-ci" | |
- project: "libiio-fedora-34" | |
DOCKERFILE: "libiio/Dockerfile-fedora-34" | |
TAG_ROOT: "libiio_fedora_34-ci" | |
- project: "libiio-debian-bullseye" | |
DOCKERFILE: "libiio/Dockerfile-debian-bullseye" | |
TAG_ROOT: "libiio_debian_bullseye-ci" | |
- project: "libiio-debian-bookworm" | |
DOCKERFILE: "libiio/Dockerfile-debian-bookworm" | |
TAG_ROOT: "libiio_debian_bookworm-ci" | |
- project: "libiio-fedora-28" | |
DOCKERFILE: "libiio/Dockerfile-fedora-28" | |
TAG_ROOT: "libiio_fedora_28-ci" | |
- project: "libiio-centos-7" | |
DOCKERFILE: "libiio/Dockerfile-centos-7" | |
TAG_ROOT: "libiio_centos_7-ci" | |
- project: "libiio-opensuse-15.4" | |
DOCKERFILE: "libiio/Dockerfile-opensuse-15.4" | |
TAG_ROOT: "libiio_opensuse_15_4-ci" | |
- project: "test-harness" | |
DOCKERFILE: "test-harness/Dockerfile-test-harness" | |
TAG_ROOT: "test-harness-ci" | |
- project: "pyadi-iio-python-3_7" | |
DOCKERFILE: "pyadi-iio/Dockerfile-python-3_7" | |
TAG_ROOT: "pyadi-iio-python-3_7-ci" | |
- project: "pyadi-iio-python-3_8" | |
DOCKERFILE: "pyadi-iio/Dockerfile-python-3_8" | |
TAG_ROOT: "pyadi-iio-python-3_8-ci" | |
- project: "pyadi-iio-python-3_9" | |
DOCKERFILE: "pyadi-iio/Dockerfile-python-3_9" | |
TAG_ROOT: "pyadi-iio-python-3_9-ci" | |
- project: "pyadi-iio-python-3_10" | |
DOCKERFILE: "pyadi-iio/Dockerfile-python-3_10" | |
TAG_ROOT: "pyadi-iio-python-3_10-ci" | |
- project: "pyadi-iio-python-3_11" | |
DOCKERFILE: "pyadi-iio/Dockerfile-python-3_11" | |
TAG_ROOT: "pyadi-iio-python-3_11-ci" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to DockerHub | |
if: github.ref == 'refs/heads/main' | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Log in to the GitHub Container registry | |
if: github.ref == 'refs/heads/main' | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push Docker images | |
id: docker_build | |
uses: docker/[email protected] | |
with: | |
file: ${{ matrix.DOCKERFILE }} | |
push: ${{ github.ref == 'refs/heads/main' }} | |
tags: | | |
tfcollins/${{ matrix.TAG_ROOT }}:latest | |
ghcr.io/sdgtt/dockerfiles/${{ matrix.TAG_ROOT }}:latest | |
docker_arm: | |
runs-on: ubuntu-20.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
project: ["libiio-ubuntu-18.04", "libiio-debian-bullseye"] | |
include: | |
- project: "libiio-ubuntu-18.04" | |
DOCKERFILE: "libiio/Dockerfile-ubuntu-18.04" | |
TAG_ROOT: "libiio_ubuntu_18_04-ci-arm-ppc" | |
ARCH: linux/arm64 | |
REFERENCE_IMAGE: "ubuntu:18.04" | |
- project: "libiio-debian-bullseye" | |
DOCKERFILE: "libiio/Dockerfile-debian-bullseye" | |
TAG_ROOT: "libiio_debian_bullseye-ci-arm-ppc" | |
ARCH: linux/arm64 | |
REFERENCE_IMAGE: "debian:bullseye" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Login to DockerHub | |
if: github.ref == 'refs/heads/main' | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: arm,arm64,ppc64le,s390x | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
install: true | |
driver: docker-container | |
- name: Available platforms | |
run: echo ${{ steps.buildx.outputs.platforms }} | |
- name: Test build | |
run: | | |
cp Dockerfile-arm Dockerfile | |
docker buildx create --name armbuilder | |
docker buildx use armbuilder | |
docker buildx build --builder armbuilder -t test_${{ matrix.TAG_ROOT }} --platform linux/arm64 --load . | |
ARCH_CHECK=$(docker run --platform linux/arm64 test_${{ matrix.TAG_ROOT }}:latest uname -a) | |
echo "$ARCH_CHECK" | |
echo "$ARCH_CHECK" | grep -i aarch64 || exit 1 | |
- name: Build and push | |
id: docker_build | |
uses: docker/build-push-action@v2 | |
with: | |
push: true | |
tags: tfcollins/${{ matrix.TAG_ROOT }}:latest | |
file: Dockerfile-arm | |
context: . | |
platforms: linux/arm,linux/arm64,linux/ppc64le,linux/s390x |