forked from nanobox-io/nanobox
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updates to the new name(space)s, and some cleanup
Static tests are expected to fail at the moment. Further cleanup is required, but some issues are either false positives, or will need more extensive rewrites/refactors to address. Hopefully most of the most egregious issues are already addressed, though. Oh, and we also move frorm Travis to GitHub Actions. Huzzah!
- Loading branch information
1 parent
987f0ee
commit e815e20
Showing
242 changed files
with
1,782 additions
and
1,962 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
jobs: | ||
static: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Run the checks | ||
uses: danhunsaker/golang-github-actions@main | ||
with: | ||
run: misspell,fmt,vet,cyclo,imports,ineffassign,errcheck,sec,shadow,staticcheck | ||
ignore-defer: true | ||
flags: '{"sec": "-exclude=G104"}' | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
env: | ||
PATH: '/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' | ||
|
||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: actions/setup-go@v2 | ||
with: | ||
go-version: '^1.17' | ||
|
||
- name: Setup dependencies | ||
run: | | ||
go get -t ./... | ||
- name: Run the tests | ||
run: go test -v ./... | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
needs: test | ||
if: github.event_name != 'pull_request' | ||
# These permissions are needed to interact with GitHub's OIDC Token endpoint. | ||
permissions: | ||
id-token: write | ||
contents: read | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
# the default image for act doesn't include this tool, but the actual GHA environment does... | ||
- name: (LOCAL ONLY) Install AWS CLI | ||
if: github.actor == 'nektos/act' | ||
run: | | ||
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" | ||
unzip -q awscliv2.zip | ||
sudo ./aws/install | ||
- uses: actions/setup-go@v2 | ||
with: | ||
go-version: '^1.17' | ||
|
||
- name: Setup dependencies | ||
run: | | ||
go install github.com/mitchellh/gox@latest | ||
go get -t ./... | ||
- name: Build | ||
run: | | ||
./scripts/build.sh | ||
- name: Configure AWS credentials for publication | ||
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 }} | ||
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/s3-write | ||
role-duration-seconds: 1200 | ||
aws-region: us-east-1 | ||
|
||
- name: Publish | ||
run: | | ||
./scripts/upload.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,75 @@ | ||
TAG=`git describe --always --tags --abbrev=0 | tr -d "[v\r\n]"` | ||
COMMIT=`git rev-parse --short HEAD | tr -d "[ \r\n\']"` | ||
BUILD_DATE=`date -u +%y%m%dT%H%M` | ||
GITSTATUS='$(shell git status 2> /dev/null | tail -n1)' | ||
DIRTY="$(shell [ $(GITSTATUS) = 'no changes added to commit (use "git add" and/or "git commit -a")' ] && echo -n "*")" | ||
GO_LDFLAGS="-s -X github.com/nanobox-io/nanobox/util/odin.apiKey=$(API_KEY) -X github.com/nanobox-io/nanobox/models.nanoVersion=$(TAG) -X github.com/nanobox-io/nanobox/models.nanoCommit=$(COMMIT)$(DIRTY) -X github.com/nanobox-io/nanobox/models.nanoBuild=$(BUILD_DATE)" | ||
TAG=$(shell git describe --always --tags --abbrev=0 | tr -d "[v\r\n]") | ||
TAGDIR=$(shell echo $(TAG) | sed -E 's/([0-9]+)\..+/v\1/') | ||
COMMIT=$(shell git rev-parse --short HEAD | tr -d "[ \r\n\']") | ||
BUILD_DATE=$(shell date -u +%Y%m%dT%H%M%S) | ||
GITSTATUS=$(shell git status 2> /dev/null | tail -n1) | ||
DIRTY=$(shell [ "$(GITSTATUS)" = 'nothing to commit, working tree clean' ] || echo -n "+") | ||
GO_LDFLAGS="-s -X github.com/mu-box/microbox/util/odin.apiKey=$(API_KEY) -X github.com/mu-box/microbox/models.microVersion=$(TAG) -X github.com/mu-box/microbox/models.microCommit=$(COMMIT)$(DIRTY) -X github.com/mu-box/microbox/models.microBuild=$(BUILD_DATE)" | ||
|
||
default: build | ||
default: all | ||
|
||
local: linux windows darwin | ||
|
||
clean: | ||
@echo "Cleaning old builds" | ||
@rm -rf "./.build" | ||
|
||
all: build | ||
|
||
# go get github.com/mitchellh/gox | ||
build: clean | ||
@echo "Building nanobox" | ||
@gox -ldflags=$(GO_LDFLAGS) -osarch "darwin/amd64 linux/amd64 windows/amd64" -output="./.build/v2/{{.OS}}/{{.Arch}}/nanobox" | ||
@echo -en "Nanobox Version $(TAG)-$(BUILD_DATE) ($(COMMIT))" > ./.build/v2/version | ||
@echo "Building nanobox-update" | ||
@cd ./updater && gox -osarch "darwin/amd64 linux/amd64 windows/amd64" -ldflags="-s" -output="../.build/v2/{{.OS}}/{{.Arch}}/nanobox-update" | ||
@echo "Building microbox" | ||
@gox -ldflags=$(GO_LDFLAGS) -osarch "darwin/amd64 darwin/arm64 linux/amd64 linux/arm linux/arm64 linux/s390x windows/amd64" -output="./.build/$(TAGDIR)/{{.OS}}/{{.Arch}}/microbox" | ||
@echo -n "Microbox Version $(TAG)-$(BUILD_DATE) ($(COMMIT)$(DIRTY))" > ./.build/$(TAGDIR)/version | ||
@echo "Building microbox-update" | ||
@cd ./updater && gox -osarch "darwin/amd64 darwin/arm64 linux/amd64 linux/arm linux/arm64 linux/s390x windows/amd64" -ldflags="-s" -output="../.build/$(TAGDIR)/{{.OS}}/{{.Arch}}/microbox-update" | ||
|
||
|
||
native: | ||
@echo "Building microbox (native os/arch)" | ||
@go build -ldflags=$(GO_LDFLAGS) -o microbox | ||
|
||
|
||
linux: linux-amd64 linux-arm32 linux-arm64 linux-s390x | ||
|
||
linux-amd64: | ||
@echo "Building microbox-linux-amd64" | ||
@GOOS=linux GOARCH=amd64 go build -ldflags=$(GO_LDFLAGS) -o microbox-linux-amd64 | ||
|
||
linux-arm32: | ||
@echo "Building microbox-linux-arm32" | ||
@GOOS=linux GOARCH=arm go build -ldflags=$(GO_LDFLAGS) -o microbox-linux-arm32 | ||
|
||
linux-arm64: | ||
@echo "Building microbox-linux-arm64" | ||
@GOOS=linux GOARCH=arm64 go build -ldflags=$(GO_LDFLAGS) -o microbox-linux-arm64 | ||
|
||
linux-s390x: | ||
@echo "Building microbox-linux-s390x" | ||
@GOOS=linux GOARCH=s390x go build -ldflags=$(GO_LDFLAGS) -o microbox-linux-s390x | ||
|
||
|
||
windows: windows-amd64 | ||
|
||
windows-amd64: | ||
@echo "Building microbox-windows-amd64" | ||
@GOOS=windows GOARCH=amd64 go build -ldflags=$(GO_LDFLAGS) -o microbox-windows-amd64 | ||
|
||
|
||
darwin: darwin-amd64 darwin-arm64 | ||
|
||
linux: | ||
@echo "Building nanobox-linux" | ||
@GOOS=linux go build -ldflags=$(GO_LDFLAGS) -o nanobox-linux | ||
darwin-amd64: | ||
@echo "Building microbox-darwin-amd64" | ||
@GOOS=darwin GOARCH=amd64 go build -ldflags=$(GO_LDFLAGS) -o microbox-darwin-amd64 | ||
|
||
windows: | ||
@echo "Building nanobox-windows" | ||
@GOOS=windows go build -ldflags=$(GO_LDFLAGS) -o nanobox-windows | ||
darwin-arm64: | ||
@echo "Building microbox-darwin-arm64" | ||
@GOOS=darwin GOARCH=arm64 go build -ldflags=$(GO_LDFLAGS) -o microbox-darwin-arm64 | ||
|
||
darwin: | ||
@echo "Building nanobox-darwin" | ||
@GOOS=darwin go build -ldflags=$(GO_LDFLAGS) -o nanobox-darwin | ||
|
||
# go get github.com/kardianos/govendor | ||
test: | ||
@govendor test +local -v | ||
@go test -v ./... | ||
|
||
|
||
.PHONY: fmt test clean build linux windows darwin | ||
.PHONY: test clean all build native linux windows windows-amd64 darwin darwin-amd64 darwin-arm64 |
Oops, something went wrong.
e815e20
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⚠ misspell failed (.)
e815e20
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⚠ gocyclo failed (.)
6 function(s) exceeding a complexity of 15
Show Detail
e815e20
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⚠ ineffassign failed (.)
e815e20
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⚠ errcheck failed (.)
e815e20
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⚠ gosec failed (.)
Show Detail
Code Reference
e815e20
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⚠ shadow failed (.)
e815e20
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⚠ staticcheck failed (.)
Checks Document
e815e20
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⚠ Failure Summary