From 2b48a80d8e184ce29c8a779ad9c6fef40a6eb3b7 Mon Sep 17 00:00:00 2001 From: Jean-Marc MEESSEN Date: Wed, 8 Feb 2023 22:07:33 +0100 Subject: [PATCH] review and fix build tooling (#85) * Changes due to the Goreleaser upgrade * Get rid of GoReleaser warnings * Update "CI" GitHub action * Update "release" GitHub action --- .github/workflows/ci.yml | 26 ++++++++++++++------------ .github/workflows/release.yml | 9 +++++---- .goreleaser.yml | 19 +++++++++++++------ Makefile | 4 ++-- 4 files changed, 34 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4bf11cb..babe440 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,12 +15,12 @@ jobs: runs-on: ubuntu-latest steps: - name: Set up Go - uses: actions/setup-go@v2 + uses: actions/setup-go@v3 with: - go-version: '^1.15.2' + go-version: '^1.19.5' - name: Check out code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Lint Go Code run: | @@ -34,12 +34,12 @@ jobs: runs-on: ubuntu-latest steps: - name: Set up Go - uses: actions/setup-go@v2 + uses: actions/setup-go@v3 with: - go-version: '^1.15.2' + go-version: '^1.19.5' - name: Check out code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Run Unit tests. run: | @@ -57,19 +57,21 @@ jobs: name: Build and Integration tests needs: [lint, test] steps: - - uses: actions/checkout@v2 - - uses: actions/setup-go@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-go@v3 with: - go-version: '^1.17.2' + go-version: '^1.19.5' - run: go mod download - name: Validates GO releaser config - uses: goreleaser/goreleaser-action@master + uses: goreleaser/goreleaser-action@v4 with: + distribution: goreleaser args: check - name: Run GoReleaser - uses: goreleaser/goreleaser-action@master + uses: goreleaser/goreleaser-action@v4 with: - args: release --snapshot --skip-publish --rm-dist + distribution: goreleaser + args: release --snapshot --skip-publish --clean - name: Setup BATS run: test/install-bats.sh - name: Run End-To_end testing with the docker container diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 80077c3..64ed910 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,17 +8,18 @@ jobs: runs-on: ubuntu-latest name: goreleaser steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Login to DockerHub Registry run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin - name: Unshallow Fetch run: git fetch --prune --unshallow - - uses: actions/setup-go@v2 + - uses: actions/setup-go@v3 with: - go-version: '^1.17.2' + go-version: '^1.19.5' - name: Release via goreleaser - uses: goreleaser/goreleaser-action@master + uses: goreleaser/goreleaser-action@v4 with: + distribution: goreleaser args: release --release-notes=doc/whats_new.md env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.goreleaser.yml b/.goreleaser.yml index 14a4ff0..b12c472 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -18,6 +18,10 @@ builds: goarch: '386' - goos: windows goarch: amd64 + - goos: windows + goarch: arm64 + - goos: windows + goarch: arm ldflags: - -s -w -X FLEcli/flecmd.version={{.Version}} -X FLEcli/flecmd.commit={{.Commit}} -X FLEcli/flecmd.date={{.Date}} -X=FLEcli/flecmd.builtBy=goReleaser @@ -48,15 +52,18 @@ dockers: - "--label=org.opencontainers.image.version={{.Version}}" archives: -- replacements: - amd64: 64-bit - 386: 32-bit - darwin: macOS - linux: Linux - name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" +- name_template: >- + {{ .ProjectName }}_ + {{ .Version }}_ + {{- if eq .Os "darwin"}}macOS + {{- else }}{{- .Os }}{{ end }}_ + {{- if eq .Arch "amd64" }}64-bit + {{- else if eq .Arch "386" }}32-bit + {{- else }}{{ .Arch }}{{ end }} format_overrides: - goos: windows format: zip + rlcp: true files: - README.md - doc/whats_new.md diff --git a/Makefile b/Makefile index efb40e2..15fe4a1 100644 --- a/Makefile +++ b/Makefile @@ -30,8 +30,8 @@ test-coverage: ## Run tests with coverage @cat cover.out >> coverage.txt build: ## Build the binary file - @goreleaser --snapshot --skip-publish --rm-dist - @cp dist/FLEcli_darwin_amd64/FLEcli . + @goreleaser --snapshot --skip-publish --clean + @cp dist/FLEcli_darwin_amd64_v1/FLEcli . clean: ## Remove previous build @rm -f ./FLEcli