From ac339b5ffd52eb2e314b8affd73a3ef8e66ffe4c Mon Sep 17 00:00:00 2001 From: Philipp Trulson Date: Tue, 12 Jan 2021 13:08:28 +0100 Subject: [PATCH 1/7] Migrate to GitHub actions --- .github/workflows/ci.yaml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/ci.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 000000000..44fc32f99 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,30 @@ +name: Golang CI + +on: + push: + branches: [master] + pull_request: + types: [opened, reopened, synchronize] + schedule: + - cron: '15 3 * * 0' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Setup Go + uses: actions/setup-go@v2 + with: + go-version: '1.15' + - name: Checkout code + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Test Project + run: | + make test + - name: Build Project + env: + CGO_ENABLED: 0 + run: | + make From 0cbcda67ff0896f6fe0477d4c3f039576ac7f500 Mon Sep 17 00:00:00 2001 From: Philipp Trulson Date: Tue, 12 Jan 2021 13:11:33 +0100 Subject: [PATCH 2/7] Install golint --- .github/workflows/ci.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 44fc32f99..434e123e4 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -16,6 +16,9 @@ jobs: uses: actions/setup-go@v2 with: go-version: '1.15' + - name: Setup tools + run: | + go get golang.org/x/lint/golint - name: Checkout code uses: actions/checkout@v2 with: @@ -24,7 +27,5 @@ jobs: run: | make test - name: Build Project - env: - CGO_ENABLED: 0 run: | make From d2db23cf79a2b7e185304e525e75210a9ae8b721 Mon Sep 17 00:00:00 2001 From: Philipp Trulson Date: Wed, 13 Jan 2021 16:22:06 +0100 Subject: [PATCH 3/7] Don't fetch all tags for normal builds --- .github/workflows/ci.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 434e123e4..f89352a21 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -21,8 +21,6 @@ jobs: go get golang.org/x/lint/golint - name: Checkout code uses: actions/checkout@v2 - with: - fetch-depth: 0 - name: Test Project run: | make test From f30b8f5e0d2a8bf7c75490ff15b3b1a06ef89462 Mon Sep 17 00:00:00 2001 From: Philipp Trulson Date: Wed, 13 Jan 2021 16:22:17 +0100 Subject: [PATCH 4/7] Build zips for Windows --- golang.mk | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/golang.mk b/golang.mk index 26b1b0df1..b10520c61 100644 --- a/golang.mk +++ b/golang.mk @@ -25,6 +25,7 @@ GOPKGS=$(shell go list ./...) OUTPUT_FILE=$(NAME)-$(BUILD_VERSION)-$(shell go env GOOS)-$(shell go env GOARCH)$(shell go env GOARM)$(shell go env GOEXE) OUTPUT_LINK=$(NAME)$(shell go env GOEXE) +WINDOWS_ZIP=$(shell echo $(OUTPUT_FILE) | sed 's/\.exe/\.zip/') default: build @@ -69,7 +70,11 @@ build: go_generate _build $(foreach TARGET,$(TARGETS),ln -sf $(OUTPUT_FILE) dist/$(OUTPUT_LINK);) compress: _build +ifeq ($(GOOS),windows) + zip -j dist/$(WINDOWS_ZIP) dist/$(OUTPUT_FILE) +else tar czf dist/$(OUTPUT_FILE).tar.gz -C dist $(OUTPUT_FILE) +endif rm -f dist/$(OUTPUT_FILE) xc: go_generate From 171f91e944e0ffa604eb5fb5fb7b8417e0cba07d Mon Sep 17 00:00:00 2001 From: Philipp Trulson Date: Wed, 13 Jan 2021 16:22:29 +0100 Subject: [PATCH 5/7] Build & upload release assets --- .github/workflows/release.yaml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 000000000..515ecca98 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,31 @@ +name: Publish release artifacts + +on: + release: + type: [created] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Setup Go + uses: actions/setup-go@v2 + with: + go-version: '1.15' + - name: Checkout code + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Build Project binaries + env: + CGO_ENABLED: 0 + run: | + make xc + - name: Upload binaries to release + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: dist/aws* + tag: ${{ github.ref }} + overwrite: true + file_glob: true From 487118fb9a3ff1088a82aa89812992e2fc7f9f49 Mon Sep 17 00:00:00 2001 From: Philipp Trulson Date: Wed, 13 Jan 2021 16:29:02 +0100 Subject: [PATCH 6/7] Remove travis --- .travis.yml | 29 ----------------------------- 1 file changed, 29 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 8b8523e8d..000000000 --- a/.travis.yml +++ /dev/null @@ -1,29 +0,0 @@ -sudo: required - -language: go - -services: - - docker - -script: -- docker build --target=builder -t aws-nuke --no-cache . -- > - docker run - --name aws-nuke - --entrypoint "sh" - -e CGO_ENABLED=0 - --workdir "/src" - aws-nuke - -euxc "make xc && mkdir releases && mv dist/aws-nuke-* releases" -- docker cp -L aws-nuke:/src/releases ./releases -- ls -l * - -deploy: - provider: releases - api_key: $GITHUB_TOKEN - file_glob: true - file: releases/* - skip_cleanup: true - on: - repo: rebuy-de/aws-nuke - tags: true From 47392816faa78547a85382b1ed22a6504e341939 Mon Sep 17 00:00:00 2001 From: Philipp Trulson Date: Wed, 13 Jan 2021 16:34:19 +0100 Subject: [PATCH 7/7] Add job names --- .github/workflows/ci.yaml | 1 + .github/workflows/release.yaml | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index f89352a21..3657911d2 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -10,6 +10,7 @@ on: jobs: build: + name: CI Build runs-on: ubuntu-latest steps: - name: Setup Go diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 515ecca98..40b8a8904 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -5,7 +5,8 @@ on: type: [created] jobs: - build: + release: + name: Publish binaries runs-on: ubuntu-latest steps: - name: Setup Go