ci: Add log separators for each sample #210
Workflow file for this run
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: Build Docker image | |
on: [push, pull_request] | |
jobs: | |
main: | |
name: Docker | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
strategy: | |
fail-fast: false | |
matrix: | |
image-name: [nxdk, nxdk-debug, nxdk-lto] | |
include: | |
- image-name: nxdk | |
build-args: buildparams=CFLAGS=-O2 CXXFLAGS=-O2 | |
tag: latest | |
- image-name: nxdk-debug | |
build-args: buildparams=DEBUG=y | |
tag: debug | |
- image-name: nxdk-lto | |
build-args: buildparams=LTO=y CFLAGS=-O2 CXXFLAGS=-O2 | |
tag: lto | |
steps: | |
- name: Clone Tree | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Set variables | |
run: | | |
echo "DOCKER_TAG=$(echo ghcr.io/${{ github.repository }}:${{ matrix.tag }}|tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV | |
echo "CREATED=$(date --rfc-3339=seconds --utc)" >> $GITHUB_ENV | |
echo "SHORT_SHA=${GITHUB_SHA::8}" >> $GITHUB_ENV | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build Docker image | |
uses: docker/build-push-action@v3 | |
with: | |
load: true | |
push: false | |
tags: ${{ env.DOCKER_TAG}} | |
build-args: ${{ matrix.build-args }} | |
- name: Test Docker image | |
run: | | |
cd samples | |
for dir in */ | |
do | |
cd "$dir" | |
docker run --rm -v `pwd`:/usr/src/app -t "${DOCKER_TAG}" make -j`nproc` | |
cd .. | |
done | |
- name: Login to Docker Registry | |
uses: docker/login-action@v2 | |
if: github.ref == 'refs/heads/master' | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push Docker Image | |
uses: docker/build-push-action@v3 | |
if: github.ref == 'refs/heads/master' && matrix.tag == 'latest' | |
with: | |
push: true | |
build-args: ${{ matrix.build-args }} | |
labels: | | |
org.opencontainers.image.revision=${{ github.sha }} | |
org.opencontainers.image.created=${{ env.CREATED }} | |
tags: ${{ env.DOCKER_TAG }} | |
- name: Push to XboxDev Group | |
uses: docker/build-push-action@v3 | |
if: github.repository_owner == 'XboxDev' && github.ref == 'refs/heads/master' | |
with: | |
push: true | |
build-args: ${{ matrix.build-args }} | |
labels: | | |
org.opencontainers.image.revision=${{ github.sha }} | |
org.opencontainers.image.created=${{ env.CREATED }} | |
tags: | | |
ghcr.io/xboxdev/${{ matrix.image-name }}:latest | |
ghcr.io/xboxdev/${{ matrix.image-name }}:git-${{ env.SHORT_SHA }} | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
if: github.repository_owner == 'XboxDev' && github.ref == 'refs/heads/master' | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Push to Docker Hub | |
uses: docker/build-push-action@v3 | |
if: github.repository_owner == 'XboxDev' && github.ref == 'refs/heads/master' | |
with: | |
push: true | |
build-args: ${{ matrix.build-args }} | |
labels: | | |
org.opencontainers.image.revision=${{ github.sha }} | |
org.opencontainers.image.created=${{ env.CREATED }} | |
tags: | | |
xboxdev/${{ matrix.image-name }}:latest | |
xboxdev/${{ matrix.image-name }}:git-${{ env.SHORT_SHA }} |