|
14 | 14 | docker-config-path: source/ci/docker |
15 | 15 |
|
16 | 16 | jobs: |
17 | | - # Build the docker container images that we will use for our Linux |
18 | | - # builds. This will identify the last commit to the repository that |
19 | | - # updated the docker images, and try to download the image tagged with |
20 | | - # that sha. If it does not exist, we'll do a docker build and push |
21 | | - # the image up to GitHub Packages for the actual CI/CD runs. We tag |
22 | | - # with both the sha and "latest" so that the subsequent runs need not |
23 | | - # know the sha. Only do this on CI builds (when the event is a "push") |
24 | | - # because PR builds from forks lack permission to write packages. |
25 | 17 | containers: |
26 | | - strategy: |
27 | | - matrix: |
28 | | - container: |
29 | | - - name: xenial |
30 | | - - name: bionic |
31 | | - - name: focal |
32 | | - - name: docurium |
33 | | - - name: bionic-x86 |
34 | | - dockerfile: bionic |
35 | | - base: multiarch/ubuntu-core:x86-bionic |
36 | | - qemu: true |
37 | | - - name: bionic-arm32 |
38 | | - dockerfile: bionic |
39 | | - base: multiarch/ubuntu-core:armhf-bionic |
40 | | - qemu: true |
41 | | - - name: bionic-arm64 |
42 | | - dockerfile: bionic |
43 | | - base: multiarch/ubuntu-core:arm64-bionic |
44 | | - qemu: true |
45 | | - - name: centos7 |
46 | | - - name: centos8 |
47 | | - runs-on: ubuntu-latest |
48 | | - name: "Create container: ${{ matrix.container.name }}" |
49 | | - steps: |
50 | | - - name: Check out repository |
51 | | - uses: actions/checkout@v3 |
52 | | - with: |
53 | | - path: source |
54 | | - fetch-depth: 0 |
55 | | - if: github.event_name != 'pull_request' |
56 | | - - name: Setup QEMU |
57 | | - run: docker run --rm --privileged multiarch/qemu-user-static:register --reset |
58 | | - if: matrix.container.qemu == true |
59 | | - - name: Download existing container |
60 | | - run: | |
61 | | - "${{ github.workspace }}/source/ci/getcontainer.sh" "${{ matrix.container.name }}" "${{ matrix.container.dockerfile }}" |
62 | | - env: |
63 | | - DOCKER_REGISTRY: ${{ env.docker-registry }} |
64 | | - GITHUB_TOKEN: ${{ secrets.github_token }} |
65 | | - working-directory: ${{ env.docker-config-path }} |
66 | | - if: github.event_name != 'pull_request' |
67 | | - - name: Build and publish image |
68 | | - run: | |
69 | | - if [ "${{ matrix.container.base }}" != "" ]; then |
70 | | - BASE_ARG="--build-arg BASE=${{ matrix.container.base }}" |
71 | | - fi |
72 | | - docker build -t ${{ env.docker-registry-container-sha }} --build-arg UID=$(id -u) --build-arg GID=$(id -g) ${BASE_ARG} -f ${{ env.dockerfile }} . |
73 | | - docker tag ${{ env.docker-registry-container-sha }} ${{ env.docker-registry-container-latest }} |
74 | | - docker push ${{ env.docker-registry-container-sha }} |
75 | | - docker push ${{ env.docker-registry-container-latest }} |
76 | | - working-directory: ${{ env.docker-config-path }} |
77 | | - if: github.event_name != 'pull_request' && env.docker-container-exists != 'true' |
| 18 | + uses: ./.github/workflows/build-containers.yml |
78 | 19 |
|
79 | 20 | # Run our CI/CD builds. We build a matrix with the various build targets |
80 | 21 | # and their details. Then we build either in a docker container (Linux) |
@@ -286,43 +227,20 @@ jobs: |
286 | 227 | docker build -t ${{ env.docker-registry-container-sha }} --build-arg UID=$(id -u) --build-arg GID=$(id -g) ${BASE_ARG} -f ${{ env.dockerfile }} . |
287 | 228 | working-directory: ${{ env.docker-config-path }} |
288 | 229 | if: matrix.platform.container.name != '' && env.docker-container-exists != 'true' |
289 | | - - name: Build and test |
290 | | - run: | |
291 | | - export GITTEST_NEGOTIATE_PASSWORD="${{ secrets.GITTEST_NEGOTIATE_PASSWORD }}" |
292 | | - export GITTEST_GITHUB_SSH_KEY="${{ secrets.GITTEST_GITHUB_SSH_KEY }}" |
293 | | - export GITTEST_GITHUB_SSH_PUBKEY="${{ secrets.GITTEST_GITHUB_SSH_PUBKEY }}" |
294 | | - export GITTEST_GITHUB_SSH_PASSPHRASE="${{ secrets.GITTEST_GITHUB_SSH_PASSPHRASE }}" |
295 | | - export GITTEST_GITHUB_SSH_REMOTE_HOSTKEY="${{ secrets.GITTEST_GITHUB_SSH_REMOTE_HOSTKEY }}" |
296 | | -
|
297 | | - if [ -n "${{ matrix.platform.container.name }}" ]; then |
298 | | - mkdir build |
299 | | - docker run \ |
300 | | - --rm \ |
301 | | - --user "$(id -u):$(id -g)" \ |
302 | | - -v "$(pwd)/source:/home/libgit2/source" \ |
303 | | - -v "$(pwd)/build:/home/libgit2/build" \ |
304 | | - -w /home/libgit2 \ |
305 | | - -e ASAN_SYMBOLIZER_PATH \ |
306 | | - -e CC \ |
307 | | - -e CFLAGS \ |
308 | | - -e CMAKE_GENERATOR \ |
309 | | - -e CMAKE_OPTIONS \ |
310 | | - -e GITTEST_NEGOTIATE_PASSWORD \ |
311 | | - -e GITTEST_FLAKY_STAT \ |
312 | | - -e PKG_CONFIG_PATH \ |
313 | | - -e SKIP_NEGOTIATE_TESTS \ |
314 | | - -e SKIP_SSH_TESTS \ |
315 | | - -e TSAN_OPTIONS \ |
316 | | - -e UBSAN_OPTIONS \ |
317 | | - ${{ env.docker-registry-container-sha }} \ |
318 | | - /bin/bash -c "cd build && ../source/ci/build.sh && ../source/ci/test.sh" |
319 | | - else |
320 | | - mkdir build |
321 | | - cd build |
322 | | - ../source/ci/build.sh |
323 | | - ../source/ci/test.sh |
324 | | - fi |
325 | | - shell: bash |
| 230 | + - name: Prepare build |
| 231 | + run: mkdir build |
| 232 | + - name: Build |
| 233 | + uses: ./source/.github/actions/run-build |
| 234 | + with: |
| 235 | + command: cd build && ../source/ci/build.sh |
| 236 | + container: ${{ matrix.platform.container.name }} |
| 237 | + container-version: ${{ env.docker-registry-container-sha }} |
| 238 | + - name: Test |
| 239 | + uses: ./source/.github/actions/run-build |
| 240 | + with: |
| 241 | + command: cd build && ../source/ci/test.sh |
| 242 | + container: ${{ matrix.platform.container.name }} |
| 243 | + container-version: ${{ env.docker-registry-container-sha }} |
326 | 244 | - name: Upload test results |
327 | 245 | uses: actions/upload-artifact@v3 |
328 | 246 | if: success() || failure() |
|
0 commit comments