mirror of https://github.com/statping/statping
commit
6277cc4e35
|
@ -54,104 +54,105 @@ jobs:
|
||||||
name: static-rice-box
|
name: static-rice-box
|
||||||
path: ./source
|
path: ./source
|
||||||
|
|
||||||
build:
|
build:
|
||||||
needs: frontend
|
needs: frontend
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
platform: [linux]
|
platform: [linux]
|
||||||
arch: [386, amd64, arm-7, arm-6, arm64]
|
arch: [386, amd64, arm-7, arm-6, arm64]
|
||||||
include:
|
include:
|
||||||
- platform: darwin
|
- platform: darwin
|
||||||
arch: arm64
|
arch: arm64
|
||||||
- platform: darwin
|
- platform: darwin
|
||||||
arch: amd64
|
arch: amd64
|
||||||
- platform: windows
|
- platform: windows
|
||||||
arch: 386
|
arch: 386
|
||||||
- platform: windows
|
- platform: windows
|
||||||
arch: amd64
|
arch: amd64
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Download Compiled Frontend (rice-box.go)
|
- name: Download Compiled Frontend (rice-box.go)
|
||||||
uses: actions/download-artifact@v1
|
uses: actions/download-artifact@v1
|
||||||
with:
|
with:
|
||||||
name: static-rice-box
|
name: static-rice-box
|
||||||
path: ./source
|
path: ./source
|
||||||
|
|
||||||
- name: Add GOBIN to PATH
|
- name: Add GOBIN to PATH
|
||||||
run: |
|
run: |
|
||||||
echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV
|
echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Set Linux Build Flags
|
- name: Set Linux Build Flags
|
||||||
if: matrix.platform == 'linux'
|
if: matrix.platform == 'linux'
|
||||||
run: |
|
run: |
|
||||||
echo "BUILD_FLAGS=-extldflags -static" >> $GITHUB_ENV
|
echo "BUILD_FLAGS=-extldflags -static" >> $GITHUB_ENV
|
||||||
echo "XGO_TAGS=netgo osusergo linux sqlite_omit_load_extension" >> $GITHUB_ENV
|
echo "XGO_TAGS=netgo osusergo linux sqlite_omit_load_extension" >> $GITHUB_ENV
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Set MacOS (Darwin) Build Flags
|
- name: Set MacOS (Darwin) Build Flags
|
||||||
if: matrix.platform == 'darwin'
|
if: matrix.platform == 'darwin'
|
||||||
run : |
|
run : |
|
||||||
echo "XGO_TAGS=netgo osusergo darwin sqlite_omit_load_extension" >> $GITHUB_ENV
|
echo "XGO_TAGS=netgo osusergo darwin sqlite_omit_load_extension" >> $GITHUB_ENV
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Set Windows Build Flags
|
- name: Set Windows Build Flags
|
||||||
if: matrix.platform == 'windows'
|
if: matrix.platform == 'windows'
|
||||||
run: |
|
run: |
|
||||||
echo "BUILD_FLAGS=-extldflags -static -buildmode=exe" >> $GITHUB_ENV
|
echo "BUILD_FLAGS=-extldflags -static -buildmode=exe" >> $GITHUB_ENV
|
||||||
echo "XGO_TAGS=netgo osusergo sqlite_omit_load_extension" >> $GITHUB_ENV
|
echo "XGO_TAGS=netgo osusergo sqlite_omit_load_extension" >> $GITHUB_ENV
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Build ${{ matrix.platform }}/${{ matrix.arch }}
|
- name: Build ${{ matrix.platform }}/${{ matrix.arch }}
|
||||||
uses: crazy-max/ghaction-xgo@v1
|
uses: crazy-max/ghaction-xgo@v1
|
||||||
env:
|
env:
|
||||||
VERSION: ${{ env.VERSION }}
|
VERSION: ${{ env.VERSION }}
|
||||||
COMMIT: ${{ github.sha }}
|
COMMIT: ${{ github.sha }}
|
||||||
with:
|
with:
|
||||||
xgo_version: latest
|
xgo_version: latest
|
||||||
go_version: 1.17.x
|
go_version: 1.17.x
|
||||||
dest: build
|
dest: build
|
||||||
prefix: statping
|
prefix: statping
|
||||||
targets: ${{ matrix.platform }}/${{ matrix.arch }}
|
targets: ${{ matrix.platform }}/${{ matrix.arch }}
|
||||||
v: true
|
v: true
|
||||||
x: true
|
x: true
|
||||||
pkg: cmd
|
pkg: cmd
|
||||||
buildmode: pie
|
buildmode: pie
|
||||||
tags: ${{ env.XGO_TAGS }}
|
tags: ${{ env.XGO_TAGS }}
|
||||||
ldflags: -s -w -X main.VERSION=${{ env.VERSION }} -X main.COMMIT=${{ env.COMMIT }} ${{ env.BUILD_FLAGS }}
|
ldflags: -s -w -X main.VERSION=${{ env.VERSION }} -X main.COMMIT=${{ env.COMMIT }} ${{ env.BUILD_FLAGS }}
|
||||||
|
|
||||||
- name: Compress Linux Builds
|
- name: Compress Linux Builds
|
||||||
if: matrix.platform == 'linux'
|
if: matrix.platform == 'linux'
|
||||||
run: |
|
run: |
|
||||||
cd build
|
cd build
|
||||||
mv statping-linux-${{ matrix.arch }} statping
|
mv statping-linux-${{ matrix.arch }} statping
|
||||||
chmod +x statping
|
chmod +x statping
|
||||||
tar -czvf statping-linux-${{ matrix.arch }}.tar.gz statping
|
tar -czvf statping-linux-${{ matrix.arch }}.tar.gz statping
|
||||||
rm -rf statping
|
rm -rf statping
|
||||||
echo "compressed=statping-linux-${{ matrix.arch }}.tar.gz" >> $GITHUB_ENV
|
echo "compressed=statping-linux-${{ matrix.arch }}.tar.gz" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Compress Windows Builds
|
- name: Compress Windows Builds
|
||||||
if: matrix.platform == 'windows'
|
if: matrix.platform == 'windows'
|
||||||
run: |
|
run: |
|
||||||
cd build
|
cd build
|
||||||
mv statping-windows-${{ matrix.arch }}.exe statping.exe
|
mv statping-windows-${{ matrix.arch }}.exe statping.exe
|
||||||
chmod +x statping.exe
|
chmod +x statping.exe
|
||||||
zip statping-windows-${{ matrix.arch }}.zip statping.exe
|
zip statping-windows-${{ matrix.arch }}.zip statping.exe
|
||||||
rm -rf statping.exe
|
rm -rf statping.exe
|
||||||
echo "compressed=statping-windows-${{ matrix.arch }}.zip" >> $GITHUB_ENV
|
echo "compressed=statping-windows-${{ matrix.arch }}.zip" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Compress MacOS (Darwin) Builds
|
||||||
|
if: matrix.platform == 'darwin'
|
||||||
|
run: |
|
||||||
|
cd build
|
||||||
|
mv statping-darwin-${{ matrix.arch }} statping
|
||||||
|
chmod +x statping
|
||||||
|
tar -czvf statping-darwin-${{ matrix.arch }}.tar.gz *
|
||||||
|
rm -rf statping
|
||||||
|
echo "compressed=statping-darwin-${{ matrix.arch }}.tar.gz" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Compress MacOS (Darwin) Builds
|
|
||||||
if: matrix.platform == 'darwin'
|
|
||||||
run: |
|
|
||||||
cd build
|
|
||||||
mv statping-darwin-${{ matrix.arch }} statping
|
|
||||||
chmod +x statping
|
|
||||||
tar -czvf statping-darwin-${{ matrix.arch }}.tar.gz *
|
|
||||||
rm -rf statping
|
|
||||||
echo "compressed=statping-darwin-${{ matrix.arch }}.tar.gz" >> $GITHUB_ENV
|
|
||||||
- name: Upload Compiled Statping Binary
|
- name: Upload Compiled Statping Binary
|
||||||
uses: actions/upload-artifact@v1
|
uses: actions/upload-artifact@v1
|
||||||
with:
|
with:
|
||||||
|
@ -170,7 +171,6 @@ build:
|
||||||
prerelease: true
|
prerelease: true
|
||||||
files: build/${{ env.compressed }}
|
files: build/${{ env.compressed }}
|
||||||
|
|
||||||
|
|
||||||
# test:
|
# test:
|
||||||
# needs: frontend
|
# needs: frontend
|
||||||
# runs-on: [self-hosted, linux, aboutcher-hosted]
|
# runs-on: [self-hosted, linux, aboutcher-hosted]
|
||||||
|
|
Loading…
Reference in New Issue