-
Notifications
You must be signed in to change notification settings - Fork 137
84 lines (74 loc) · 4 KB
/
arduino_packing_release.yml
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
name: avrdude_packing_release
env:
# The name of the project
PROJECT_NAME: avrdude
DIST_DIR: dist
ARTIFACT_NAME: dist
on:
push:
tags:
- "v[0-9]+.[0-9]+*"
jobs:
build:
name: build (${{ matrix.config.os }}, ${{ matrix.config.arch }})
runs-on:
ubuntu-latest
strategy:
matrix:
config:
- os: Linux
arch: 64bit
cross_compile: x86_64-ubuntu16.04-linux-gnu
- os: Linux
arch: 32bit
cross_compile: i686-ubuntu16.04-linux-gnu
- os: Linux
arch: ARMv6
cross_compile: arm-linux-gnueabihf
- os: Linux
arch: ARM64
cross_compile: aarch64-linux-gnu
- os: macOS
arch: 64bit
cross_compile: x86_64-apple-darwin13
cross_compiler: o64-clang
ar: /opt/osxcross/target/bin/x86_64-apple-darwin13-ar # we have to manually specify the full path otherwise it's not found for some reason
ld: /opt/osxcross/target/bin/x86_64-apple-darwin13-ld
- os: Windows
arch: 32bit
cross_compile: i686-w64-mingw32
extension: .exe
container:
image: ghcr.io/arduino/crossbuild:0.2.2
steps:
- name: Checkout avrdude repository
uses: actions/checkout@v3
- name: replace system ranlib with darwin one
# for some reason is not possible to override ranlib with env vars, so this is ugly but it's the only way I found
if: matrix.config.os == 'macOS'
run: |
mv /usr/bin/ranlib /usr/bin/ranlib.bk
ln -s /opt/osxcross/target/bin/${{ matrix.config.cross_compile }}-ranlib /usr/bin/ranlib
- name: Build Avrdude
run: |
if [ "${{ matrix.config.os }}" = "macOS" ]; then
# For darwin we disable the static flags (not supported by clang) and we make some adjustments
cmake -DCMAKE_C_COMPILER=${{ matrix.config.cross_compiler }} -DCMAKE_CXX_COMPILER=${{ matrix.config.cross_compiler }}++ -DCMAKE_AR=${{ matrix.config.ar }} -DCMAKE_LINKER=${{ matrix.config.ld}} -DCMAKE_EXE_LINKER_FLAGS="-L/opt/lib/${{ matrix.config.cross_compile }}/lib/" -DCMAKE_C_FLAGS="-I/opt/lib/${{ matrix.config.cross_compile }}/include -pthread -framework Foundation -framework IOKit -framework Cocoa -framework Security -DHAVE_USB_H" -DCMAKE_PREFIX_PATH=/opt/lib/${{ matrix.config.cross_compile }}/ -DHAVE_LIBFTDI="NO" -DUSE_STATIC_LIBS="ON" -B build/
else
cmake -DCMAKE_C_COMPILER=${{ matrix.config.cross_compile }}-gcc -DCMAKE_CXX_COMPILER=${{ matrix.config.cross_compile }}-g++ -DCMAKE_EXE_LINKER_FLAGS="-static-libgcc -static-libstdc++" -DCMAKE_C_FLAGS="-I/opt/lib/${{ matrix.config.cross_compile }}/include/libusb-1.0/ -I/opt/lib/${{ matrix.config.cross_compile }}/include -pthread" -DCMAKE_PREFIX_PATH=/opt/lib/${{ matrix.config.cross_compile }}/ -DHAVE_LIBFTDI="NO" -B build/
fi
cmake --build build/ -v
- name: Package
run: | # we need to create the subdir where to place binaries
mkdir -p ${{ env.PROJECT_NAME }}_${{ matrix.config.os }}_${{ matrix.config.arch }}/bin ${{ env.PROJECT_NAME }}_${{ matrix.config.os }}_${{ matrix.config.arch }}/etc
chmod +x build/src/${{ env.PROJECT_NAME }}${{ matrix.config.extension }}
mv -v build/src/${{ env.PROJECT_NAME }}${{ matrix.config.extension }} ${{ env.PROJECT_NAME }}_${{ matrix.config.os }}_${{ matrix.config.arch }}/bin
mv -v build/src/${{ env.PROJECT_NAME }}.conf ${{ env.PROJECT_NAME }}_${{ matrix.config.os }}_${{ matrix.config.arch }}/etc
mv -v COPYING ${{ env.PROJECT_NAME }}_${{ matrix.config.os }}_${{ matrix.config.arch }}/LICENSE.txt
tar -czv ${{ env.PROJECT_NAME }}_${{ matrix.config.os }}_${{ matrix.config.arch }} -f ${{ env.PROJECT_NAME }}_${GITHUB_REF##*/}_${{ matrix.config.os }}_${{ matrix.config.arch }}.tar.gz
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
if-no-files-found: error
name: ${{ env.ARTIFACT_NAME }}
path: avrdude_*