This repository has been archived by the owner on Mar 7, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
72 lines (63 loc) · 3.34 KB
/
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
name: release
on:
push:
tags:
- v*
env:
GITHUB_TOKEN: ${{ github.token }}
jobs:
my-job:
name: Build plugin on Push Tag 🚀
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Cache Go
id: cache
uses: actions/cache@v2
with:
# A list of files, directories, and wildcard patterns to cache and restore
path: ~/go/pkg/mod
key: ${{ runner.os }}-build-${{ hashFiles('**/go.sum') }}
- name: Tidy Go modules
run: go mod tidy
- name: Install cross C compiler
run: |
sudo apt-get update
sudo apt-get install -y build-essential module-assistant gcc-9-multilib-i686-linux-gnu g++-9-multilib-i686-linux-gnu gcc-9-arm-linux-gnueabihf g++-9-arm-linux-gnueabihf gcc-9-aarch64-linux-gnu g++-9-aarch64-linux-gnu
wget -nv https://downloads.openwrt.org/releases/19.07.8/targets/brcm2708/bcm2708/openwrt-sdk-19.07.8-brcm2708-bcm2708_gcc-7.5.0_musl_eabi.Linux-x86_64.tar.xz
tar -xJf openwrt-sdk-19.07.8-brcm2708-bcm2708_gcc-7.5.0_musl_eabi.Linux-x86_64.tar.xz
mv openwrt-sdk-19.07.8-brcm2708-bcm2708_gcc-7.5.0_musl_eabi.Linux-x86_64 op19078-brcm2708
rm openwrt-sdk-19.07.8-brcm2708-bcm2708_gcc-7.5.0_musl_eabi.Linux-x86_64.tar.xz
- name: Build raspi1 openwrt (arm1176jzf-s+vfp)
run: |
PATH=$PATH:`pwd`/op19078-brcm2708/staging_dir/toolchain-arm_arm1176jzf-s+vfp_gcc-7.5.0_musl_eabi/bin/
export PATH
export STAGING_DIR=`pwd`/op19078-brcm2708/staging_dir/toolchain-arm_arm1176jzf-s+vfp_gcc-7.5.0_musl_eabi/
export CGO_CFLAGS=$CGO_CFLAGS" -fuse-ld=bfd"
echo $CGO_CFLAGS
export CGO_LDFLAGS=$CGO_LDFLAGS" -fuse-ld=bfd"
echo $CGO_LDFLAGS
export GOGCCFLAGS=$GOGCCFLAGS" -fuse-ld=bfd"
echo $GOGCCFLAGS
CGO_ENABLED=1 GOOS=linux GOARCH=arm GOARM=6 CC=arm-openwrt-linux-gcc CXX=arm-openwrt-linux-g++ AR=arm-openwrt-linux-ar go build -ldflags="-s -w" -buildmode=plugin -o artifacts/plugin-openwrt-linux-arm1176jzf-s+vfp.so
- name: Build linux-x64
run: CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -buildmode=plugin -o artifacts/plugin-linux-x64.so
- name: Build linux-x86
run: CGO_ENABLED=1 GOOS=linux GOARCH=386 CC=i686-linux-gnu-gcc-9 CXX=i686-linux-gnu-g++-9 AR=i686-linux-gnu-ar go build -ldflags="-s -w" -buildmode=plugin -o artifacts/plugin-linux-x86.so
- name: Build arm64
run: CGO_ENABLED=1 GOOS=linux GOARCH=arm64 GOARM=7 CC=aarch64-linux-gnu-gcc-9 CXX=aarch64-linux-gnu-g++-9 AR=aarch64-linux-gnu-ar go build -ldflags="-s -w" -buildmode=plugin -o artifacts/plugin-linux-arm64.so
- name: Build armhfv6
run: CGO_ENABLED=1 GOOS=linux GOARCH=arm GOARM=6 CC=arm-linux-gnueabihf-gcc-9 CXX=arm-linux-gnueabihf-g++-9 AR=arm-linux-gnueabihf-ar go build -ldflags="-s -w" -buildmode=plugin -o artifacts/plugin-linux-armhfv6.so
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: artifacts/plugin-*
tag: ${{ github.ref }}
overwrite: true
file_glob: true