Skip to content

GITHUB: workflows/testing.yml: configure and use buildx with selectiv… #285

GITHUB: workflows/testing.yml: configure and use buildx with selectiv…

GITHUB: workflows/testing.yml: configure and use buildx with selectiv… #285

Workflow file for this run

# This Source Code Form is licensed MPL-2.0: http://mozilla.org/MPL/2.0
# Linting: xclip -sel c <.github/workflows/testing.yml # https://rhysd.github.io/actionlint/
on:
push:
branches: [ 'trunk', 'next', 'wip/**' ]
tags: [ 'v[0-9]+.[0-9]+.[0-9]+*' ]
pull_request:
branches: ['trunk', 'next']
jobs:
Focal-CI:
runs-on: ubuntu-latest
env:
CITAG: cifocal:latest
steps:
# Checkout and fix actions/checkout messing up annotation of the fetched tag: actions/checkout#290
- uses: actions/checkout@v4
- run: git fetch --unshallow && git fetch -f --tags
# Use either cache-from or cache-to, so buildx cannot mess up good caches
- uses: actions/cache@v3
with:
key: cifocal-${{hashFiles ('misc/Dockerfile.focal')}}
path: /tmp/acache
- name: Docker Build cifocal
run: |
docker buildx create --use --driver=docker-container # multi-platform, exports cache, needs --load
test -r /tmp/acache/index.json && CACHETYPE=--cache-from=type=local,src=/tmp/acache || CACHETYPE=--cache-to=type=local,mode=max,dest=/tmp/acache
time docker buildx build $CACHETYPE --load -t $CITAG -f misc/Dockerfile.focal misc
# Build Assets
- name: Build Assets
run: |
time misc/cirun.sh --check --pdf
# Upload http://tim-janik.github.io/docs/anklang
- name: Upload http://tim-janik.github.io/docs/anklang
if: github.ref == 'refs/heads/trunk'
run: |
(umask 0077 && echo "${{ secrets.SSH_ID_GHDOCS4ANKLANG_ECDSA }}" > ~/.id4poxy)
time misc/cirun.sh --poxy-key ~/.id4poxy
- uses: actions/upload-artifact@v3
with: { name: docs, path: out/anklang-docs/ }
Focal-Assets:
runs-on: ubuntu-latest
env:
CITAG: cifocal:latest
steps:
# Checkout and fix actions/checkout messing up annotation of the fetched tag: actions/checkout#290
- uses: actions/checkout@v4
- run: git fetch --unshallow && git fetch -f --tags
# Use either cache-from or cache-to, so buildx cannot mess up good caches
- uses: actions/cache@v3
with:
key: cifocal-${{hashFiles ('misc/Dockerfile.focal')}}
path: /tmp/acache
- name: Docker Build cifocal
run: |
docker buildx create --use --driver=docker-container # multi-platform, exports cache, needs --load
test -r /tmp/acache/index.json && CACHETYPE=--cache-from=type=local,src=/tmp/acache || CACHETYPE=--cache-to=type=local,mode=max,dest=/tmp/acache
time docker buildx build $CACHETYPE --load -t $CITAG -f misc/Dockerfile.focal misc
# Build Assets
- name: Build Assets
run: |
time misc/cirun.sh --assets
- uses: actions/upload-artifact@v3
with: { name: assets, path: assets/ }
Arch-Replay:
runs-on: ubuntu-latest
env:
CITAG: ciarch:latest
steps:
# Checkout and fix actions/checkout messing up annotation of the fetched tag: actions/checkout#290
- uses: actions/checkout@v4
with: { fetch-depth: 0, show-progress: false }
- run: git fetch -f --tags
# Docker build - use BuildKit and Github action API for reliable caching
- uses: docker/[email protected]
- run: docker buildx create --use --driver=docker-container # multi-platform, exports cache, needs --load
- uses: docker/build-push-action@v4
with: # docker build -t ciarch:latest -f misc/Dockerfile.arch misc
tags: ciarch:latest
file: misc/Dockerfile.arch
context: misc/
cache-from: type=gha
cache-to: type=gha,mode=max
load: true
# Run X11 GUI Tests
- name: Run X11 GUI Tests
run: |
time misc/cirun.sh --check --x11
# Artifact upload from x11test
- uses: actions/upload-artifact@v3
if: always()
with:
name: x11test
path: out/x11test/
Focal-Clang-Tidy:
if: ${{ ! contains(github.ref, 'refs/tags/') }}
runs-on: ubuntu-latest
env:
CITAG: cifocal:latest
steps:
# Checkout and fix actions/checkout messing up annotation of the fetched tag: actions/checkout#290
- uses: actions/checkout@v4
with: { fetch-depth: 0, show-progress: false }
- run: git fetch -f --tags
# Docker build - use BuildKit and Github action API for reliable caching
- uses: docker/[email protected]
- run: docker buildx create --use --driver=docker-container # multi-platform, exports cache, needs --load
- uses: docker/build-push-action@v4
with: # docker build -t cifocal:latest -f misc/Dockerfile.focal misc
tags: cifocal:latest
file: misc/Dockerfile.focal
context: misc/
cache-from: type=gha
# cache-to: type=gha,mode=max
load: true
# Build and Run Clang-Tidy
- name: Build and Run Clang-Tidy
run: |
time misc/cirun.sh --check --clang-tidy
# Artifact upload from clang-tidy
- uses: actions/upload-artifact@v3
with: { name: clang-tidy, path: out/clang-tidy/ }
Release-Upload:
needs: [Focal-CI, Focal-Assets, Arch-Replay]
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
env:
GH_TOKEN: ${{ github.token }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download Release Assets
uses: actions/download-artifact@v3
- run: ls -lR assets/
- name: Create Release with Assets
run: misc/publish.sh
Ping-IRC:
if: always()
needs: [Focal-CI, Arch-Replay, Focal-Clang-Tidy, Release-Upload]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check Jobs
run: |
echo '${{ needs.Focal-CI.result }}' '${{ needs.Arch-Replay.result }}' '${{ needs.Focal-Clang-Tidy.result }}'
[[ ${{ needs.Focal-CI.result }} =~ success|skipped ]]
[[ ${{ needs.Arch-Replay.result }} =~ success|skipped ]]
[[ ${{ needs.Focal-Clang-Tidy.result }} =~ success|skipped ]]
- name: Ping IRC
if: always()
run: |
R='${{ github.repository }}' && R=${R#*/}
B='${{ github.ref }}' && B=${B#refs/heads/}
S='${{ job.status }}' && URL='${{ github.event.head_commit.url }}'
U='${{ github.actor }}' && B="$(git branch --show-current)"
MSG=$(git log -1 --format='%s')
.github/workflows/ircbot.py -q -j "#Anklang" -R "$R" -U "$U" -D "$B" -S "$S" "$MSG" "$URL"