Skip to content

Commit

Permalink
Merge branch 'cinderblock/github-actions-build' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
cinderblock committed Oct 13, 2022
2 parents d983195 + 882642a commit 84bf3ce
Show file tree
Hide file tree
Showing 11 changed files with 313 additions and 26 deletions.
5 changes: 5 additions & 0 deletions .gitattributes
@@ -0,0 +1,5 @@
AUTHORS text
ChangeLog text
COPYING text
NEWS text
README text
251 changes: 251 additions & 0 deletions .github/workflows/build.yml
@@ -0,0 +1,251 @@
name: Build dfu-programmer

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

on:
push:
pull_request:

jobs:
Windows-x32-libusb0:
name: Windows x86 with libusb0
runs-on: windows-latest

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

env:
AM_COLOR_TESTS: always

steps:
- uses: actions/checkout@v3

- 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
- name: Bootstrap
run: |
export PATH=/usr/bin:/usr/local/bin:/mingw32/bin
./bootstrap.sh
# Per README instructions
cp windows/usb.h /mingw32/include/
cp windows/libusb.a /mingw32/lib/
- name: Override Version
if: "!startsWith(github.ref, 'refs/tags/v')"
id: override
shell: bash
run: echo ::set-output 'name=override::PACKAGE_STRING="dfu-programmer ${{ github.ref_name }} ${{ github.sha }}"'

- name: Configure
run: |
export PATH=/usr/bin:/usr/local/bin:/mingw32/bin
./configure --disable-dependency-tracking --disable-libusb_1_0 ${{ steps.override.outputs.override }}
- name: Build
run: |
export PATH=/usr/bin:/usr/local/bin:/mingw32/bin
make -j4
- name: Download Atmel FLIP
uses: suisei-cn/actions-download-file@v1.0.1
id: flip
with:
url: https://ww1.microchip.com/downloads/en/DeviceDoc/Flip%20Installer%20-%203.4.7.112.exe

- name: Extract Atmel FLIP
run: 7z x ${{ steps.flip.outputs.filename }} usb COPYING_GPL.txt
shell: pwsh

- name: Prep dist
shell: pwsh
run: |
mkdir dist
# Don't forget the license
mv COPYING_GPL.txt usb/
# Not sure where this version number comes from
mv usb dist/dfu-prog-usb-1.2.2
# mv usb dist/
# The binary
cp src/dfu-programmer.exe dist/
# The docs
cp docs/dfu-programmer.html dist/
- name: Upload dist as Build Artifact
uses: actions/upload-artifact@v3.1.0
with:
name: Windows x86 - libusb0 - dfu-programmer
path: dist

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

- name: Make release archives of binaries
if: startsWith(github.ref, 'refs/tags/v')
shell: pwsh
working-directory: dist
run: |
7z a -tzip ../dfu-programmer-win-${{ steps.version.outputs.version }}.zip *
7z a -t7z ../dfu-programmer-win-${{ steps.version.outputs.version }}.7z *
- name: Test
shell: pwsh
run: |
mv dist/dfu-prog-usb-1.2.2/x86/libusb0_x86.dll dist/libusb0.dll
dist/dfu-programmer.exe --help
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/v')
with:
fail_on_unmatched_files: true
files: |
dfu-programmer-win-${{ steps.version.outputs.version }}.zip
dfu-programmer-win-${{ steps.version.outputs.version }}.7z
Linux:
name: Linux x64 with libusb1
runs-on: ubuntu-latest

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

- uses: actions/checkout@v3

- name: bootstrap
run: ./bootstrap.sh

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

- name: configure
run: ./configure --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 - libusb1 - dfu-programmer binary
path: src/dfu-programmer

- name: make dist
run: make -j4 dist

