Add GitHub deploy action

This commit is contained in:
Marius Greuel
2022-01-05 17:14:23 +01:00
parent fd03dde753
commit caea5fe234
2 changed files with 210 additions and 64 deletions

View File

@@ -1,5 +1,5 @@
#
# build_cmake.yml - GitHub build action for AVRDUDE
# build.yml - GitHub build action for AVRDUDE
# Copyright (C) 2021 Marius Greuel
#
# This program is free software; you can redistribute it and/or modify
@@ -43,23 +43,106 @@ jobs:
bison
libelf-dev
libusb-dev
libftdi1-dev
libusb-1.0-0-dev
libhidapi-dev
libftdi1-dev
libreadline-dev
- name: Configure
run: >-
cmake
-D DEBUG_CMAKE=1
-D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
-B ${{github.workspace}}/build
-B ../cmake_build
- name: Build
run: cmake --build ${{github.workspace}}/build
run: cmake --build ../cmake_build
- name: Archive build artifacts
if: always()
uses: actions/upload-artifact@v2
with:
name: linux-x86_64
path: |
${{github.workspace}}/build/*
cmake_build/
!**/*.d
!**/*.o
linux:
runs-on: ubuntu-latest
container: debian:11
defaults:
run:
working-directory: ./src
strategy:
matrix:
include:
- { arch: i386, processor: i686, prefix: i686-linux-gnu, inc-lib: i386-linux-gnu }
- { arch: armhf, processor: armhf, prefix: arm-linux-gnueabihf, inc-lib: arm-linux-gnueabihf }
- { arch: arm64, processor: aarch64, prefix: aarch64-linux-gnu, inc-lib: aarch64-linux-gnu }
steps:
- uses: actions/checkout@v2
- name: Add architecture
run: |
dpkg --add-architecture ${{matrix.arch}}
apt-get update
- name: Install prerequisites
run: >-
apt-get install -y
git
cmake
flex
bison
crossbuild-essential-${{matrix.arch}}
libelf-dev:${{matrix.arch}}
libusb-dev:${{matrix.arch}}
libusb-1.0-0-dev:${{matrix.arch}}
libhidapi-dev:${{matrix.arch}}
libftdi1-dev:${{matrix.arch}}
libreadline-dev:${{matrix.arch}}
- name: Configure
run: >-
cmake
-D DEBUG_CMAKE=1
-D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
-D CMAKE_SYSTEM_NAME=Linux
-D CMAKE_SYSTEM_PROCESSOR=${{matrix.processor}}
-D CMAKE_C_COMPILER=${{matrix.prefix}}-gcc
-D CMAKE_FIND_ROOT_PATH=/usr/${{matrix.prefix}}
-D CMAKE_INCLUDE_PATH=/usr/include/${{matrix.inc-lib}}
-D CMAKE_LIBRARY_PATH=/usr/lib/${{matrix.inc-lib}}
-B ../cmake_build
- name: Build
run: cmake --build ../cmake_build
- name: Archive build artifacts
if: always()
uses: actions/upload-artifact@v2
with:
name: linux-${{matrix.processor}}
path: |
cmake_build/
!**/*.d
!**/*.o
freebsd-x86_64:
runs-on: macos-10.15
steps:
- uses: actions/checkout@v2
- name: Build
id: build
uses: vmactions/freebsd-vm@v0.1.5
with:
prepare: pkg install -y git cmake flex bison libftdi1 hidapi
run: |
cd src
cmake -D DEBUG_CMAKE=1 -D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -D CMAKE_C_FLAGS=-I/usr/local/include -D CMAKE_EXE_LINKER_FLAGS=-L/usr/local/lib -B ../cmake_build
cmake --build ../cmake_build
- name: Archive build artifacts
if: always()
uses: actions/upload-artifact@v2
with:
name: freebsd-x86_64
path: |
cmake_build/
!**/*.d
!**/*.o
macos-x86_64:
runs-on: macos-latest
@@ -76,8 +159,8 @@ jobs:
bison
libelf
libusb
libftdi
hidapi
libftdi
- name: Configure
run: >-
cmake
@@ -85,22 +168,31 @@ jobs:
-D CMAKE_EXE_LINKER_FLAGS=-L/usr/local/Cellar
-D DEBUG_CMAKE=1
-D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
-B ${{github.workspace}}/build
-B ../cmake_build
- name: Build
run: cmake --build ${{github.workspace}}/build
run: cmake --build ../cmake_build
- name: Archive build artifacts
if: always()
uses: actions/upload-artifact@v2
with:
name: macos-x86_64
path: |
${{github.workspace}}/build/*
cmake_build/
!**/*.d
!**/*.o
msvc-x86_64:
msvc:
runs-on: windows-latest
defaults:
run:
working-directory: ./src
strategy:
matrix:
include:
- { arch: x86, platform: Win32 }
- { arch: x64, platform: x64 }
- { arch: arm, platform: ARM }
- { arch: arm64, platform: ARM64 }
steps:
- uses: actions/checkout@v2
- name: Install prerequisites
@@ -108,6 +200,7 @@ jobs:
- name: Configure
run: >-
cmake
-A ${{matrix.platform}}
-D DEBUG_CMAKE=1
-D CMAKE_SYSTEM_VERSION=11
-D CMAKE_C_FLAGS_RELWITHDEBINFO="/MT /GL /Zi /O2 /Ob1 /DNDEBUG"
@@ -115,17 +208,18 @@ jobs:
-D CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO="/DEBUG /INCREMENTAL:NO /LTCG /OPT:REF /OPT:ICF"
-D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
-D USE_EXTERNAL=1
-B ${{github.workspace}}/build
-B ../cmake_build
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
run: cmake --build ../cmake_build --config ${{env.BUILD_TYPE}}
- name: Archive build artifacts
if: always()
uses: actions/upload-artifact@v2
with:
name: msvc-x86_64
name: msvc-${{matrix.arch}}
path: |
${{github.workspace}}/build/*
!${{github.workspace}}/build/_deps/*
cmake_build/
!**/_deps/
!**/*.obj
mingw:
runs-on: windows-latest
@@ -136,8 +230,8 @@ jobs:
strategy:
matrix:
include:
- { sys: mingw32, env: i686 }
- { sys: mingw64, env: x86_64 }
- { arch: i686, sys: mingw32 }
- { arch: x86_64, sys: mingw64 }
steps:
- uses: actions/checkout@v2
- uses: msys2/setup-msys2@v2
@@ -146,62 +240,28 @@ jobs:
update: true
install: >-
base-devel
mingw-w64-${{matrix.env}}-gcc
mingw-w64-${{matrix.env}}-cmake
mingw-w64-${{matrix.env}}-libelf
mingw-w64-${{matrix.env}}-libusb
mingw-w64-${{matrix.env}}-libusb-compat-git
mingw-w64-${{matrix.env}}-hidapi
mingw-w64-${{matrix.env}}-libftdi
mingw-w64-${{matrix.arch}}-gcc
mingw-w64-${{matrix.arch}}-cmake
mingw-w64-${{matrix.arch}}-libelf
mingw-w64-${{matrix.arch}}-libusb
mingw-w64-${{matrix.arch}}-libusb-compat-git
mingw-w64-${{matrix.arch}}-hidapi
mingw-w64-${{matrix.arch}}-libftdi
- name: Configure
run: >-
cmake
-G"MSYS Makefiles"
-D DEBUG_CMAKE=1
-D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
-B ../build
-B ../cmake_build
- name: Build
run: cmake --build ../build
run: cmake --build ../cmake_build
- name: Archive build artifacts
if: always()
uses: actions/upload-artifact@v2
with:
name: mingw-${{matrix.env}}
name: mingw-${{matrix.arch}}
path: |
${{github.workspace}}/build/*
cross:
runs-on: ubuntu-latest
container: debian:11
defaults:
run:
working-directory: ./src
strategy:
matrix:
include:
- { arch: i386, env: i686, compiler: i686-linux-gnu-gcc }
- { arch: armhf, env: armhf, compiler: arm-linux-gnueabihf-gcc }
- { arch: arm64, env: arm64, compiler: aarch64-linux-gnu-gcc }
steps:
- uses: actions/checkout@v2
- name: Install prerequisites
run: |
dpkg --add-architecture ${{matrix.arch}}
apt-get update
apt-get install -y cmake flex bison crossbuild-essential-${{matrix.arch}} libusb-dev:${{matrix.arch}}
- name: Configure
run: >-
cmake
-D DEBUG_CMAKE=1
-D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
-D CMAKE_C_COMPILER=${{matrix.compiler}}
-B ${{github.workspace}}/build
- name: Build
run: cmake --build ${{github.workspace}}/build
- name: Archive build artifacts
if: always()
uses: actions/upload-artifact@v2
with:
name: linux-${{matrix.env}}
path: |
${{github.workspace}}/build/*
cmake_build/
!**/*.d
!**/*.obj

86
.github/workflows/deploy.yml vendored Normal file
View File

@@ -0,0 +1,86 @@
#
# deploy.yml - GitHub deploy action for AVRDUDE
# Copyright (C) 2021 Marius Greuel
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
name: Deploy
on:
push:
tags:
- 'v*'
jobs:
build:
uses: mariusgreuel/avrdude-fork/.github/workflows/build.yml@dev
release:
needs: build
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
tag_name: ${{github.ref}}
release_name: AVRDUDE ${{github.ref}}
body: "**[Release Notes:](https://github.com/avrdudes/avrdude/blob/main/NEWS)**"
draft: false
prerelease: false
asset-msvc:
needs: release
runs-on: ubuntu-latest
strategy:
matrix:
include:
- { arch: x86 }
- { arch: x64 }
- { arch: arm }
- { arch: arm64 }
steps:
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: msvc-${{matrix.arch}}
- name: Create release asset
run: >-
zip -j asset.zip
RelWithDebInfo/avrdude.exe
RelWithDebInfo/avrdude.pdb
avrdude.conf
- name: Upload release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
upload_url: ${{needs.release.outputs.upload_url}}
asset_path: ./asset.zip
asset_name: avrdude-${{github.ref_name}}-windows-${{matrix.arch}}.zip
asset_content_type: application/zip
#deploy:
# needs: [asset-msvc]
# runs-on: ubuntu-latest
# steps:
# - name: Create package (Chocolatey)
# run: echo TODO