Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: 1.22
go-version: 1.25

- name: Create fake PHP and .phar files
run: |
Expand All @@ -34,7 +34,10 @@ jobs:
touch internal/legacy/archives/php_darwin_arm64
touch internal/config/embedded-config.yaml

- name: Run linter
- name: Run lint-gomod
run: make lint-gomod

- name: Run golangci-lint
uses: golangci/golangci-lint-action@v8
with:
version: v2.4
Expand Down
4 changes: 2 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ variables:

unit-test-lint:
stage: check
image: cimg/go:1.22
image: cimg/go:1.25
extends: .go-cache
script:
# Fake some files to avoid the compiler or "typecheck" linter complaining about a missing embedded file.
Expand Down Expand Up @@ -116,7 +116,7 @@ build-php-macos-x86:

build:
stage: build
image: cimg/go:1.22
image: cimg/go:1.25
extends: .go-cache
script:
- make single
Expand Down
17 changes: 9 additions & 8 deletions .goreleaser.vendor.yaml.tpl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# GoReleaser configuration for the ${VENDOR_NAME} CLI.
version: 2
project_name: ${VENDOR_BINARY}

before:
Expand Down Expand Up @@ -47,18 +48,18 @@ builds:
- -s -w
- -X "github.com/platformsh/cli/internal/legacy.PHPVersion={{.Env.PHP_VERSION}}"
- -X "github.com/platformsh/cli/internal/legacy.LegacyCLIVersion={{.Env.LEGACY_CLI_VERSION}}"
- -X "github.com/platformsh/cli/commands.version={{.Version}}"
- -X "github.com/platformsh/cli/commands.commit={{.Commit}}"
- -X "github.com/platformsh/cli/commands.date={{.Date}}"
- -X "github.com/platformsh/cli/commands.vendor=${VENDOR_BINARY}"
- -X "github.com/platformsh/cli/commands.builtBy=goreleaser"
- -X "github.com/platformsh/cli/internal/config.Version={{.Version}}"
- -X "github.com/platformsh/cli/internal/config.Commit={{.Commit}}"
- -X "github.com/platformsh/cli/internal/config.Date={{.Date}}"
- -X "github.com/platformsh/cli/internal/config.Vendor=${VENDOR_BINARY}"
- -X "github.com/platformsh/cli/internal/config.BuiltBy=goreleaser"
main: ./cmd/platform

checksum:
name_template: checksums.txt

snapshot:
name_template: '{{ incpatch .Version }}-{{ .Now.Format "2006-01-02" }}-{{ .ShortCommit }}-next'
version_template: '{{ incpatch .Version }}-{{ .Now.Format "2006-01-02" }}-{{ .ShortCommit }}-next'

