Merge pull request #169 from AnalogJ/freebsd_action

pull/170/head
Jason Kulatunga 4 years ago committed by GitHub
commit 08634f2a88
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -56,3 +56,5 @@ jobs:
file: ${{ env.PROJECT_PATH }}/coverage.txt
flags: unittests
fail_ci_if_error: false

@ -0,0 +1,77 @@
# compiles FreeBSD artifacts and attaches them to build
name: Release FreeBSD
on:
release:
# Only use the types keyword to narrow down the activity types that will trigger your workflow.
types: [published]
jobs:
release-freebsd:
name: Release FreeBSD
runs-on: macos-latest
env:
PROJECT_PATH: /go/src/github.com/analogj/scrutiny
GOPATH: /go
GOOS: freebsd
GOARCH: amd64
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{github.event.release.tag_name}}
- name: Build Binaries
uses: vmactions/freebsd-vm@v0.1.3
with:
envs: 'PROJECT_PATH GOPATH GOOS GOARCH'
usesh: true
#TODO: lock go version using https://www.jeremymorgan.com/tutorials/golang/how-to-install-go-freebsd/
prepare: pkg install -y curl go gmake
run: |
pwd
ls -lah
whoami
freebsd-version
mkdir -p $(dirname "$PROJECT_PATH")
cp -R $GITHUB_WORKSPACE $PROJECT_PATH
cd $PROJECT_PATH
mkdir -p $GITHUB_WORKSPACE/dist
echo "building web binary (OS = ${GOOS}, ARCH = ${GOARCH})"
go build -ldflags "-extldflags=-static -X main.goos=${GOOS} -X main.goarch=${GOARCH}" -o $GITHUB_WORKSPACE/dist/scrutiny-web-${GOOS}-${GOARCH} -tags "static netgo sqlite_omit_load_extension" webapp/backend/cmd/scrutiny/scrutiny.go
chmod +x "$GITHUB_WORKSPACE/dist/scrutiny-web-${GOOS}-${GOARCH}"
file "$GITHUB_WORKSPACE/dist/scrutiny-web-${GOOS}-${GOARCH}" || true
ldd "$GITHUB_WORKSPACE/dist/scrutiny-web-${GOOS}-${GOARCH}" || true
echo "building collector binary (OS = ${GOOS}, ARCH = ${GOARCH})"
go build -ldflags "-extldflags=-static -X main.goos=${GOOS} -X main.goarch=${GOARCH}" -o $GITHUB_WORKSPACE/dist/scrutiny-collector-metrics-${GOOS}-${GOARCH} -tags "static netgo" collector/cmd/collector-metrics/collector-metrics.go
chmod +x "$GITHUB_WORKSPACE/dist/scrutiny-collector-metrics-${GOOS}-${GOARCH}"
file "$GITHUB_WORKSPACE/dist/scrutiny-collector-metrics-${GOOS}-${GOARCH}" || true
ldd "$GITHUB_WORKSPACE/dist/scrutiny-collector-metrics-${GOOS}-${GOARCH}" || true
- name: Release Asset - Web - freebsd-amd64
id: upload-release-asset1
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.SCRUTINY_GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: './dist/scrutiny-web-freebsd-amd64'
asset_name: scrutiny-web-freebsd-amd64
asset_content_type: application/octet-stream
- name: Release Asset - Collector - freebsd-amd64
id: upload-release-asset2
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.SCRUTINY_GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_urll }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: './dist/scrutiny-collector-metrics-freebsd-amd64'
asset_name: scrutiny-collector-metrics-freebsd-amd64
asset_content_type: application/octet-stream

@ -39,46 +39,5 @@ windows/amd64:
@echo "building collector binary (OS = $(OS), ARCH = $(ARCH))"
xgo -v --targets="$(OS)/$(ARCH)" -ldflags "-extldflags=-static -X main.goos=$(OS) -X main.goarch=$(ARCH)" -out scrutiny-collector-metrics -tags "static netgo" ${GO_WORKSPACE}/collector/cmd/collector-metrics/
freebsd/amd64: export GOOS = freebsd
freebsd/amd64: export GOARCH = amd64
freebsd/amd64:
mkdir -p /build
@echo "building web binary (OS = $(GOOS), ARCH = $(GOARCH))"
go build -ldflags "-extldflags=-static -X main.goos=$(GOOS) -X main.goarch=$(GOARCH)" -o /build/scrutiny-web-$(GOOS)-$(GOARCH) -tags "static netgo sqlite_omit_load_extension" webapp/backend/cmd/scrutiny/scrutiny.go
chmod +x "/build/scrutiny-web-$(GOOS)-$(GOARCH)"
file "/build/scrutiny-web-$(GOOS)-$(GOARCH)" || true
ldd "/build/scrutiny-web-$(GOOS)-$(GOARCH)" || true
@echo "building collector binary (OS = $(GOOS), ARCH = $(GOARCH))"
go build -ldflags "-extldflags=-static -X main.goos=$(GOOS) -X main.goarch=$(GOARCH)" -o /build/scrutiny-collector-metrics-$(GOOS)-$(GOARCH) -tags "static netgo" collector/cmd/collector-metrics/collector-metrics.go
chmod +x "/build/scrutiny-collector-metrics-$(GOOS)-$(GOARCH)"
file "/build/scrutiny-collector-metrics-$(GOOS)-$(GOARCH)" || true
ldd "/build/scrutiny-collector-metrics-$(GOOS)-$(GOARCH)" || true
freebsd/386: export GOOS = freebsd
freebsd/386: export GOARCH = 386
freebsd/386:
mkdir -p /build
@echo "building web binary (OS = $(GOOS), ARCH = $(GOARCH))"
go build -ldflags "-extldflags=-static -X main.goos=$(GOOS) -X main.goarch=$(GOARCH)" -o /build/scrutiny-web-$(GOOS)-$(GOARCH) -tags "static netgo sqlite_omit_load_extension" webapp/backend/cmd/scrutiny/scrutiny.go
chmod +x "/build/scrutiny-web-$(GOOS)-$(GOARCH)"
file "/build/scrutiny-web-$(GOOS)-$(GOARCH)" || true
ldd "/build/scrutiny-web-$(GOOS)-$(GOARCH)" || true
@echo "building collector binary (OS = $(GOOS), ARCH = $(GOARCH))"
go build -ldflags "-extldflags=-static -X main.goos=$(GOOS) -X main.goarch=$(GOARCH)" -o /build/scrutiny-collector-metrics-$(GOOS)-$(GOARCH) -tags "static netgo" collector/cmd/collector-metrics/collector-metrics.go
chmod +x "/build/scrutiny-collector-metrics-$(GOOS)-$(GOARCH)"
file "/build/scrutiny-collector-metrics-$(GOOS)-$(GOARCH)" || true
ldd "/build/scrutiny-collector-metrics-$(GOOS)-$(GOARCH)" || true
# clean:
# rm scrutiny-collector-metrics-* scrutiny-web-*

Loading…
Cancel
Save