|
| 1 | +# |
| 2 | +# build.yml - GitHub build action for AVRDUDE |
| 3 | +# Copyright (C) 2021 Marius Greuel |
| 4 | +# |
| 5 | +# This program is free software; you can redistribute it and/or modify |
| 6 | +# it under the terms of the GNU General Public License as published by |
| 7 | +# the Free Software Foundation; either version 2 of the License, or |
| 8 | +# (at your option) any later version. |
| 9 | +# |
| 10 | +# This program is distributed in the hope that it will be useful, |
| 11 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | +# GNU General Public License for more details. |
| 14 | +# |
| 15 | +# You should have received a copy of the GNU General Public License |
| 16 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | +# |
| 18 | + |
| 19 | +name: Build |
| 20 | + |
| 21 | +on: |
| 22 | + push: |
| 23 | + branches-ignore: |
| 24 | + - 'onlinedocs' |
| 25 | + pull_request: |
| 26 | + branches-ignore: |
| 27 | + - 'onlinedocs' |
| 28 | + workflow_call: |
| 29 | + |
| 30 | +env: |
| 31 | + BUILD_TYPE: RelWithDebInfo |
| 32 | + |
| 33 | +jobs: |
| 34 | + linux-x86_64-autotools: |
| 35 | + runs-on: ubuntu-latest |
| 36 | + steps: |
| 37 | + - uses: actions/checkout@v3 |
| 38 | + - name: Install prerequisites |
| 39 | + run: >- |
| 40 | + sudo apt-get update |
| 41 | +
|
| 42 | + sudo apt-get install -y |
| 43 | + build-essential |
| 44 | + automake |
| 45 | + libtool |
| 46 | + gettext |
| 47 | + flex |
| 48 | + bison |
| 49 | + libelf-dev |
| 50 | + libusb-dev |
| 51 | + libusb-1.0-0-dev |
| 52 | + libhidapi-dev |
| 53 | + libftdi1-dev |
| 54 | + libreadline-dev |
| 55 | + libserialport-dev |
| 56 | + libgpiod-dev |
| 57 | + texinfo |
| 58 | + texlive |
| 59 | + texi2html |
| 60 | + - name: Configure |
| 61 | + run: >- |
| 62 | + autoreconf -vis src |
| 63 | +
|
| 64 | + mkdir _ambuild && cd _ambuild |
| 65 | +
|
| 66 | + ../src/configure |
| 67 | + --enable-doc |
| 68 | + --enable-parport |
| 69 | + --enable-linuxgpio |
| 70 | + --enable-linuxspi |
| 71 | + - name: Build |
| 72 | + run: make -C _ambuild -j$(nproc) |
| 73 | + - name: Install |
| 74 | + run: sudo make -C _ambuild install |
| 75 | + - name: Dryrun_test |
| 76 | + run: printf "\n\n" | ./tools/test-avrdude -d0 -p"-cdryrun -pm2560" -p"-cdryrun -pavr64du28" |
| 77 | + - name: distcheck |
| 78 | + run: make -C _ambuild -j$(nproc) distcheck |
| 79 | + |
| 80 | + linux-x86_64: |
| 81 | + runs-on: ubuntu-latest |
| 82 | + steps: |
| 83 | + - uses: actions/checkout@v3 |
| 84 | + - name: Install prerequisites |
| 85 | + run: >- |
| 86 | + sudo apt-get update |
| 87 | +
|
| 88 | + sudo apt-get install -y |
| 89 | + build-essential |
| 90 | + cmake |
| 91 | + flex |
| 92 | + bison |
| 93 | + libelf-dev |
| 94 | + libusb-dev |
| 95 | + libusb-1.0-0-dev |
| 96 | + libhidapi-dev |
| 97 | + libftdi1-dev |
| 98 | + libreadline-dev |
| 99 | + libserialport-dev |
| 100 | + libgpiod-dev |
| 101 | + texinfo |
| 102 | + texlive |
| 103 | + texi2html |
| 104 | + - name: Configure |
| 105 | + run: >- |
| 106 | + cmake |
| 107 | + -D BUILD_DOC=1 |
| 108 | + -D DEBUG_CMAKE=1 |
| 109 | + -D HAVE_LINUXGPIO=1 |
| 110 | + -D HAVE_LINUXSPI=1 |
| 111 | + -D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} |
| 112 | + -B build |
| 113 | + - name: Build |
| 114 | + run: cmake --build build |
| 115 | + - name: Install |
| 116 | + run: sudo cmake --build build --target install |
| 117 | + - name: Dryrun_test |
| 118 | + run: echo -e \\n | ./tools/test-avrdude -d0 -p"-cdryrun -pm2560" -p"-cdryrun -pavr64du28" |
| 119 | + - name: Archive build artifacts |
| 120 | + if: always() |
| 121 | + uses: actions/upload-artifact@v3 |
| 122 | + with: |
| 123 | + name: build-linux-x86_64 |
| 124 | + path: | |
| 125 | + build/ |
| 126 | + !**/*.d |
| 127 | + !**/*.o |
| 128 | + - name: Archive executables |
| 129 | + uses: actions/upload-artifact@v3 |
| 130 | + with: |
| 131 | + name: avrdude-linux-x86_64 |
| 132 | + path: | |
| 133 | + build/src/avrdude |
| 134 | + build/src/avrdude.conf |
| 135 | +
|
| 136 | + linux: |
| 137 | + runs-on: ubuntu-latest |
| 138 | + container: debian:11 |
| 139 | + strategy: |
| 140 | + matrix: |
| 141 | + include: |
| 142 | + - { arch: i386, processor: i686, prefix: i686-linux-gnu, inc-lib: i386-linux-gnu } |
| 143 | + - { arch: armhf, processor: armhf, prefix: arm-linux-gnueabihf, inc-lib: arm-linux-gnueabihf } |
| 144 | + - { arch: arm64, processor: aarch64, prefix: aarch64-linux-gnu, inc-lib: aarch64-linux-gnu } |
| 145 | + steps: |
| 146 | + - uses: actions/checkout@v3 |
| 147 | + - name: Add architecture |
| 148 | + run: | |
| 149 | + dpkg --add-architecture ${{matrix.arch}} |
| 150 | + apt-get update |
| 151 | + - name: Install prerequisites |
| 152 | + run: >- |
| 153 | + apt-get update |
| 154 | +
|
| 155 | + apt-get install -y |
| 156 | + git |
| 157 | + cmake |
| 158 | + flex |
| 159 | + bison |
| 160 | + crossbuild-essential-${{matrix.arch}} |
| 161 | + libelf-dev:${{matrix.arch}} |
| 162 | + libusb-dev:${{matrix.arch}} |
| 163 | + libusb-1.0-0-dev:${{matrix.arch}} |
| 164 | + libhidapi-dev:${{matrix.arch}} |
| 165 | + libftdi1-dev:${{matrix.arch}} |
| 166 | + libreadline-dev:${{matrix.arch}} |
| 167 | + libserialport-dev:${{matrix.arch}} |
| 168 | + libgpiod-dev:${{matrix.arch}} |
| 169 | + - name: Configure |
| 170 | + run: >- |
| 171 | + cmake |
| 172 | + -D DEBUG_CMAKE=1 |
| 173 | + -D HAVE_LINUXGPIO=1 |
| 174 | + -D HAVE_LINUXSPI=1 |
| 175 | + -D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} |
| 176 | + -D CMAKE_SYSTEM_NAME=Linux |
| 177 | + -D CMAKE_SYSTEM_PROCESSOR=${{matrix.processor}} |
| 178 | + -D CMAKE_C_COMPILER=${{matrix.prefix}}-gcc |
| 179 | + -D CMAKE_FIND_ROOT_PATH=/usr/${{matrix.prefix}} |
| 180 | + -D CMAKE_INCLUDE_PATH=/usr/include/${{matrix.inc-lib}} |
| 181 | + -D CMAKE_LIBRARY_PATH=/usr/lib/${{matrix.inc-lib}} |
| 182 | + -B build |
| 183 | + - name: Build |
| 184 | + run: cmake --build build |
| 185 | + - name: Archive build artifacts |
| 186 | + if: always() |
| 187 | + uses: actions/upload-artifact@v3 |
| 188 | + with: |
| 189 | + name: build-linux-${{matrix.processor}} |
| 190 | + path: | |
| 191 | + build/ |
| 192 | + !**/*.d |
| 193 | + !**/*.o |
| 194 | + - name: Archive executables |
| 195 | + uses: actions/upload-artifact@v3 |
| 196 | + with: |
| 197 | + name: avrdude-linux-${{matrix.processor}} |
| 198 | + path: | |
| 199 | + build/src/avrdude |
| 200 | + build/src/avrdude.conf |
| 201 | +
|
| 202 | + macos-x86_64: |
| 203 | + runs-on: macos-latest |
| 204 | + steps: |
| 205 | + - uses: actions/checkout@v3 |
| 206 | + - name: Install prerequisites |
| 207 | + run: >- |
| 208 | + # brew update |
| 209 | +
|
| 210 | + brew install |
| 211 | + cmake |
| 212 | + flex |
| 213 | + bison |
| 214 | + libelf |
| 215 | + libusb |
| 216 | + hidapi |
| 217 | + libftdi |
| 218 | + readline |
| 219 | + libserialport |
| 220 | + - name: Configure |
| 221 | + run: >- |
| 222 | + cmake |
| 223 | + -D CMAKE_C_FLAGS=-I/usr/local/include |
| 224 | + -D CMAKE_EXE_LINKER_FLAGS=-L/usr/local/Cellar |
| 225 | + -D DEBUG_CMAKE=1 |
| 226 | + -D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} |
| 227 | + -B build |
| 228 | + - name: Build |
| 229 | + run: cmake --build build |
| 230 | + - name: Archive build artifacts |
| 231 | + if: always() |
| 232 | + uses: actions/upload-artifact@v3 |
| 233 | + with: |
| 234 | + name: build-macos-x86_64 |
| 235 | + path: | |
| 236 | + build/ |
| 237 | + !**/*.d |
| 238 | + !**/*.o |
| 239 | + - name: Archive executables |
| 240 | + uses: actions/upload-artifact@v3 |
| 241 | + with: |
| 242 | + name: avrdude-macos-x86_64 |
| 243 | + path: | |
| 244 | + build/src/avrdude |
| 245 | + build/src/avrdude.conf |
| 246 | +
|
| 247 | + msvc: |
| 248 | + runs-on: windows-latest |
| 249 | + strategy: |
| 250 | + matrix: |
| 251 | + include: |
| 252 | + - { arch: x86, platform: Win32 } |
| 253 | + - { arch: x64, platform: x64 } |
| 254 | + - { arch: arm64, platform: ARM64 } |
| 255 | + steps: |
| 256 | + - uses: actions/checkout@v3 |
| 257 | + - name: Install prerequisites |
| 258 | + # As Chocolatey is notoriously unreliable, install winflexbison3 directly from GitHub. |
| 259 | + # run: choco install winflexbison3 |
| 260 | + run: | |
| 261 | + curl https://github.com/lexxmark/winflexbison/releases/download/v2.5.24/win_flex_bison-2.5.24.zip --location --output winflexbison.zip |
| 262 | + unzip winflexbison.zip -d ${{github.workspace}}\winflexbison |
| 263 | + echo "${{github.workspace}}\winflexbison" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append |
| 264 | + - name: Configure |
| 265 | + run: >- |
| 266 | + cmake |
| 267 | + -A ${{matrix.platform}} |
| 268 | + -D DEBUG_CMAKE=1 |
| 269 | + -D CMAKE_SYSTEM_VERSION=11 |
| 270 | + -D CMAKE_C_FLAGS_RELWITHDEBINFO="/MT /GL /Zi /O2 /Ob1 /DNDEBUG" |
| 271 | + -D CMAKE_CXX_FLAGS_RELWITHDEBINFO="/MT /GL /Zi /O2 /Ob1 /DNDEBUG" |
| 272 | + -D CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO="/DEBUG /INCREMENTAL:NO /LTCG /OPT:REF /OPT:ICF" |
| 273 | + -D HAVE_LIBREADLINE=HAVE_LIBREADLINE-NOTFOUND |
| 274 | + -D USE_EXTERNAL_LIBS=1 |
| 275 | + -B build |
| 276 | + - name: Build |
| 277 | + run: cmake --build build --config ${{env.BUILD_TYPE}} |
| 278 | + - name: Archive build artifacts |
| 279 | + if: always() |
| 280 | + uses: actions/upload-artifact@v3 |
| 281 | + with: |
| 282 | + name: build-msvc-${{matrix.arch}} |
| 283 | + path: | |
| 284 | + build/ |
| 285 | + !**/_deps/ |
| 286 | + !**/*.obj |
| 287 | + - name: Move executables |
| 288 | + run: | |
| 289 | + mv build/src/RelWithDebInfo/avrdude.exe build/src |
| 290 | + mv build/src/RelWithDebInfo/avrdude.pdb build/src |
| 291 | + - name: Archive executables |
| 292 | + uses: actions/upload-artifact@v3 |
| 293 | + with: |
| 294 | + name: avrdude-msvc-${{matrix.arch}} |
| 295 | + path: | |
| 296 | + build/src/avrdude.exe |
| 297 | + build/src/avrdude.pdb |
| 298 | + build/src/avrdude.conf |
| 299 | +
|
| 300 | + mingw: |
| 301 | + runs-on: windows-latest |
| 302 | + defaults: |
| 303 | + run: |
| 304 | + shell: msys2 {0} |
| 305 | + strategy: |
| 306 | + matrix: |
| 307 | + include: |
| 308 | + - { sys: mingw64, env: x86_64 } |
| 309 | + - { sys: ucrt64, env: ucrt-x86_64 } |
| 310 | + - { sys: clang64, env: clang-x86_64 } |
| 311 | + steps: |
| 312 | + - uses: actions/checkout@v3 |
| 313 | + - uses: msys2/setup-msys2@v2 |
| 314 | + with: |
| 315 | + msystem: ${{matrix.sys}} |
| 316 | + update: true |
| 317 | + install: >- |
| 318 | + base-devel |
| 319 | + mingw-w64-${{matrix.env}}-gcc |
| 320 | + mingw-w64-${{matrix.env}}-cmake |
| 321 | + mingw-w64-${{matrix.env}}-libelf |
| 322 | + mingw-w64-${{matrix.env}}-libusb |
| 323 | + mingw-w64-${{matrix.env}}-libusb-compat-git |
| 324 | + mingw-w64-${{matrix.env}}-hidapi |
| 325 | + mingw-w64-${{matrix.env}}-libftdi |
| 326 | + mingw-w64-${{matrix.env}}-libserialport |
| 327 | + mingw-w64-${{matrix.env}}-readline |
| 328 | + mingw-w64-${{matrix.env}}-ncurses |
| 329 | + mingw-w64-${{matrix.env}}-termcap |
| 330 | + - name: Configure |
| 331 | + run: >- |
| 332 | + cmake |
| 333 | + -G"MSYS Makefiles" |
| 334 | + -D DEBUG_CMAKE=1 |
| 335 | + -D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} |
| 336 | + -B build |
| 337 | + - name: Build |
| 338 | + run: cmake --build build |
| 339 | + - name: Archive build artifacts |
| 340 | + if: always() |
| 341 | + uses: actions/upload-artifact@v3 |
| 342 | + with: |
| 343 | + name: build-mingw-${{matrix.env}} |
| 344 | + path: | |
| 345 | + build/ |
| 346 | + - name: Archive executables |
| 347 | + uses: actions/upload-artifact@v3 |
| 348 | + with: |
| 349 | + name: avrdude-mingw-${{matrix.env}} |
| 350 | + path: | |
| 351 | + build/src/avrdude.exe |
| 352 | + build/src/avrdude.conf |
0 commit comments