universal_binaries:
- id: ${VENDOR_BINARY}-macos
Expand All @@ -72,7 +73,7 @@ archives:
- completion/*
format_overrides:
- goos: windows
format: zip
formats: [zip]

nfpms:
- homepage: https://docs.upsun.com/anchors/fixed/cli/
Expand All @@ -81,7 +82,7 @@ nfpms:
maintainer: Antonis Kalipetis <antonis.kalipetis@platform.sh>
license: MIT
vendor: Platform.sh
builds:
ids:
- ${VENDOR_BINARY}
formats:
- apk
Expand Down
15 changes: 8 additions & 7 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# GoReleaser configuration for the Platform.sh CLI.
version: 2
project_name: platform

before:
Expand Down Expand Up @@ -99,7 +100,7 @@ checksum:
name_template: checksums.txt

snapshot:
name_template: '{{ incpatch .Version }}-{{ .Now.Format "2006-01-02" }}-{{ .ShortCommit }}-next'
version_template: '{{ incpatch .Version }}-{{ .Now.Format "2006-01-02" }}-{{ .ShortCommit }}-next'

changelog:
sort: asc
Expand Down Expand Up @@ -183,8 +184,8 @@ archives:
- completion/*
format_overrides:
- goos: windows
format: zip
builds:
formats: [zip]
ids:
- platform
- platform-macos

Expand All @@ -195,8 +196,8 @@ archives:
- completion/*
format_overrides:
- goos: windows
format: zip
builds:
formats: [zip]
ids:
- upsun
- upsun-macos

Expand Down Expand Up @@ -312,7 +313,7 @@ nfpms:
maintainer: Antonis Kalipetis <antonis.kalipetis@platform.sh>
license: MIT
vendor: Platform.sh
builds:
ids:
- platform
formats:
- apk
Expand All @@ -331,7 +332,7 @@ nfpms:
maintainer: Antonis Kalipetis <antonis.kalipetis@platform.sh>
license: MIT
vendor: Platform.sh
builds:
ids:
- upsun
formats:
- apk
Expand Down
21 changes: 15 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ PHP_BINARY_PATH := internal/legacy/archives/php_$(GOOS)_$(GOARCH)
VERSION := $(shell git describe --always)

# Tooling versions
GORELEASER_VERSION=v1.26
GORELEASER_VERSION=v2.12.0

internal/legacy/archives/platform.phar:
curl -L https://github.com/platformsh/legacy-cli/releases/download/v$(LEGACY_CLI_VERSION)/platform.phar -o internal/legacy/archives/platform.phar
Expand Down Expand Up @@ -68,7 +68,7 @@ php: $(PHP_BINARY_PATH)

.PHONY: goreleaser
goreleaser:
command -v goreleaser >/dev/null || go install github.com/goreleaser/goreleaser@$(GORELEASER_VERSION)
command -v goreleaser >/dev/null || go install github.com/goreleaser/goreleaser/v2@$(GORELEASER_VERSION)

.PHONY: single
single: goreleaser internal/legacy/archives/platform.phar php ## Build a single target release for Platform.sh or Upsun
Expand All @@ -88,13 +88,22 @@ release: goreleaser clean-phar internal/legacy/archives/platform.phar php ## Rel
VERSION=$(VERSION) bash cloudsmith.sh

.PHONY: test
# "We encourage users of encoding/json to test their programs with GOEXPERIMENT=jsonv2 enabled" (https://tip.golang.org/doc/go1.25)
test: ## Run unit tests
go clean -testcache
go test -v -race -mod=readonly -cover ./...
GOEXPERIMENT=jsonv2 go test -v -race -cover -count=1 ./...

.PHONY: lint
lint: ## Run linter
golangci-lint run --timeout=5m --verbose
lint: lint-gomod lint-golangci ## Run linters.

.PHONY: lint-gomod
lint-gomod:
ifneq ($(shell go mod tidy -v 2>/dev/stdout | tee /dev/stderr | grep -c 'unused '),0)
@false
endif

.PHONY: lint-golangci
lint-golangci:
golangci-lint run --timeout=2m

.goreleaser.vendor.yaml: check-vendor ## Generate the goreleaser vendor config
cat .goreleaser.vendor.yaml.tpl | envsubst > .goreleaser.vendor.yaml
Expand Down
47 changes: 22 additions & 25 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
module github.com/platformsh/cli

go 1.23.0

toolchain go1.24.2
go 1.25

require (
github.com/Masterminds/semver/v3 v3.3.1
github.com/Masterminds/semver/v3 v3.4.0
github.com/fatih/color v1.18.0
github.com/go-chi/chi/v5 v5.2.1
github.com/go-playground/validator/v10 v10.26.0
github.com/go-chi/chi/v5 v5.2.3
github.com/go-playground/validator/v10 v10.27.0
github.com/gofrs/flock v0.12.1
github.com/oklog/ulid/v2 v2.1.0
github.com/oklog/ulid/v2 v2.1.1
github.com/platformsh/platformify v0.4.1
github.com/spf13/cobra v1.9.1
github.com/spf13/viper v1.20.1
github.com/stretchr/testify v1.10.0
github.com/spf13/cobra v1.10.1
github.com/spf13/viper v1.21.0
github.com/stretchr/testify v1.11.1
github.com/symfony-cli/terminal v1.0.7
github.com/wk8/go-ordered-map/v2 v2.1.8
golang.org/x/crypto v0.39.0
golang.org/x/oauth2 v0.30.0
golang.org/x/sync v0.15.0
golang.org/x/crypto v0.42.0
golang.org/x/oauth2 v0.31.0
golang.org/x/sync v0.17.0
gopkg.in/yaml.v3 v3.0.1
)

Expand All @@ -32,10 +30,10 @@ require (
github.com/buger/jsonparser v1.1.1 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/fsnotify/fsnotify v1.9.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.8 // indirect
github.com/gabriel-vasile/mimetype v1.4.10 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-viper/mapstructure/v2 v2.2.1 // indirect
github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/huandu/xstrings v1.5.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
Expand All @@ -51,19 +49,18 @@ require (
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/rs/zerolog v1.34.0 // indirect
github.com/sagikazarmark/locafero v0.9.0 // indirect
github.com/sagikazarmark/locafero v0.11.0 // indirect
github.com/shopspring/decimal v1.4.0 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.14.0 // indirect
github.com/spf13/cast v1.7.1 // indirect
github.com/spf13/pflag v1.0.6 // indirect
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 // indirect
github.com/spf13/afero v1.15.0 // indirect
github.com/spf13/cast v1.10.0 // indirect
github.com/spf13/pflag v1.0.10 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/net v0.39.0 // indirect
golang.org/x/sys v0.33.0 // indirect
golang.org/x/term v0.32.0 // indirect
golang.org/x/text v0.26.0 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/sys v0.36.0 // indirect
golang.org/x/term v0.35.0 // indirect
golang.org/x/text v0.29.0 // indirect
)
Loading