xgo build matrix

pull/773/merge
hunterlong 2020-08-13 16:54:09 -07:00
parent e0b96a8591
commit 14ca36273f
1 changed files with 81 additions and 67 deletions

View File

@ -1,9 +1,14 @@
name: XGO Build Attempt name: Development Build
on: [push] on:
push:
branches:
- dev
paths-ignore:
- '**.md'
jobs: jobs:
compile: compile-frontend:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
@ -24,18 +29,19 @@ jobs:
run: npm install -g yarn sass cross-env run: npm install -g yarn sass cross-env
- name: Download Frontend Dependencies - name: Download Frontend Dependencies
if: steps.nodecache.outputs.cache-hit != 'true'
working-directory: ./frontend working-directory: ./frontend
run: yarn run: yarn
- name: Download Go mods - name: Download Go mods
if: steps.golangcache.outputs.cache-hit != 'true'
run: | run: |
go mod download go mod download
go mod verify go mod verify
make test-deps make test-deps
- name: Build Frontend Statping - name: Build Frontend Statping
env:
VERSION: ${{ env.VERSION }}
COMMIT: ${{ github.sha }}
run: make clean compile run: make clean compile
- name: Upload Compiled Frontend (rice-box.go) - name: Upload Compiled Frontend (rice-box.go)
@ -44,9 +50,32 @@ jobs:
name: static-rice-box name: static-rice-box
path: ./source path: ./source
xgo-build: - name: Configure AWS credentials for Asset uploads
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2
- name: Upload Static Assets to S3
run: |
tar -czvf source.tar.gz source/
aws s3 cp source.tar.gz s3://assets.statping.com/commit/${{ github.sha }}/
rm -rf source.tar.gz
compile-binaries:
needs: compile needs: compile
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
matrix:
platform: [windows, linux, darwin]
arch: [386, amd64, arm-7, arm-6, arm64]
exclude:
- platform: darwin
arch: [386, arm-7, arm-6, arm64]
- platform: windows
arch: [arm-7, arm-6, arm64]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
@ -61,8 +90,10 @@ jobs:
echo ::set-env name=VERSION::$(cat version.txt) echo ::set-env name=VERSION::$(cat version.txt)
shell: bash shell: bash
- name: check source - name: Set Build Flags
run: cd source && ls && cd dist && ls if: matrix.platform != darwin
run: echo ::set-env name=BUILD_FLAGS::'-extldflags -static'
shell: bash
- name: Build linux xgo - name: Build linux xgo
uses: crazy-max/ghaction-xgo@v1 uses: crazy-max/ghaction-xgo@v1
@ -74,73 +105,56 @@ jobs:
go_version: 1.15.x go_version: 1.15.x
dest: build dest: build
prefix: statping prefix: statping
targets: linux/amd64,linux/386,linux/arm-7,linux/arm-6,linux/arm64 targets: ${{ matrix.platform }}/${{ matrix.arch }}
v: false v: false
x: false x: false
pkg: cmd pkg: cmd
buildmode: pie buildmode: pie
ldflags: -s -w -X main.VERSION=${{ env.VERSION }} -X main.COMMIT=${{ env.COMMIT }} -extldflags -static ldflags: -s -w -X main.VERSION=${{ env.VERSION }} -X main.COMMIT=${{ env.COMMIT }} ${{ env.BUILD_FLAGS }}
- name: Build windows xgo - name: Upload Compiled Statping Binary
uses: crazy-max/ghaction-xgo@v1 uses: actions/upload-artifact@v1
env:
VERSION: ${{ env.VERSION }}
COMMIT: ${{ github.sha }}
with: with:
xgo_version: latest name: statping-${{ matrix.platform }}-${{ matrix.arch }}
go_version: 1.15.x path: ./build
dest: build
prefix: statping
targets: windows/386,windows/amd64
v: false
x: false
pkg: cmd
buildmode: pie
ldflags: -s -w -X main.VERSION=${{ env.VERSION }} -X main.COMMIT=${{ env.COMMIT }} -extldflags -static
- name: Build darwin xgo
uses: crazy-max/ghaction-xgo@v1
env:
VERSION: ${{ env.VERSION }}
COMMIT: ${{ github.sha }}
with:
xgo_version: latest
go_version: 1.15.x
dest: build
prefix: statping
targets: darwin/386,darwin/amd64
v: false
x: false
pkg: cmd
buildmode: exe
ldflags: -s -w -X main.VERSION=${{ env.VERSION }} -X main.COMMIT=${{ env.COMMIT }}
- name: check files - name: check files
run: pwd && ls && cd build && ls run: pwd && ls && cd build && ls
- name: Rename Binaries # - name: Production Ready Binaries
run: | # run: |
mv build/statping-darwin-10.6-amd64 build/statping-darwin-amd64 # cd build && chmod +x *
mv build/statping-windows-4.0-amd64.exe build/statping-windows-amd64.exe # mv statping-darwin-10.6-amd64 statping && tar -czvf statping-darwin-amd64.tar.gz statping && rm -f statping
# mv statping-linux-386 statping && tar -czvf statping-linux-386.tar.gz statping && rm -f statping
- name: Compress Binaries # mv statping-linux-amd64 statping && tar -czvf statping-linux-amd64.tar.gz statping && rm -f statping
run: cd build && for i in *; do tar -czf $i.tar.gz $i; done # mv statping-linux-386 statping && tar -czvf statping-linux-386.tar.gz statping && rm -f statping
# mv statping-linux-arm-7 statping && tar -czvf statping-linux-arm-7.tar.gz statping && rm -f statping
- name: Upload Releases # mv statping-linux-arm-6 statping && tar -czvf statping-linux-arm-6.tar.gz statping && rm -f statping
id: upload-assets # mv statping-linux-arm64 statping && tar -czvf statping-linux-arm64.tar.gz statping && rm -f statping
uses: softprops/action-gh-release@v1 # mv statping-windows-4.0-386.exe statping.exe && zip statping-windows-386.zip statping.exe && rm -f statping.exe
env: # mv statping-windows-4.0-amd64.exe statping.exe && zip statping-windows-amd64.zip statping.exe && rm -f statping.exe
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} #
VERSION: ${{ env.VERSION }} # - name: Upload Releases
with: # id: upload-assets
tag_name: dev-v${{ env.VERSION }} # uses: softprops/action-gh-release@v1
draft: true # env:
prerelease: true # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
files: | # VERSION: ${{ env.VERSION }}
build/statping-darwin-amd64.tar.gz # with:
build/statping-linux-amd64.tar.gz # tag_name: dev-v${{ env.VERSION }}
build/statping-linux-arm-6.tar.gz # draft: true
build/statping-linux-arm-7.tar.gz # prerelease: true
build/statping-linux-arm64.tar.gz # files: |
build/statping-windows-amd64.exe.tar.gz # build/statping-darwin-amd64.tar.gz
# build/statping-linux-386.tar.gz
# build/statping-linux-amd64.tar.gz
# build/statping-linux-arm-6.tar.gz
# build/statping-linux-arm-7.tar.gz
# build/statping-linux-arm64.tar.gz
# build/statping-windows-386.zip
# build/statping-windows-amd64.zip
#
# - name: Upload Compiled Binaries to S3
# run: |
# aws s3 cp build/*.* s3://assets.statping.com/commit/${{ github.sha }}/