Debian Codegraph @

.github/workflows/ci.yml

raw
1 name: CI
2 on:
3 push:
4 branches:
5 - master
6 - for-master
7 - github-ci
8 tags:
9 - v*
10 pull_request:
11 branches:
12 - master
13 - for-master
14 jobs:
15 check_commits_job:
16 name: "Check commits"
17 runs-on: ubuntu-latest
18 steps:
19 - uses: actions/checkout@v4
20 with:
21 fetch-depth: 0
22 - name: "Developer's Certificate of Origin"
23 run: |
24 [ "${{ github.event_name }}" = "push" ] &&
25 from="refs/remotes/origin/${{ github.event.repository.default_branch }}" ||
26 from="${{ github.event.pull_request.base.sha }}"
27 tests/ci/check-dco.sh "$from..HEAD"
28
29 distcheck_job:
30 name: "Distcheck"
31 runs-on: ubuntu-latest
32 needs: [ check_commits_job ]
33 steps:
34 - name: "Check out repository"
35 uses: actions/checkout@v4
36 with:
37 fetch-depth: 0
38 - name: "Install dependencies"
39 run: |
40 sudo apt-get update -y -qq
41 sudo apt-get install -y -qq gcc autoconf automake autopoint libtool libtool-bin libpam0g-dev bison flex gettext valgrind sparse
42 - name: "Configure"
43 run: |
44 tests/configure.sh --datadir="$PWD/data" --enable-memcheck
45 - name: "Clean"
46 run: |
47 make clean
48 - name: "Build"
49 run: |
50 make V=1
51 - name: "Distcheck"
52 run: |
53 sudo -E make distcheck
54 - name: "Upload artifacts"
55 if: failure()
56 uses: actions/upload-artifact@v4
57 with:
58 name: artifact-distcheck
59 path: |
60 config.log
61 tests/testsuite.dir
62 tests/testsuite.log
63 kbd-*/_build/sub/tests/testsuite.dir
64 kbd-*/_build/sub/tests/testsuite.log
65 if-no-files-found: ignore
66 retention-days: 1
67
68 local_build_job:
69 name: "Check with ${{ matrix.compiler }} / ${{ matrix.libc }} on x86_64"
70 strategy:
71 matrix:
72 include:
73 - os: ubuntu-latest
74 cflags:
75 compiler: gcc
76 libc: glibc
77 configure:
78 check: unittest e2e
79 - os: ubuntu-latest
80 cflags:
81 compiler: clang
82 libc: glibc
83 configure:
84 check: unittest e2e
85 - os: ubuntu-latest
86 cflags: -idirafter /usr/include/ -idirafter /usr/include/x86_64-linux-gnu/
87 compiler: gcc
88 libc: musl
89 configure: --host=x86_64-linux-musl --disable-vlock --without-zlib --without-bzip2 --without-lzma --without-zstd
90 check: unittest e2e
91 fail-fast: false
92 runs-on: ${{ matrix.os }}
93 needs: [ distcheck_job ]
94 env:
95 CHECK_KEYWORDS: ${{ matrix.check }}
96 SANDBOX: priviliged
97 TTY: /dev/tty60
98 HAVE_VGA: 1
99 steps:
100 - name: "Check out repository"
101 uses: actions/checkout@v4
102 with:
103 fetch-depth: 0
104 - run: sudo apt-get update -y -qq
105 - run: sudo apt-get install -y -qq autoconf automake autopoint libtool libtool-bin libpam0g-dev bison flex gettext kbd strace valgrind
106 - run: sudo apt-get install -y -qq gcc clang musl musl-dev musl-tools
107 - name: "Configure"
108 run: |
109 tests/configure.sh --datadir="$PWD/tests/data" --enable-memcheck ${{ matrix.configure }}
110 - name: "Build"
111 run: |
112 make V=1 CFLAGS+="-g -O0 ${{ matrix.cflags }}"
113 - name: "Check"
114 run: |
115 sudo -E tests/check.sh
116 - name: "Upload artifacts"
117 if: failure()
118 uses: actions/upload-artifact@v4
119 with:
120 name: artifact-${{ matrix.compiler }}-${{ matrix.libc }}
121 path: |
122 config.log
123 tests/testsuite.dir
124 tests/testsuite.log
125 if-no-files-found: ignore
126 retention-days: 1
127
128 qemu_build_job:
129 name: "Check on ${{ matrix.arch }}"
130 strategy:
131 matrix:
132 include:
133 - arch: x86_64
134 - arch: s390x
135 - arch: ppc64el
136 fail-fast: false
137 runs-on: ubuntu-latest
138 needs: [ check_commits_job, distcheck_job ]
139 env:
140 CI_ARCH: ${{ matrix.arch }}
141 CI_UBUNTU_VERSION: "24.10"
142
143 steps:
144 - name: "Check out repository"
145 uses: actions/checkout@v4
146 with:
147 fetch-depth: 0
148
149 - name: "Prepare Node"
150 run: |
151 for m in kvm kvm-amd kvm-intel; do sudo modprobe -v "$m" ||:; done
152 test -c /dev/kvm && sudo chmod -v 666 /dev/kvm ||:
153
154 - name: "Install dependencies"
155 run: |
156 sudo apt-get update -y -qq
157 sudo apt-get install -y -qq qemu-system ssh cloud-image-utils
158
159 - name: "Prepare cloud image for VM"
160 run: tests/ci/create-cloud-image.sh
161
162 - name: "Start VM"
163 run: |
164 tests/ci/start-qemu-vm.sh "$PWD"
165 while ! tests/ci/vm-ssh.sh ubuntu@localhost /bin/true; do sleep 1; done
166 timeout-minutes: 30
167
168 - name: "Install dependencies into VM"
169 run: tests/ci/vm-ssh.sh ubuntu@localhost /opt/tests/ci/qemu-install-dependencies.sh
170
171 - name: "Copy sources into VM"
172 run: |
173 tests/ci/vm-ssh.sh ubuntu@localhost mkdir /tmp/kbd
174 tests/ci/vm-scp.sh -r . ubuntu@localhost:/tmp/kbd/
175
176 - name: "Build project in the VM"
177 run: |
178 rc=0
179 tests/ci/vm-ssh.sh ubuntu@localhost /opt/tests/ci/qemu-run-build-and-tests.sh ${{ matrix.arch }} || rc=1
180 tests/ci/vm-scp.sh ubuntu@localhost:artifacts.tar /tmp/${{ matrix.arch }}/ ||:
181 exit $rc
182
183 - name: "Upload artifacts"
184 if: failure()
185 uses: actions/upload-artifact@v4
186 with:
187 name: build-on-${{ matrix.arch }}-artifacts
188 path: |
189 /tmp/${{ matrix.arch }}/qemu.log
190 /tmp/${{ matrix.arch }}/artifacts.tar
191 if-no-files-found: ignore
192 retention-days: 1