summaryrefslogtreecommitdiff
path: root/.github/workflows/pkgcheck.yml
blob: a335c1f04f8c9ee5bbd5aef333deea355d481a0d (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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
name: Package Check
on: [push, pull_request]
jobs:
  pkgcheck:
    name: ${{ matrix.name }}
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        include:
          - name: Ubuntu GCC
            os: ubuntu-latest
            compiler: gcc

          - name: Ubuntu GCC -m32
            os: ubuntu-latest
            compiler: gcc
            packages: gcc-multilib g++-multilib
            cmake-args: -DCMAKE_C_FLAGS=-m32
            cflags: -m32
            ldflags: -m32

          - name: Ubuntu GCC ARM SF
            os: ubuntu-latest
            chost: arm-linux-gnueabi
            compiler: arm-linux-gnueabi-gcc
            cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-arm.cmake
            packages: qemu gcc-arm-linux-gnueabi g++-arm-linux-gnueabi libc-dev-armel-cross

          - name: Ubuntu GCC AARCH64
            os: ubuntu-latest
            chost: aarch64-linux-gnu
            compiler: aarch64-linux-gnu-gcc
            cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-aarch64.cmake
            packages: qemu gcc-aarch64-linux-gnu g++-aarch64-linux-gnu libc6-dev-arm64-cross

          - name: Ubuntu GCC PPC
            os: ubuntu-latest
            chost: powerpc-linux-gnu
            compiler: powerpc-linux-gnu-gcc
            cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-powerpc.cmake
            packages: qemu gcc-powerpc-linux-gnu g++-powerpc-linux-gnu libc6-dev-powerpc-cross

          - name: Ubuntu GCC PPC64LE
            os: ubuntu-latest
            chost: powerpc64le-linux-gnu
            compiler: powerpc64le-linux-gnu-gcc
            cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-powerpc64le.cmake
            packages: qemu gcc-powerpc64le-linux-gnu g++-powerpc64le-linux-gnu libc6-dev-ppc64el-cross

          - name: macOS Clang
            os: macOS-11
            compiler: clang

          - name: macOS Clang Native
            os: macOS-11
            compiler: clang
            cmake-args: -DWITH_NATIVE_INSTRUCTIONS=ON
            configure-args: --native

    steps:
    - name: Checkout repository
      uses: actions/checkout@v3

    - name: Add ubuntu mirrors
      if: runner.os == 'Linux' && matrix.packages
      run: |
        # Github Actions caching proxy is at times unreliable
        echo -e 'http://azure.archive.ubuntu.com/ubuntu\tpriority:1\n' | sudo tee /etc/apt/mirrors.txt
        curl http://mirrors.ubuntu.com/mirrors.txt | sudo tee --append /etc/apt/mirrors.txt
        sudo sed -i 's#http://azure.archive.ubuntu.com/ubuntu/#mirror+file:/etc/apt/mirrors.txt#' /etc/apt/sources.list

    - name: Install packages (Ubuntu)
      if: runner.os == 'Linux'
      run: |
        sudo apt-get update
        sudo apt-get install -y --no-install-recommends ${{ matrix.packages }} \
          abigail-tools \
          diffoscope \
          ninja-build

    - name: Install packages (macOS)
      if: runner.os == 'macOS'
      run: brew install ninja diffoscope ${{ matrix.packages }}
      env:
        HOMEBREW_NO_INSTALL_CLEANUP: 1

    - name: Select Xcode version (macOS)
      # Use a version of Xcode that supports ZERO_AR_DATE until CMake supports
      # AppleClang linking with libtool using -D argument
      # https://gitlab.kitware.com/cmake/cmake/-/issues/19852
      if: runner.os == 'macOS'
      uses: maxim-lobanov/setup-xcode@v1
      with:
        xcode-version: '11.7.0'

    - name: Compare builds
      run: sh test/pkgcheck.sh
      env:
        CC: ${{ matrix.compiler }}
        CFLAGS: ${{ matrix.cflags }}
        CHOST: ${{ matrix.chost }}
        CMAKE_ARGS: ${{ matrix.cmake-args }}
        CONFIGURE_ARGS: ${{ matrix.configure-args }}
        LDFLAGS: ${{ matrix.ldflags }}

    - name: Compare builds (compat)
      run: sh test/pkgcheck.sh --zlib-compat
      env:
        CC: ${{ matrix.compiler }}
        CFLAGS: ${{ matrix.cflags }}
        CHOST: ${{ matrix.chost }}
        CMAKE_ARGS: ${{ matrix.cmake-args }}
        CONFIGURE_ARGS: ${{ matrix.configure-args }}
        LDFLAGS: ${{ matrix.ldflags }}

    - name: Check ABI
      # macOS runner does not contain abigail
      if: runner.os != 'macOS'
      run: sh test/abicheck.sh --refresh-if
      env:
        CC: ${{ matrix.compiler }}
        CFLAGS: ${{ matrix.cflags }}
        CHOST: ${{ matrix.chost }}
        CMAKE_ARGS: ${{ matrix.cmake-args }}
        CONFIGURE_ARGS: ${{ matrix.configure-args }}
        LDFLAGS: ${{ matrix.ldflags }}

    - name: Check ABI (compat)
      # macOS runner does not contain abigail
      if: runner.os != 'macOS'
      run: sh test/abicheck.sh --zlib-compat --refresh-if
      env:
        CC: ${{ matrix.compiler }}
        CFLAGS: ${{ matrix.cflags }}
        CHOST: ${{ matrix.chost }}
        CMAKE_ARGS: ${{ matrix.cmake-args }}
        CONFIGURE_ARGS: ${{ matrix.configure-args }}
        LDFLAGS: ${{ matrix.ldflags }}

    - name: Upload build errors
      uses: actions/upload-artifact@v3
      if: failure()
      with:
        name: ${{ matrix.name }}
        path: |
          **/*.abi
          btmp1/configure.log
          btmp1/CMakeFiles/CMakeOutput.log
          btmp1/CMakeFiles/CMakeError.log
          btmp2/configure.log
          btmp2/CMakeFiles/CMakeOutput.log
          btmp2/CMakeFiles/CMakeError.log
        retention-days: 30