|
| 1 | +name: Builds |
| 2 | +on: |
| 3 | + push: |
| 4 | + schedule: |
| 5 | + - cron: '0 0 * * *' |
| 6 | + |
| 7 | +jobs: |
| 8 | + # For scheduled builds, get the commit ids of the latest versions to build. |
| 9 | + # |
| 10 | + # Doing this as one single job, which then propagates the information further |
| 11 | + # to the other jobs, so that all build jobs in one workflow builds the exact |
| 12 | + # same version. This allows trusting builds without assertions enabled |
| 13 | + # slightly more, when we know a separate build of the same version but with |
| 14 | + # assertions enabled, has passed some amount of tests. |
| 15 | + get-versions: |
| 16 | + if: (github.event_name != 'schedule') || (github.repository == 'mstorsjo/llvm-mingw') |
| 17 | + runs-on: ubuntu-latest |
| 18 | + steps: |
| 19 | + - name: Touch file |
| 20 | + run: | |
| 21 | + touch versions |
| 22 | + - name: Check latest version |
| 23 | + if: github.event_name == 'schedule' |
| 24 | + run: | |
| 25 | + echo LLVM_VERSION=$(git ls-remote https://github.com/llvm/llvm-project.git | grep 'refs/heads/main$' | awk '{print $1}') >> versions |
| 26 | + echo MINGW_W64_VERSION=$(git ls-remote https://github.com/mingw-w64/mingw-w64.git | grep 'refs/heads/master$' | awk '{print $1}') >> versions |
| 27 | + echo PYTHON_VERSION_MINGW=$(git ls-remote https://github.com/msys2-contrib/cpython-mingw.git | grep 'refs/heads/mingw-v3.9.11$' | awk '{print $1}') >> versions |
| 28 | + - uses: actions/upload-artifact@v2 |
| 29 | + with: |
| 30 | + name: versions |
| 31 | + path: | |
| 32 | + versions |
| 33 | + retention-days: 7 |
| 34 | + |
| 35 | + # Build a cross compiler for Linux, targeting Windows. |
| 36 | + # |
| 37 | + # The scheduled builds are made with the latest git version of llvm-project |
| 38 | + # and mingw-w64. When using random git snapshot builds of llvm, there's |
| 39 | + # always a risk for bugs - thus build such versions with assertions enabled, |
| 40 | + # to better catch such bugs early. This makes the first-stage toolchain built |
| 41 | + # here in scheduled builds somewhat slower. |
| 42 | + linux: |
| 43 | + if: (github.event_name != 'schedule') || (github.repository == 'mstorsjo/llvm-mingw') |
| 44 | + needs: [get-versions] |
| 45 | + runs-on: ubuntu-latest |
| 46 | + steps: |
| 47 | + - uses: actions/checkout@v2 |
| 48 | + - uses: actions/download-artifact@v3 |
| 49 | + if: github.event_name == 'schedule' |
| 50 | + with: |
| 51 | + name: versions |
| 52 | + - name: Set build env vars |
| 53 | + if: github.event_name == 'schedule' |
| 54 | + run: | |
| 55 | + . versions |
| 56 | + echo Building llvm-project $LLVM_VERSION mingw-w64 $MINGW_W64_VERSION, with assertions enabled |
| 57 | + cat versions >> $GITHUB_ENV |
| 58 | + echo ASSERT_PARAMS=--enable-asserts >> $GITHUB_ENV |
| 59 | + mkdir -p install/llvm-mingw |
| 60 | + cp versions install/llvm-mingw |
| 61 | + - name: Build |
| 62 | + run: | |
| 63 | + sudo apt-get update && sudo apt-get install ninja-build |
| 64 | + ./build-all.sh $(pwd)/install/llvm-mingw --disable-clang-tools-extra --disable-lldb $ASSERT_PARAMS |
| 65 | + cd install |
| 66 | + tar -Jcf ../llvm-mingw-linux.tar.xz llvm-mingw |
| 67 | + - uses: actions/upload-artifact@v2 |
| 68 | + with: |
| 69 | + name: linux-toolchain |
| 70 | + path: | |
| 71 | + llvm-mingw-linux.tar.xz |
| 72 | + retention-days: 7 |
| 73 | + |
| 74 | + # Build a cross compiler for macOS, targeting Windows. |
| 75 | + macos: |
| 76 | + if: (github.event_name != 'schedule') || (github.repository == 'mstorsjo/llvm-mingw') |
| 77 | + needs: [get-versions] |
| 78 | + runs-on: macos-latest |
| 79 | + steps: |
| 80 | + - uses: actions/download-artifact@v3 |
| 81 | + if: github.event_name == 'schedule' |
| 82 | + with: |
| 83 | + name: versions |
| 84 | + - name: Set build env vars |
| 85 | + if: github.event_name == 'schedule' |
| 86 | + run: | |
| 87 | + . versions |
| 88 | + echo Building llvm-project $LLVM_VERSION mingw-w64 $MINGW_W64_VERSION |
| 89 | + cat versions >> $GITHUB_ENV |
| 90 | + - uses: actions/checkout@v2 |
| 91 | + - name: Build |
| 92 | + run: | |
| 93 | + brew install ninja |
| 94 | + # Building with MACOS_REDIST=1 (building universal binaries) without |
| 95 | + # --disable-lldb fails in Github Actions, because python is available |
| 96 | + # (and gets picked up), but only exists in native form. |
| 97 | + MACOS_REDIST=1 ./build-all.sh $(pwd)/install/llvm-mingw --disable-clang-tools-extra --disable-lldb |
| 98 | + cd install |
| 99 | + tar -Jcf ../llvm-mingw-macos.tar.xz llvm-mingw |
| 100 | + - uses: actions/upload-artifact@v2 |
| 101 | + with: |
| 102 | + name: macos-toolchain |
| 103 | + path: | |
| 104 | + llvm-mingw-macos.tar.xz |
| 105 | + retention-days: 7 |
| 106 | + |
| 107 | + # Test building the toolchain on msys2 (in the mingw64 and clang64 |
| 108 | + # environments). The binaries built here rely on the runtime libraries from |
| 109 | + # the host environment (libstdc++ or libc++). No artifacts are stored from |
| 110 | + # these builds, but llvm-mingw's tests are run. |
| 111 | + msys2: |
| 112 | + if: (github.event_name != 'schedule') || (github.repository == 'mstorsjo/llvm-mingw') |
| 113 | + needs: [get-versions] |
| 114 | + runs-on: windows-latest |
| 115 | + defaults: |
| 116 | + run: |
| 117 | + shell: msys2 {0} |
| 118 | + strategy: |
| 119 | + fail-fast: false |
| 120 | + matrix: |
| 121 | + sys: |
| 122 | + - mingw64 |
| 123 | + - clang64 |
| 124 | + steps: |
| 125 | + - uses: msys2/setup-msys2@v2 |
| 126 | + with: |
| 127 | + msystem: ${{matrix.sys}} |
| 128 | + install: >- |
| 129 | + git |
| 130 | + make |
| 131 | + pacboy: >- |
| 132 | + toolchain:p |
| 133 | + cmake:p |
| 134 | + ninja:p |
| 135 | + - uses: actions/download-artifact@v3 |
| 136 | + if: github.event_name == 'schedule' |
| 137 | + with: |
| 138 | + name: versions |
| 139 | + - name: Set build env vars |
| 140 | + if: github.event_name == 'schedule' |
| 141 | + run: | |
| 142 | + . versions |
| 143 | + echo Building llvm-project $LLVM_VERSION mingw-w64 $MINGW_W64_VERSION |
| 144 | + cat versions >> $GITHUB_ENV |
| 145 | + - uses: actions/checkout@v2 |
| 146 | + - name: Build |
| 147 | + run: | |
| 148 | + ./build-all.sh $(pwd)/install/llvm-mingw --disable-clang-tools-extra --disable-lldb |
| 149 | + ./run-tests.sh $(pwd)/install/llvm-mingw |
| 150 | +
|
| 151 | + # Use the Linux cross compilers built in the first step to cross compile |
| 152 | + # llvm and make a proper standalone toolchain for Windows (for all 4 |
| 153 | + # architectures). The binaries built here match actual releases quite closely. |
| 154 | + # |
| 155 | + # For scheduled builds, the first stage compiler was built with assertions |
| 156 | + # enabled, but this stage is built without assertions - so the end packaged |
| 157 | + # build should be as fast as normal releases (with the intent that the first |
| 158 | + # stage compiler should build enough code to find many regressions). |
| 159 | + linux-cross: |
| 160 | + if: (github.event_name != 'schedule') || (github.repository == 'mstorsjo/llvm-mingw') |
| 161 | + needs: [linux] |
| 162 | + runs-on: ubuntu-latest |
| 163 | + strategy: |
| 164 | + fail-fast: false |
| 165 | + matrix: |
| 166 | + arch: |
| 167 | + - i686 |
| 168 | + - x86_64 |
| 169 | + - armv7 |
| 170 | + - aarch64 |
| 171 | + steps: |
| 172 | + - uses: actions/download-artifact@v3 |
| 173 | + with: |
| 174 | + name: linux-toolchain |
| 175 | + - name: Unpack cross toolchain |
| 176 | + run: | |
| 177 | + tar -Jxf llvm-mingw-linux.tar.xz |
| 178 | + rm llvm-mingw-linux.tar.xz |
| 179 | + sudo mv llvm-mingw /opt/llvm-mingw |
| 180 | + echo /opt/llvm-mingw/bin >> $GITHUB_PATH |
| 181 | + - name: Fetch version |
| 182 | + if: github.event_name == 'schedule' |
| 183 | + run: | |
| 184 | + . /opt/llvm-mingw/versions |
| 185 | + echo Building llvm-project $LLVM_VERSION mingw-w64 $MINGW_W64_VERSION cpython-mingw $PYTHON_VERSION_MINGW |
| 186 | + cat /opt/llvm-mingw/versions >> $GITHUB_ENV |
| 187 | + - uses: actions/checkout@v2 |
| 188 | + - name: Build |
| 189 | + run: | |
| 190 | + sudo apt-get update && sudo apt-get install autoconf-archive ninja-build |
| 191 | + ./build-cross-tools.sh /opt/llvm-mingw $(pwd)/install/llvm-mingw-${{matrix.arch}} ${{matrix.arch}} --with-python |
| 192 | + cd install |
| 193 | + zip -9rq ../llvm-mingw-${{matrix.arch}}.zip llvm-mingw-${{matrix.arch}} |
| 194 | + - uses: actions/upload-artifact@v2 |
| 195 | + with: |
| 196 | + name: windows-${{matrix.arch}}-toolchain |
| 197 | + path: | |
| 198 | + llvm-mingw-${{matrix.arch}}.zip |
| 199 | + retention-days: 7 |
| 200 | + |
| 201 | + # Run llvm-mingw's tests on x86_64 (and i686) with the cross-built x86_64 |
| 202 | + # toolchain from above. |
| 203 | + test-toolchain: |
| 204 | + if: (github.event_name != 'schedule') || (github.repository == 'mstorsjo/llvm-mingw') |
| 205 | + needs: [linux-cross] |
| 206 | + runs-on: windows-latest |
| 207 | + defaults: |
| 208 | + run: |
| 209 | + shell: msys2 {0} |
| 210 | + steps: |
| 211 | + - uses: msys2/setup-msys2@v2 |
| 212 | + with: |
| 213 | + msystem: mingw64 |
| 214 | + install: >- |
| 215 | + unzip |
| 216 | + - uses: actions/download-artifact@v3 |
| 217 | + with: |
| 218 | + name: windows-x86_64-toolchain |
| 219 | + - name: Unpack toolchain |
| 220 | + run: | |
| 221 | + unzip -q llvm-mingw-x86_64.zip |
| 222 | + rm llvm-mingw-x86_64.zip |
| 223 | + mv llvm-mingw-* /llvm-mingw |
| 224 | + echo /llvm-mingw/bin >> $GITHUB_PATH |
| 225 | + - uses: actions/checkout@v2 |
| 226 | + - name: Run tests |
| 227 | + run: | |
| 228 | + ./run-tests.sh /llvm-mingw |
| 229 | +
|
| 230 | + # Test cross-building ffmpeg for all 4 targeted architectures from linux. |
| 231 | + # This is done only on scheduled builds, to give them a bit more testing, |
| 232 | + # to find potential code generation regressions that trigger failed asserts. |
| 233 | + linux-test-cross-build-ffmpeg: |
| 234 | + if: (github.event_name == 'schedule') && (github.repository == 'mstorsjo/llvm-mingw') |
| 235 | + needs: [linux] |
| 236 | + runs-on: ubuntu-latest |
| 237 | + strategy: |
| 238 | + fail-fast: false |
| 239 | + matrix: |
| 240 | + arch: |
| 241 | + - i686 |
| 242 | + - x86_64 |
| 243 | + - armv7 |
| 244 | + - aarch64 |
| 245 | + steps: |
| 246 | + - uses: actions/download-artifact@v3 |
| 247 | + with: |
| 248 | + name: linux-toolchain |
| 249 | + - name: Unpack cross toolchain |
| 250 | + run: | |
| 251 | + tar -Jxf llvm-mingw-linux.tar.xz |
| 252 | + rm llvm-mingw-linux.tar.xz |
| 253 | + sudo mv llvm-mingw /opt/llvm-mingw |
| 254 | + echo /opt/llvm-mingw/bin >> $GITHUB_PATH |
| 255 | + - name: Checkout ffmpeg |
| 256 | + uses: actions/checkout@v2 |
| 257 | + with: |
| 258 | + repository: ffmpeg/ffmpeg |
| 259 | + path: ffmpeg |
| 260 | + - name: Build ffmpeg |
| 261 | + run: | |
| 262 | + sudo apt-get update && sudo apt-get install nasm |
| 263 | + mkdir ffmpeg-build |
| 264 | + cd ffmpeg-build |
| 265 | + ../ffmpeg/configure --arch=${{matrix.arch}} --target-os=mingw32 --cross-prefix=${{matrix.arch}}-w64-mingw32- --enable-gpl |
| 266 | + make -j$(nproc) |
| 267 | +
|
| 268 | + # Test building ffmpeg for natively on x86_64 Windows and run its tests, |
| 269 | + # to find cases of compiler bugs don't show up as failed asserts in the |
| 270 | + # compiler itslef, but that only show up at runtime. This is only done |
| 271 | + # for scheduled builds. |
| 272 | + test-ffmpeg: |
| 273 | + if: (github.event_name == 'schedule') && (github.repository == 'mstorsjo/llvm-mingw') |
| 274 | + needs: [linux-cross] |
| 275 | + runs-on: windows-latest |
| 276 | + defaults: |
| 277 | + run: |
| 278 | + shell: msys2 {0} |
| 279 | + steps: |
| 280 | + - name: Avoid git checking out files with CRLF |
| 281 | + shell: cmd |
| 282 | + run: | |
| 283 | + git config --global core.autocrlf false |
| 284 | + - uses: msys2/setup-msys2@v2 |
| 285 | + with: |
| 286 | + msystem: mingw64 |
| 287 | + update: false |
| 288 | + install: >- |
| 289 | + unzip |
| 290 | + make |
| 291 | + rsync |
| 292 | + diffutils |
| 293 | + pacboy: >- |
| 294 | + nasm:p |
| 295 | + - uses: actions/download-artifact@v3 |
| 296 | + with: |
| 297 | + name: windows-x86_64-toolchain |
| 298 | + - name: Unpack toolchain |
| 299 | + run: | |
| 300 | + unzip -q llvm-mingw-x86_64.zip |
| 301 | + rm llvm-mingw-x86_64.zip |
| 302 | + mv llvm-mingw-* /llvm-mingw |
| 303 | + echo /llvm-mingw/bin >> $GITHUB_PATH |
| 304 | + - name: Checkout ffmpeg |
| 305 | + uses: actions/checkout@v2 |
| 306 | + with: |
| 307 | + repository: ffmpeg/ffmpeg |
| 308 | + path: ffmpeg |
| 309 | + - name: Build & test ffmpeg |
| 310 | + run: | |
| 311 | + export PATH=/llvm-mingw/bin:$PATH |
| 312 | + mkdir ffmpeg-build |
| 313 | + cd ffmpeg-build |
| 314 | + ../ffmpeg/configure --samples=../fate-samples --enable-gpl --ignore-tests="vsynth1-mpeg2-422,vsynth2-mpeg2-422,vsynth3-mpeg2-422,vsynth_lena-mpeg2-422,seek-vsynth_lena-mpeg2-422" |
| 315 | + make -j$(nproc) |
| 316 | + make fate-rsync |
| 317 | + make -j$(nproc) fate |
0 commit comments