Remove vpp-static build (#3)

This commit is contained in:
Dark Litss 2021-12-19 23:06:10 +08:00 committed by GitHub
parent 9db9b73ffd
commit 0cb900db02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 190 additions and 151 deletions

View File

@ -69,16 +69,30 @@ jobs:
shell: /bin/sh shell: /bin/sh
install: | install: |
apt-get -y update apt-get -y update
apt install software-properties-common -y
apt install software-properties-common curl -y
echo "deb [trusted=yes] https://packagecloud.io/fdio/release/ubuntu focal main" > /etc/apt/sources.list.d/99fd.io.list
curl -L https://packagecloud.io/fdio/release/gpgkey | apt-key add -
add-apt-repository ppa:longsleep/golang-backports add-apt-repository ppa:longsleep/golang-backports
apt-get -y update apt-get -y update
apt-get install -y vpp vpp-plugin-core python3-vpp-api vpp-dbg vpp-dev libmemif libmemif-dev || true
apt-get install -y wireguard-tools golang-go build-essential git apt-get install -y wireguard-tools golang-go build-essential git
run: | run: |
make all static make all static
make vpp || true
mkdir /artifacts/${artifact_dir} mkdir /artifacts/${artifact_dir}
cp etherguard-go* /artifacts/${artifact_dir} cp etherguard-go* /artifacts/${artifact_dir}
- uses: actions/upload-artifact@v2 - uses: actions/upload-artifact@v2
if: ${{ matrix.arch == 'armv7' }}
with: with:
name: etherguard-multi_arch name: etherguard-arm32
path: artifacts/ path: artifacts/armv7
- uses: actions/upload-artifact@v2
if: ${{ matrix.arch == 'aarch64' }}
with:
name: etherguard-arm64
path: artifacts/aarch64

View File

@ -1,133 +1,174 @@
name: Publish name: Publish
on: on:
push: push:
tags: tags:
- '*' - '*'
jobs: jobs:
x86_64: x86_64:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
name: Build for ${{ matrix.distro }} x86_64 and mipsle name: Build for ${{ matrix.distro }} x86_64 and mipsle
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Set up Go - name: Set up Go
uses: actions/setup-go@v2 uses: actions/setup-go@v2
with: with:
go-version: 1.17 go-version: 1.17
- name: Install requirements - name: Install requirements
run: | run: |
echo "deb [trusted=yes] https://packagecloud.io/fdio/release/ubuntu focal main" | sudo tee -a /etc/apt/sources.list.d/99fd.io.list > /dev/null echo "deb [trusted=yes] https://packagecloud.io/fdio/release/ubuntu focal main" | sudo tee -a /etc/apt/sources.list.d/99fd.io.list > /dev/null
curl -L https://packagecloud.io/fdio/release/gpgkey | sudo apt-key add - curl -L https://packagecloud.io/fdio/release/gpgkey | sudo apt-key add -
sudo apt-get -y update sudo apt-get -y update
sudo apt-get install -y vpp vpp-plugin-core python3-vpp-api vpp-dbg vpp-dev libmemif libmemif-dev sudo apt-get install -y vpp vpp-plugin-core python3-vpp-api vpp-dbg vpp-dev libmemif libmemif-dev
sudo apt-get install -y wireguard-tools upx-ucl sudo apt-get install -y wireguard-tools upx-ucl
- name: Build x86_64 - name: Build x86_64
run: | run: |
make all static vpp make all static vpp
- uses: actions/upload-artifact@v2 - uses: actions/upload-artifact@v2
with: with:
name: etherguard-x86_64 name: etherguard-x86_64
path: etherguard-go* path: etherguard-go*
- name: Upload x86_64 dynamic build - name: Upload x86_64 dynamic build
uses: svenstaro/upload-release-action@v2 uses: svenstaro/upload-release-action@v2
with: with:
repo_token: ${{ secrets.GITHUB_TOKEN }} repo_token: ${{ secrets.GITHUB_TOKEN }}
file: etherguard-go file: etherguard-go
asset_name: etherguard-go-x86_64 asset_name: etherguard-go-x86_64
tag: ${{ github.ref }} tag: ${{ github.ref }}
- name: Upload x86_64 static build - name: Upload x86_64 dynamic vpp build
uses: svenstaro/upload-release-action@v2 uses: svenstaro/upload-release-action@v2
with: with:
repo_token: ${{ secrets.GITHUB_TOKEN }} repo_token: ${{ secrets.GITHUB_TOKEN }}
file: etherguard-go-static file: etherguard-go-vpp
asset_name: etherguard-go-static-x86_64 asset_name: etherguard-go-x86_64
tag: ${{ github.ref }} tag: ${{ github.ref }}
- name: Build mipsle - name: Upload x86_64 static build
run: | uses: svenstaro/upload-release-action@v2
make clean with:
GOOS=linux GOARCH=mipsle GOMIPS=softfloat make all static repo_token: ${{ secrets.GITHUB_TOKEN }}
upx -9 etherguard-go* file: etherguard-go-static
asset_name: etherguard-go-static-x86_64
- uses: actions/upload-artifact@v2 tag: ${{ github.ref }}
with:
name: etherguard-mipsle - name: Build mipsle
path: etherguard-go* run: |
make clean
- name: Upload mipsle dynamic build GOOS=linux GOARCH=mipsle GOMIPS=softfloat make all static
uses: svenstaro/upload-release-action@v2 upx -9 etherguard-go*
with:
repo_token: ${{ secrets.GITHUB_TOKEN }} - uses: actions/upload-artifact@v2
file: etherguard-go with:
asset_name: etherguard-go-mipsle name: etherguard-mipsle
tag: ${{ github.ref }} path: etherguard-go*
- name: Upload mipsle static build - name: Upload mipsle dynamic build
uses: svenstaro/upload-release-action@v2 uses: svenstaro/upload-release-action@v2
with: with:
repo_token: ${{ secrets.GITHUB_TOKEN }} repo_token: ${{ secrets.GITHUB_TOKEN }}
file: etherguard-go-static file: etherguard-go
asset_name: etherguard-go-static-mipsle asset_name: etherguard-go-mipsle
tag: ${{ github.ref }} tag: ${{ github.ref }}
multi-arch:
runs-on: ubuntu-20.04 - name: Upload mipsle dynamic vpp build
name: Build on ${{ matrix.distro }} ${{ matrix.arch }} uses: svenstaro/upload-release-action@v2
strategy: with:
matrix: repo_token: ${{ secrets.GITHUB_TOKEN }}
include: file: etherguard-go-vpp
- arch: aarch64 asset_name: etherguard-go-mipsle
- arch: armv7 tag: ${{ github.ref }}
steps:
- uses: actions/checkout@v2
- uses: uraimo/run-on-arch-action@v2.0.5 - name: Upload mipsle static build
name: Build artifact uses: svenstaro/upload-release-action@v2
id: build with:
with: repo_token: ${{ secrets.GITHUB_TOKEN }}
arch: ${{ matrix.arch }} file: etherguard-go-static
distro: ubuntu20.04 asset_name: etherguard-go-static-mipsle
githubToken: ${{ github.token }} tag: ${{ github.ref }}
setup: |
mkdir -p "${PWD}/artifacts" multi-arch:
dockerRunArgs: | runs-on: ubuntu-20.04
--volume "${PWD}/artifacts:/artifacts" name: Build on ${{ matrix.distro }} ${{ matrix.arch }}
env: | strategy:
artifact_dir: ${{ matrix.arch }} matrix:
shell: /bin/sh include:
install: | - arch: aarch64
apt-get -y update - arch: armv7
apt install software-properties-common -y steps:
add-apt-repository ppa:longsleep/golang-backports - uses: actions/checkout@v2
apt-get -y update - uses: uraimo/run-on-arch-action@v2.0.5
apt-get install -y wireguard-tools golang-go build-essential git name: Build artifact
run: | id: build
make all static with:
mkdir /artifacts/${artifact_dir} arch: ${{ matrix.arch }}
cp etherguard-go* /artifacts/${artifact_dir} distro: ubuntu20.04
githubToken: ${{ github.token }}
- uses: actions/upload-artifact@v2 setup: |
with: mkdir -p "${PWD}/artifacts"
name: etherguard-multi_arch dockerRunArgs: |
path: artifacts/ --volume "${PWD}/artifacts:/artifacts"
env: |
- name: Upload dynamic build artifact_dir: ${{ matrix.arch }}
uses: svenstaro/upload-release-action@v2 shell: /bin/sh
with: install: |
repo_token: ${{ secrets.GITHUB_TOKEN }} apt-get -y update
file: artifacts/${{ martix.arch }}/etherguard-go
asset_name: etherguard-go-${{ martix.arch }} apt install software-properties-common curl -y
tag: ${{ github.ref }}
echo "deb [trusted=yes] https://packagecloud.io/fdio/release/ubuntu focal main" > /etc/apt/sources.list.d/99fd.io.list
- name: Upload static build curl -L https://packagecloud.io/fdio/release/gpgkey | apt-key add -
uses: svenstaro/upload-release-action@v2 add-apt-repository ppa:longsleep/golang-backports
with:
repo_token: ${{ secrets.GITHUB_TOKEN }} apt-get -y update
file: artifacts/${{ martix.arch }}/etherguard-go-static apt-get install -y vpp vpp-plugin-core python3-vpp-api vpp-dbg vpp-dev libmemif libmemif-dev || true
asset_name: etherguard-go-static-${{ martix.arch }} apt-get install -y wireguard-tools golang-go build-essential git
run: |
make all static
make vpp || true
mkdir /artifacts/${artifact_dir}
cp etherguard-go* /artifacts/${artifact_dir}
- uses: actions/upload-artifact@v2
if: ${{ matrix.arch == 'armv7' }}
with:
name: etherguard-arm32
path: artifacts/armv7
- uses: actions/upload-artifact@v2
if: ${{ matrix.arch == 'aarch64' }}
with:
name: etherguard-arm64
path: artifacts/aarch64
- name: Upload ${{ matrix.arch }} dynamic build
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: artifacts/${{ martix.arch }}/etherguard-go
asset_name: etherguard-go-${{ martix.arch }}
tag: ${{ github.ref }}
- name: Upload ${{ matrix.arch }} dynamic vpp build
if: ${{ matrix.arch == 'aarch64' }}
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: artifacts/${{ martix.arch }}/etherguard-go
asset_name: etherguard-go-${{ martix.arch }}
tag: ${{ github.ref }}
- name: Upload ${{ matrix.arch }} static build
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: artifacts/${{ martix.arch }}/etherguard-go-static
asset_name: etherguard-go-static-${{ martix.arch }}
tag: ${{ github.ref }} tag: ${{ github.ref }}

View File

@ -45,13 +45,6 @@ etherguard-go-vpp: $(wildcard *.go) $(wildcard */*.go)
patch -p0 -i govpp_remove_crcstring_check.patch && \ patch -p0 -i govpp_remove_crcstring_check.patch && \
go build -v -tags vpp -o "$@" go build -v -tags vpp -o "$@"
etherguard-go-vpp-static: $(wildcard *.go) $(wildcard */*.go)
go mod download && \
go mod tidy && \
go mod vendor && \
patch -p0 -i govpp_remove_crcstring_check.patch && \
CGO_ENABLED=0 go build -trimpath -a -ldflags '-s -w -extldflags "-static"' -v -tags vpp -o "$@"
static: static:
@export GIT_CEILING_DIRECTORIES="$(realpath $(CURDIR)/..)" && \ @export GIT_CEILING_DIRECTORIES="$(realpath $(CURDIR)/..)" && \
tag="$$(git describe 2>/dev/null)" && \ tag="$$(git describe 2>/dev/null)" && \
@ -61,15 +54,6 @@ static:
git update-index --assume-unchanged version.go || true git update-index --assume-unchanged version.go || true
@$(MAKE) etherguard-go-static @$(MAKE) etherguard-go-static
static-vpp:
@export GIT_CEILING_DIRECTORIES="$(realpath $(CURDIR)/..)" && \
tag="$$(git describe 2>/dev/null)" && \
ver="$$(printf 'package main\n\nconst Version = "%s"\n' "$$tag")" && \
[ "$$(cat version.go 2>/dev/null)" != "$$ver" ] && \
echo "$$ver" > version.go && \
git update-index --assume-unchanged version.go || true
@$(MAKE) etherguard-go-vpp-static
install: etherguard-go install: etherguard-go
@install -v -d "$(DESTDIR)$(BINDIR)" && install -v -m 0755 "$<" "$(DESTDIR)$(BINDIR)/etherguard-go" @install -v -d "$(DESTDIR)$(BINDIR)" && install -v -m 0755 "$<" "$(DESTDIR)$(BINDIR)/etherguard-go"