summaryrefslogtreecommitdiffstats
path: root/.github/workflows/crossbuild.yml
blob: d3d91867ffafef547e8ab8b7800884cd4b59be98 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
name: Check Crossbuild

on:
  push:
    branches-ignore:
      - coverity_scan
  workflow_dispatch:

env:
  CI: 1
  GH_ACTIONS: 1
  DEBIAN_FRONTEND: noninteractive
  APT_OPTS: "-y --no-install-recommends"

jobs:
  #
  #  Generate matrix based on crossbuild docker directories.
  #
  gen-matrix:

    runs-on: ubuntu-latest

    outputs:
      matrix: ${{ steps.gen-matrix.outputs.matrix }}

    steps:

    - uses: actions/checkout@v4
      with:
        lfs: false

    - id: gen-matrix
      name: Generate matrix based on crossbuild targets
      run: |
        cd scripts/crossbuild/docker
        M=$(ls | perl -n -e '{chomp; push @L,"\"$_\""} END{print "{\"env\":[{\"OS\":",join("},{\"OS\":",@L),"}]}"}')
        echo "Matrix: $M"
        echo matrix=$M >> $GITHUB_OUTPUT

  #
  #  Run crossbuild target for each given OS. This will build the
  #  Docker image and run `make test` inside.
  #
  crossbuild:
    needs:
      - gen-matrix

    runs-on: ubuntu-20.04

    strategy:
      fail-fast: false
      matrix: ${{ fromJson(needs.gen-matrix.outputs.matrix) }}

    env: ${{ matrix.env }}

    name: "v3.2.x-${{ matrix.env.OS }}"

    steps:

    - uses: actions/checkout@v4
      with:
        fetch-depth: 0${{ ( matrix.env.OS != 'centos7' ) && '1' }}

    - name: Run crossbuild tests
      run: |
        make crossbuild.$OS

    - name: Show build log
      if: ${{ success() || failure() }}
      run: |
        cat scripts/crossbuild/build/build.$OS

    - name: Show configure log
      if: ${{ success() || failure() }}
      run: |
        cat scripts/crossbuild/build/configure.$OS

    - name: Show test log
      if: ${{ success() || failure() }}
      run: |
        cat scripts/crossbuild/build/log.$OS

    #
    #  If the CI has failed and the branch is ci-debug then start a tmate
    #  session. SSH rendezvous point is emited continuously in the job output.
    #
    - name: "Debug: Start tmate"
      uses: mxschmitt/action-tmate@v3
      with:
        limit-access-to-actor: true
      if: ${{ github.ref == 'refs/heads/ci-debug' && failure() }}