- name: Get version and Changes
if: startsWith(github.ref, 'refs/tags/v')
id: version
run: |
echo ::set-output name=version::${GITHUB_REF#refs/tags/v}
echo "## Changes" > CHANGES
echo "" >> CHANGES
sed -ne '2,/^== Release/p' NEWS | head -n -2 >> CHANGES
- name: Upload Tarball as Build Artifact
uses: actions/upload-artifact@v3.1.0
with:
name: Linux x64 - libusb1 - 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: 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-${{ steps.version.outputs.version }}.tar.gz
dfu-programmer-linux-${{ steps.version.outputs.version }}.zip
dfu-programmer-linux-${{ steps.version.outputs.version }}.7z
macOS:
name: macOS x64 with libusb1
runs-on: macos-latest

steps:
- run: brew install automake

- uses: actions/checkout@v3

- name: bootstrap
run: ./bootstrap.sh

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

- name: configure
run: ./configure --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 - libusb1 - 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 - libusb1 - dfu-programmer dist
path: "*.tar.gz"

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

- 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
4 changes: 4 additions & 0 deletions .gitignore
Expand Up @@ -19,3 +19,7 @@ src/*.hex

# tab completion file
dfu_programmer

m4/

*~
11 changes: 11 additions & 0 deletions .vscode/c_cpp_properties.json
@@ -0,0 +1,11 @@
{
"configurations": [
{
"name": "gcc",
"defines": ["__VSCODE__", "HAVE_CONFIG_H"],
"includePath": ["src"],
"compilerPath": "gcc"
}
],
"version": 4
}
8 changes: 5 additions & 3 deletions AUTHORS
Expand Up @@ -88,8 +88,10 @@ Contributors:
- Olivier Pisano
- support for atxmega16c4
- Neels Hofmeyr
- improvements to progress bar
- John Szakmeister
- improvements to progress bar
- John Szakmeister
- Fix exit status of help-related options and improve start sequence
- Alban Bedel
- Fix infinite loop using rpl_malloc
- Fix infinite loop using rpl_malloc
- Cameron Tacklind
- GitHub Actions Configuration
3 changes: 0 additions & 3 deletions ChangeLog

This file was deleted.

4 changes: 4 additions & 0 deletions NEWS
@@ -1,5 +1,9 @@
== Release 0.8.0 [2016-01-19]
* Experimental support for ST cortex M4
* Enable GitHub Actions for releases [2022-10-13]
* Make `./bootstrap.sh` fail if any command fails (and print commands)
* Update `configure.ac` features
* Added IntelliSense hints for Visual Studio Code

== Release 0.7.2 [2015-02-04]
* Fix memory bounds used for XMega targets.
Expand Down
27 changes: 15 additions & 12 deletions README
Expand Up @@ -86,9 +86,17 @@ Build procedure for Windows

Building Windows apps from source is never quite as simple ...
Firstly you need to have MinGW and MSys with developer tools.
Get them from http://sourceforge.net/projects/mingw/files/
Get them from http://sourceforge.net/projects/mingw/files/.
See `.github/workflows/build.yml` for examples of building on Windows
and the needed tools.

The windows build uses the libusb-win32 library, which is a
Open the MinGW shell window and change to the dfu-programmer folder.
Note that C:\dir is accessed in MinGW using the path /c/dir

[ If the source was checked-out from GitHub, run the following command ]
$ ./bootstrap.sh

The Windows build uses the libusb-win32 library, which is a
port of libusb 0.1. For convenience these files are included
with this distribution, located in the windows sub-directory.
You need to copy these files to your MinGW install directory
Expand All @@ -97,12 +105,6 @@ Build procedure for Windows
windows/usb.h -> {path-to-mingw}/include/usb.h
windows/libusb.a -> {path-to-mingw}/lib/libusb.a

Open the MinGW shell window and change to the dfu-programmer folder.
Note that C:\dir is accessed in MinGW using the path /c/dir

[ If the source was checked-out from GitHub, run the following command ]
$ ./bootstrap.sh

$ ./configure --disable-libusb_1_0

$ make
Expand All @@ -112,7 +114,8 @@ Build procedure for Windows

Windows Driver Files
====================
Atmel's FLIP programmer also uses libusb-win32, so we use the same
library here and take advantage of Atmel's official certified driver
set. The windows driver files can be downloaded as a separate zip file
dfu-prog-usb-x.x.x.zip

Atmel's FLIP programmer also uses libusb-win32, so we use the same
library here and take advantage of Atmel's official certified driver
set. The windows driver files can be downloaded as a separate zip file
dfu-prog-usb-x.x.x.zip
6 changes: 6 additions & 0 deletions bootstrap.sh
@@ -1,9 +1,15 @@
#! /bin/sh

set -e # exit on error
set -x # Enable echoing of commands

aclocal -I m4
autoheader
automake --foreign --add-missing --copy
autoconf

set +x # Disable echoing of commands

if [ "$(echo `uname`)" = "Linux" ]; then
TARGET_START_LINE=$( grep START_TARGET_LIST_LINE -n src/arguments.c | \
sed "s/^\(.*\):.*/\1/")
Expand Down

0 comments on commit 84bf3ce

Please sign in to comment.