WIP #278
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: | |
- master | |
- for-master | |
- github-ci | |
tags: | |
- v* | |
pull_request: | |
branches: | |
- master | |
- for-master | |
jobs: | |
check_commits_job: | |
name: "Check commits" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: "env" | |
run: env | sort | |
- name: "Developer's Certificate of Origin" | |
run: | | |
echo | |
echo 'Commits to check:' | |
git log --no-merges --pretty='%H%x09%s%x09%ce%x09-%(trailers:key=Signed-off-by,valueonly,separator=%x00)' origin/master.. | | |
tee /tmp/commits | | |
cut -f1,2 | |
echo '' | |
if grep -e '-$' /tmp/commits | cut -f1,2 | grep -e '^' > /tmp/bad-commits; then | |
echo 'Сommits that fail verification:' | |
cat /tmp/bad-commits | |
echo '' | |
echo 'The DCO Signoff Check for all commits has FAILED.' | |
echo 'See https://github.com/legionus/kbd/blob/master/docs/process/howto-contribute.md#patches=' | |
echo '' | |
exit 1 | |
fi | |
build_arch_job: | |
name: "Build on ${{ matrix.arch }}" | |
strategy: | |
matrix: | |
include: | |
- arch: x86_64 | |
- arch: s390x | |
- arch: ppc64el | |
fail-fast: false | |
runs-on: ubuntu-latest | |
needs: [ check_commits_job ] | |
env: | |
CI_ARCH: ${{ matrix.arch }} | |
steps: | |
- name: "Check out repository" | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: "Prepare Node" | |
run: | | |
for m in kvm kvm-amd kvm-intel; do sudo modprobe -v "$m" ||:; done | |
test -c /dev/kvm && sudo chmod -v 666 /dev/kvm ||: | |
- name: "Install dependencies" | |
run: | | |
sudo apt-get update -y -qq | |
sudo apt-get install -y -qq qemu-system ssh cloud-image-utils | |
- name: "Prepare cloud image for VM" | |
run: tests/ci/create-cloud-image.sh | |
- name: "Start VM" | |
run: | | |
tests/ci/start-qemu-vm.sh "$PWD" | |
while ! tests/ci/vm-ssh.sh ubuntu@localhost /bin/true; do sleep 1; done | |
- name: "Install dependencies into VM" | |
run: tests/ci/vm-ssh.sh ubuntu@localhost /opt/tests/ci/qemu-install-dependencies.sh | |
- name: "Copy sources into VM" | |
run: | | |
tests/ci/vm-ssh.sh ubuntu@localhost mkdir /tmp/kbd | |
tests/ci/vm-scp.sh -r . ubuntu@localhost:/tmp/kbd/ | |
- name: "Build project in the VM" | |
run: | | |
rc=0 | |
tests/ci/vm-ssh.sh ubuntu@localhost /opt/tests/ci/qemu-run-build-and-tests.sh || rc=1 | |
tests/ci/vm-scp.sh ubuntu@localhost:artifacts.tar /tmp/${{ matrix.arch }}/ ||: | |
exit $rc | |
- name: "Upload artifacts" | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build-on-${{ matrix.arch }}-artifacts | |
path: | | |
/tmp/${{ matrix.arch }}/qemu.log | |
/tmp/${{ matrix.arch }}/artifacts.tar | |
if-no-files-found: ignore | |
retention-days: 1 |