File: build.yml

package info (click to toggle)
dfu-programmer 1.1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 828 kB
  • sloc: ansic: 5,152; makefile: 31; sh: 18
file content (330 lines) | stat: -rw-r--r-- 10,325 bytes parent folder | download
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
name: Build dfu-programmer

# concurrency:
#   group: ${{ github.workflow }}-${{ github.ref }}
#   cancel-in-progress: true

on:
  push:
  # pull_request:

jobs:
  Windows-x86:
    name: Windows x86
    runs-on: windows-latest

    defaults:
      run:
        shell: C:/msys64/usr/bin/bash.exe --noprofile --norc -e -x -o pipefail {0}

    steps:
      - uses: actions/checkout@v3

      - name: Override Version String
        if: "!startsWith(github.ref, 'refs/tags/v')"
        id: override
        shell: bash
        run: echo 'override=PACKAGE_STRING="dfu-programmer ${{ github.ref_name }} ${{ github.sha }}"' >> $GITHUB_OUTPUT

      - name: Get version
        if: startsWith(github.ref, 'refs/tags/v')
        id: version
        shell: bash
        run: echo version=${GITHUB_REF#refs/tags/v} >> $GITHUB_OUTPUT

      - name: Dependencies
        run: |
          # Fix issues with MSYS2 and cygwin tools conflicting by just using MSYS2
          export PATH=/usr/bin:/usr/local/bin

          # While some of these are already available, they are cygwin versions which are incompatible with MSYS2
          pacman --color always --noconfirm -S automake-wrapper autoconf-wrapper make mingw-w64-i686-gcc mingw-w64-i686-libusb

      - name: Bootstrap
        run: |
          export PATH=/usr/bin:/usr/local/bin:/mingw32/bin
          ./bootstrap.sh

      - name: Configure
        run: |
          export PATH=/usr/bin:/usr/local/bin:/mingw32/bin
          ./configure CFLAGS="-Werror -O2" --disable-dependency-tracking ${{ steps.override.outputs.override }}

      - name: Build
        run: |
          export PATH=/usr/bin:/usr/local/bin:/mingw32/bin
          make -j4

      - name: Prep dist
        shell: pwsh
        run: |
          mkdir dist

          # The binary
          cp src/dfu-programmer.exe dist/

          # The docs
          cp docs/dfu-programmer.html dist/

          # Libusb 1.0
          cp C:/msys64/mingw32/bin/libusb-1.0.dll dist/
          cp C:/msys64/mingw32/share/licenses     dist/ -Recurse

      - name: Upload dist as Build Artifact
        uses: actions/upload-artifact@v3.1.0
        with:
          name: Windows x86 - dfu-programmer
          path: dist

      - name: Test
        shell: pwsh
        run: dist/dfu-programmer.exe --help

      - name: Make release archives of binaries
        if: startsWith(github.ref, 'refs/tags/v')
        shell: pwsh
        working-directory: dist
        run: |
          7z a -tzip ../dfu-programmer-x86-${{ steps.version.outputs.version }}.zip *
          7z a -t7z  ../dfu-programmer-x86-${{ steps.version.outputs.version }}.7z  *

      - name: Release
        uses: softprops/action-gh-release@v1
        if: startsWith(github.ref, 'refs/tags/v')
        with:
          fail_on_unmatched_files: true
          files: |
            dfu-programmer-x86-${{ steps.version.outputs.version }}.zip
            dfu-programmer-x86-${{ steps.version.outputs.version }}.7z

  Windows-x64:
    name: Windows x64
    runs-on: windows-latest

    defaults:
      run:
        shell: C:/msys64/usr/bin/bash.exe --noprofile --norc -e -x -o pipefail {0}

    steps:
      - uses: actions/checkout@v3

      - name: Override Version String
        if: "!startsWith(github.ref, 'refs/tags/v')"
        id: override
        shell: bash
        run: echo 'override=PACKAGE_STRING="dfu-programmer ${{ github.ref_name }} ${{ github.sha }}"' >> $GITHUB_OUTPUT

      - name: Get version
        if: startsWith(github.ref, 'refs/tags/v')
        id: version
        shell: bash
        run: echo version=${GITHUB_REF#refs/tags/v} >> $GITHUB_OUTPUT

      - name: Dependencies
        run: |
          # Fix issues with MSYS2 and cygwin tools conflicting by just using MSYS2
          export PATH=/usr/bin:/usr/local/bin

          # While some of these are already available, they are cygwin versions which are incompatible with MSYS2
          pacman --color always --noconfirm -S automake-wrapper autoconf-wrapper make mingw-w64-x86_64-gcc mingw-w64-x86_64-libusb

      - name: Bootstrap
        run: |
          export PATH=/usr/bin:/usr/local/bin:/mingw64/bin
          ./bootstrap.sh

      - name: Configure
        run: |
          export PATH=/usr/bin:/usr/local/bin:/mingw64/bin
          ./configure CFLAGS="-Werror -O2" --disable-dependency-tracking ${{ steps.override.outputs.override }}

      - name: Build
        run: |
          export PATH=/usr/bin:/usr/local/bin:/mingw64/bin
          make -j4

      - name: Prep dist
        shell: pwsh
        run: |
          mkdir dist

          # The binary
          cp src/dfu-programmer.exe dist/

          # The docs
          cp docs/dfu-programmer.html dist/

          # Libusb 1.0
          cp C:/msys64/mingw64/bin/libusb-1.0.dll dist/
          cp C:/msys64/mingw64/share/licenses     dist/ -Recurse

      - name: Upload dist as Build Artifact
        uses: actions/upload-artifact@v3.1.0
        with:
          name: Windows x64 - dfu-programmer
          path: dist

      - name: Test
        shell: pwsh
        run: dist/dfu-programmer.exe --help

      - name: Make release archives of binaries
        if: startsWith(github.ref, 'refs/tags/v')
        shell: pwsh
        working-directory: dist
        run: |
          7z a -tzip ../dfu-programmer-x64-${{ steps.version.outputs.version }}.zip *
          7z a -t7z  ../dfu-programmer-x64-${{ steps.version.outputs.version }}.7z  *

      - name: Release
        uses: softprops/action-gh-release@v1
        if: startsWith(github.ref, 'refs/tags/v')
        with:
          fail_on_unmatched_files: true
          files: |
            dfu-programmer-x64-${{ steps.version.outputs.version }}.zip
            dfu-programmer-x64-${{ steps.version.outputs.version }}.7z

  Linux:
    name: Linux x64
    runs-on: ubuntu-latest

    steps:
      - run: sudo apt-get install -y libusb-1.0-0-dev

      - uses: actions/checkout@v3

      - name: Override Version String
        if: "!startsWith(github.ref, 'refs/tags/v')"
        id: override
        run: echo 'override=PACKAGE_STRING="dfu-programmer ${{ github.ref_name }} ${{ github.sha }}"' >> $GITHUB_OUTPUT

      - name: Get version
        if: startsWith(github.ref, 'refs/tags/v')
        id: version
        run: echo version=${GITHUB_REF#refs/tags/v} >> $GITHUB_OUTPUT

      - name: Get Changes
        if: startsWith(github.ref, 'refs/tags/v')
        id: changes
        run: |
          echo "## Changes" > CHANGES
          echo "" >> CHANGES
          sed -ne '2,/^== Release/p' NEWS | head -n -2 >> CHANGES

      - name: bootstrap
        run: ./bootstrap.sh

      - name: configure
        run: ./configure CFLAGS="-Werror -O2" --disable-dependency-tracking ${{ steps.override.outputs.override }}

      - name: make
        run: make -j4

      - name: Test
        run: src/dfu-programmer --help

      - name: Upload Binary as Build Artifact
        uses: actions/upload-artifact@v3.1.0
        with:
          name: Linux x64 - dfu-programmer binary
          path: src/dfu-programmer

      - name: make dist
        run: make -j4 dist

      - name: Upload Tarball as Build Artifact
        uses: actions/upload-artifact@v3.1.0
        with:
          name: Linux x64 - dfu-programmer dist
          path: "*.tar.gz"

      - name: Make release archives of binaries
        if: startsWith(github.ref, 'refs/tags/v')
        working-directory: src
        run: |
          7z a -tzip ../dfu-programmer-linux-${{ steps.version.outputs.version }}.zip dfu-programmer
          7z a -t7z  ../dfu-programmer-linux-${{ steps.version.outputs.version }}.7z  dfu-programmer
      
      - name: Test Release Archives
        run: |
          mkdir -p test-build
          tar xzf dfu-programmer-*.tar.gz -C test-build
          cd test-build/dfu-programmer-*
          ./bootstrap.sh
          ./configure CFLAGS="-Werror -O2" --disable-dependency-tracking
          make -j4
          src/dfu-programmer --help

      - name: Release
        uses: softprops/action-gh-release@v1
        if: startsWith(github.ref, 'refs/tags/v')
        with:
          body_path: CHANGES
          fail_on_unmatched_files: true
          files: |
            dfu-programmer-*.tar.gz
            dfu-programmer-linux-${{ steps.version.outputs.version }}.zip
            dfu-programmer-linux-${{ steps.version.outputs.version }}.7z

  macOS:
    name: macOS x64
    runs-on: macos-latest

    steps:
      - run: brew install automake

      - uses: actions/checkout@v3

      - name: Override Version String
        if: "!startsWith(github.ref, 'refs/tags/v')"
        id: override
        run: echo 'override=PACKAGE_STRING="dfu-programmer ${{ github.ref_name }} ${{ github.sha }}"' >> $GITHUB_OUTPUT

      - name: Get version
        if: startsWith(github.ref, 'refs/tags/v')
        id: version
        run: echo version=${GITHUB_REF#refs/tags/v} >> $GITHUB_OUTPUT

      - name: bootstrap
        run: ./bootstrap.sh

      - name: configure
        run: ./configure CFLAGS="-Werror -O2" --disable-dependency-tracking ${{ steps.override.outputs.override }}

      - name: make
        run: make -j4

      - name: Test
        run: src/dfu-programmer --help

      - name: Upload Binary as Build Artifact
        uses: actions/upload-artifact@v3.1.0
        with:
          name: macOS - dfu-programmer binary
          path: src/dfu-programmer

      - name: make dist
        run: make -j4 dist

      - name: Upload Tarball as Build Artifact
        uses: actions/upload-artifact@v3.1.0
        with:
          name: macOS - dfu-programmer dist
          path: "*.tar.gz"

      - name: Make release archives of binaries
        if: startsWith(github.ref, 'refs/tags/v')
        working-directory: src
        run: |
          7z a -tzip ../dfu-programmer-macOS-${{ steps.version.outputs.version }}.zip dfu-programmer
          7z a -t7z  ../dfu-programmer-macOS-${{ steps.version.outputs.version }}.7z  dfu-programmer

      - name: Release
        uses: softprops/action-gh-release@v1
        if: startsWith(github.ref, 'refs/tags/v')
        with:
          fail_on_unmatched_files: true
          files: |
            dfu-programmer-macOS-${{ steps.version.outputs.version }}.zip
            dfu-programmer-macOS-${{ steps.version.outputs.version }}.7z