Skip to content

Commit

Permalink
fix: update goreleaser config and add build ci job (#496)
Browse files Browse the repository at this point in the history
* fix: update goreleaser config and add build ci job to make sure goreleaser works

* update job name and remove web build

* update golangci-lint and fix cloud dockerfile
  • Loading branch information
floreks authored Feb 22, 2024
1 parent 0be7c40 commit 5ff4f46
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 31 deletions.
4 changes: 1 addition & 3 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@ plural.lock
.golangci.yml
docker-compose.yml
*.md
plural.lock
Pluralfile
renovate.json
packer/
hack/
Makefile
Dockerfile
dockerfiles
!dockerfiles/dind-config
!dockerfiles/dind-config
54 changes: 54 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -397,3 +397,57 @@ jobs:
uses: golangci/golangci-lint-action@v4
with:
version: v1.54.2
build:
name: GoReleaser build
strategy:
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
include:
- os: ubuntu-latest
goos: linux
- os: macos-latest
goos: darwin
- os: windows-latest
goos: windows
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Go
uses: actions/[email protected]
with:
go-version-file: go.mod
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.18.1
- name: Setup SHA variable
shell: bash
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Setup Cache
uses: actions/[email protected]
with:
path: dist/${{ matrix.goos }}
key: ${{ matrix.goos }}-${{ env.sha_short }}
enableCrossOsArchive: true
- name: Install Dependencies
if: matrix.goos == 'linux'
shell: bash
run: |
sudo apt update
sudo apt install -y libwebkit2gtk-4.0-dev libgtk-3-dev
- name: GoReleaser (Build)
uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser-pro
version: latest
args: release --clean --split --timeout 90m
env:
CGO_LDFLAGS: "${{ matrix.goos == 'darwin' && '-framework UniformTypeIdentifiers' || '' }}"
GOOS: ${{ matrix.GOOS }}
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITLAB_CLIENT_SECRET: ${{ secrets.GITLAB_CLIENT_SECRET }}
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}
52 changes: 26 additions & 26 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ builds:
- linux_amd64
- linux_arm64
- windows_amd64
# TODO: Re-enable once fixed
# Ref: https://github.com/golang/go/issues/51019
# - windows_arm64
# TODO: Re-enable once fixed
# Ref: https://github.com/golang/go/issues/51019
# - windows_arm64
- darwin_amd64
- darwin_arm64
env:
- CGO_ENABLED=1
- CGO_ENABLED=0
ldflags:
- -s
- -w
Expand All @@ -43,21 +43,21 @@ builds:
env:
- CGO_ENABLED=0
# Build CLI binary without embedded UI for linux.
- id: plural-cli-console
targets:
- linux_amd64
- linux_arm64
ldflags:
- -s
- -w
- -X "github.com/pluralsh/plural-cli/cmd/plural.Version={{.Version}}"
- -X "github.com/pluralsh/plural-cli/cmd/plural.Commit={{.Commit}}"
- -X "github.com/pluralsh/plural-cli/cmd/plural.Date={{.Date}}"
- -X "github.com/pluralsh/plural-cli/pkg/scm.GitlabClientSecret={{.Env.GITLAB_CLIENT_SECRET}}"
tags: [ linux ]
env:
- CGO_ENABLED=0
binary: plural
# - id: plural-cli-console
# targets:
# - linux_amd64
# - linux_arm64
# ldflags:
# - -s
# - -w
# - -X "github.com/pluralsh/plural-cli/cmd/plural.Version={{.Version}}"
# - -X "github.com/pluralsh/plural-cli/cmd/plural.Commit={{.Commit}}"
# - -X "github.com/pluralsh/plural-cli/cmd/plural.Date={{.Date}}"
# - -X "github.com/pluralsh/plural-cli/pkg/scm.GitlabClientSecret={{.Env.GITLAB_CLIENT_SECRET}}"
# tags: [ linux ]
# env:
# - CGO_ENABLED=0
# binary: plural

archives:
- id: plural-cli
Expand All @@ -67,13 +67,13 @@ archives:
{{- title .Os }}_
{{- if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
- id: plural-cli-console
builds: [ plural-cli-console ]
name_template: >-
{{ .ProjectName }}_console_{{ .Version }}_
{{- title .Os }}_
{{- if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
# - id: plural-cli-console
# builds: [ plural-cli-console ]
# name_template: >-
# {{ .ProjectName }}_console_{{ .Version }}_
# {{- title .Os }}_
# {{- if eq .Arch "386" }}i386
# {{- else }}{{ .Arch }}{{ end }}

checksum:
name_template: 'checksums.txt'
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ genmock: # generates mocks before running tests

.PHONY: lint
lint:
docker run --rm -v $(PWD):/app -w /app golangci/golangci-lint:v1.54.2 golangci-lint run
docker run --rm -v $(PWD):/app -w /app golangci/golangci-lint:v1.56.2 golangci-lint run

.PHONY: delete-tag
delete-tag:
Expand Down
2 changes: 1 addition & 1 deletion dockerfiles/Dockerfile.cloud
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.20-alpine3.17 AS builder
FROM golang:1.22-alpine3.19 AS builder

WORKDIR /workspace

Expand Down

0 comments on commit 5ff4f46

Please sign in to comment.