Skip to content

Commit

Permalink
[#147]: release: v2024.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rustatian authored Apr 11, 2024
2 parents da4f143 + 18d0f93 commit 051ce13
Show file tree
Hide file tree
Showing 22 changed files with 238 additions and 97 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ jobs:
- name: Run linter
uses: golangci/golangci-lint-action@v4.0.0 # Action page: <https://github.com/golangci/golangci-lint-action>
with:
version: v1.54 # without patch version
version: v1.57 # without patch version
only-new-issues: false # show only new issues if it's a pull request
args: --timeout=10m --build-tags=race
2 changes: 1 addition & 1 deletion .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,5 @@ jobs:
TIME: ${{ secrets.TIME }}
run: |
go install github.com/roadrunner-server/velox/cmd/vx@latest
vx build -c velox_rr_v2023.toml -o="."
vx build -c velox_rr_v2024.toml -o="."
./rr --version
11 changes: 8 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ jobs:
CGO_ENABLED: 0
LDFLAGS: >-
-s
-X github.com/roadrunner-server/velox/internal/version.version=${{ steps.values.outputs.version }}
-X github.com/roadrunner-server/velox/internal/version.buildTime=${{ steps.values.outputs.timestamp }}
-X github.com/roadrunner-server/velox/v2024/internal/version.version=${{ steps.values.outputs.version }}
-X github.com/roadrunner-server/velox/v2024/internal/version.buildTime=${{ steps.values.outputs.timestamp }}
run: |
go build -trimpath -ldflags "$LDFLAGS" -o "./${{ steps.values.outputs.binary-name }}" ./cmd/vx
stat "./${{ steps.values.outputs.binary-name }}"
Expand Down Expand Up @@ -92,7 +92,7 @@ jobs:
- name: Create distributive
run: |
mkdir ${{ steps.dist-dir.outputs.name }}
rm velox.toml && mv velox_rr_v2023.toml velox.toml
rm velox.toml && mv velox_rr_v2024.toml velox.toml
mv "./${{ steps.values.outputs.binary-name }}" ./${{ steps.dist-dir.outputs.name }}/
cp ./README.md ./LICENSE ./velox.toml ./${{ steps.dist-dir.outputs.name }}/
Expand Down Expand Up @@ -165,5 +165,10 @@ jobs:
tags: |
spiralscout/velox:latest
spiralscout/velox:${{ steps.values.outputs.version }}
spiralscout/velox:2024.1
spiralscout/velox:2024
ghcr.io/roadrunner-server/velox:latest
ghcr.io/roadrunner-server/velox:${{ steps.values.outputs.version }}
ghcr.io/roadrunner-server/velox:2024.1
ghcr.io/roadrunner-server/velox:2024
14 changes: 3 additions & 11 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,11 @@
run:
go: '1.17'
timeout: 1m
skip-dirs:
- .github
- .git
allow-parallel-runners: true

output:
format: colored-line-number # colored-line-number|line-number|json|tab|checkstyle|code-climate

linters-settings:
wsl:
allow-assign-and-anything: true
govet:
check-shadowing: true
golint:
min-confidence: 0.1
godot:
scope: declarations
capital: true
Expand All @@ -35,7 +25,6 @@ linters-settings:
range-loops: true
for-loops: true
nolintlint:
allow-leading-space: false
require-specific: true

linters: # All available linters list: <https://golangci-lint.run/usage/linters/>
Expand Down Expand Up @@ -76,6 +65,9 @@ linters: # All available linters list: <https://golangci-lint.run/usage/linters/
- whitespace # Tool for detection of leading and trailing whitespace

issues:
exclude-dirs:
- .github
- .git
exclude-rules:
- path: _test\.go
linters:
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ WORKDIR /src

# arguments to pass on each go tool link invocation
ENV LDFLAGS="-s \
-X github.com/roadrunner-server/velox/internal/version.version=$APP_VERSION \
-X github.com/roadrunner-server/velox/internal/version.buildTime=$BUILD_TIME"
-X github.com/roadrunner-server/velox/v2024/internal/version.version=$APP_VERSION \
-X github.com/roadrunner-server/velox/v2024/internal/version.buildTime=$BUILD_TIME"

# verbose
RUN set -x
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
1. ⚠️ Do not use the plugin's `master` branch.
2. ⚠️ Use tags with the **same** **major** version (e.g `logger` v3.0.3 + `amqp` v3.0.5, but not `logger` v4.0.0 + `amqp` v3.0.5)
3. ⚠️ **Currently supported plugins version is: `v4.x.x`**
4. ⚠️ **Currently supported RR version is: `>=v2023.x.x`**
4. ⚠️ **Currently supported RR version is: `>=v2024.x.x`**

# Docs: [link](https://docs.roadrunner.dev/customization/build)
16 changes: 13 additions & 3 deletions builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (
"syscall"

"github.com/hashicorp/go-version"
"github.com/roadrunner-server/velox"
"github.com/roadrunner-server/velox/builder/templates"
"github.com/roadrunner-server/velox/v2024"
"github.com/roadrunner-server/velox/v2024/builder/templates"
"go.uber.org/zap"
)

Expand Down Expand Up @@ -75,6 +75,11 @@ func (b *Builder) Build(rrModule string) error { //nolint:gocyclo

// compatibility with version 2
switch t.ModuleVersion {
case velox.V2024:
err = templates.CompileTemplateV2024(buf, t)
if err != nil {
return err
}
case velox.V2023:
err = templates.CompileTemplateV2023(buf, t)
if err != nil {
Expand Down Expand Up @@ -133,6 +138,11 @@ func (b *Builder) Build(rrModule string) error { //nolint:gocyclo

// compatibility with version 2
switch t.ModuleVersion {
case velox.V2024:
err = templates.CompileGoModTemplate2024(buf, t)
if err != nil {
return err
}
case velox.V2023:
err = templates.CompileGoModTemplate2023(buf, t)
if err != nil {
Expand Down Expand Up @@ -200,7 +210,7 @@ func (b *Builder) Write(d []byte) (int, error) {
func validateModule(module string) (string, error) {
if module == "master" {
// default branch
return velox.V2023, nil
return velox.V2024, nil
}

v, err := version.NewVersion(module)
Expand Down
2 changes: 1 addition & 1 deletion builder/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"path"
"testing"

"github.com/roadrunner-server/velox"
"github.com/roadrunner-server/velox/v2024"
"go.uber.org/zap"
)

Expand Down
2 changes: 1 addition & 1 deletion builder/template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"bytes"
"testing"

"github.com/roadrunner-server/velox/builder/templates"
"github.com/roadrunner-server/velox/v2024/builder/templates"
"github.com/stretchr/testify/require"
)

Expand Down
28 changes: 28 additions & 0 deletions builder/templates/entry.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,31 @@ func CompileGoModTemplate2023(buf *bytes.Buffer, data *Template) error {

return nil
}

func CompileTemplateV2024(buf *bytes.Buffer, data *Template) error {
tmplt, err := template.New("plugins.go").Parse(PluginsTemplateV2024)
if err != nil {
return err
}

err = tmplt.Execute(buf, data)
if err != nil {
return err
}

return nil
}

func CompileGoModTemplate2024(buf *bytes.Buffer, data *Template) error {
tmplt, err := template.New("go.mod").Parse(GoModTemplateV2024)
if err != nil {
return err
}

err = tmplt.Execute(buf, data)
if err != nil {
return err
}

return nil
}
65 changes: 65 additions & 0 deletions builder/templates/templateV2024.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
package templates

const GoModTemplateV2024 string = `
module github.com/roadrunner-server/roadrunner/{{.ModuleVersion}}
go 1.21
toolchain go1.21.5
require (
github.com/buger/goterm v1.0.4
github.com/dustin/go-humanize v1.0.1
github.com/joho/godotenv v1.5.1
github.com/olekukonko/tablewriter v0.0.5
github.com/spf13/cobra v1.8.0
github.com/spf13/viper v1.18.2
github.com/stretchr/testify v1.8.2
go.uber.org/automaxprocs v1.5.2
github.com/roadrunner-server/informer/v4 latest
github.com/roadrunner-server/resetter/v4 latest
github.com/roadrunner-server/config/v4 latest
// Go module pseudo-version
{{range $v := .Entries}}{{$v.Module}} {{$v.PseudoVersion}}
{{end}}
)
exclude (
github.com/spf13/viper v1.18.0
github.com/spf13/viper v1.18.1
github.com/uber-go/tally/v4 v4.1.11
github.com/uber-go/tally/v4 v4.1.12
go.temporal.io/api v1.26.1
)
replace (
{{range $v := .Entries}}{{if (ne $v.Replace "")}}{{$v.Module}} => {{$v.Replace}}
{{end}}{{end}}
)
`

const PluginsTemplateV2024 string = `
package container
import (
"github.com/roadrunner-server/informer/v4"
"github.com/roadrunner-server/resetter/v4"
{{range $v := .Entries}}{{$v.Prefix}} "{{$v.Module}}"
{{end}}
)
func Plugins() []any {
return []any {
// bundled
// informer plugin (./rr workers, ./rr workers -i)
&informer.Plugin{},
// resetter plugin (./rr reset)
&resetter.Plugin{},
// std and custom plugins
{{range $v := .Entries}}&{{$v.Prefix}}.{{$v.Structure}},
{{end}}
}
}
`
2 changes: 1 addition & 1 deletion cmd/vx/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"path/filepath"

"github.com/fatih/color"
"github.com/roadrunner-server/velox/internal/cli"
"github.com/roadrunner-server/velox/v2024/internal/cli"
)

func main() {
Expand Down
1 change: 1 addition & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
const (
ref string = "ref"
defaultBranch string = "master"
V2024 string = "v2024"
V2023 string = "v2023"
V2 string = "v2"
gitlabBaseURL string = "https://gitlab.com"
Expand Down
2 changes: 1 addition & 1 deletion github/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"testing"
"time"

"github.com/roadrunner-server/velox"
"github.com/roadrunner-server/velox/v2024"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
Expand Down
4 changes: 2 additions & 2 deletions github/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"sync"
"time"

"github.com/google/go-github/v53/github"
"github.com/roadrunner-server/velox"
"github.com/google/go-github/v61/github"
"github.com/roadrunner-server/velox/v2024"
"go.uber.org/zap"
)

Expand Down
6 changes: 3 additions & 3 deletions github/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (
"path/filepath"
"strings"

"github.com/google/go-github/v53/github"
"github.com/roadrunner-server/velox"
"github.com/google/go-github/v61/github"
"github.com/roadrunner-server/velox/v2024"
"go.uber.org/zap"
"golang.org/x/oauth2"
)
Expand Down Expand Up @@ -54,7 +54,7 @@ func NewGHRepoInfo(cfg *velox.Config, log *zap.Logger) *GHRepo {
// DownloadTemplate downloads template repository ->
func (r *GHRepo) DownloadTemplate(tmp, version string) (string, error) { //nolint:gocyclo
r.log.Info("[GET ARCHIVE LINK]", zap.String("owner", rrOwner), zap.String("repository", rrRepo), zap.String("encoding", "zip"), zap.String("ref", version))
url, resp, err := r.client.Repositories.GetArchiveLink(context.Background(), rrOwner, rrRepo, github.Zipball, &github.RepositoryContentGetOptions{Ref: version}, true)
url, resp, err := r.client.Repositories.GetArchiveLink(context.Background(), rrOwner, rrRepo, github.Zipball, &github.RepositoryContentGetOptions{Ref: version}, 10)
if err != nil {
return "", err
}
Expand Down
2 changes: 1 addition & 1 deletion gitlab/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"strings"
"time"

"github.com/roadrunner-server/velox"
"github.com/roadrunner-server/velox/v2024"
"github.com/xanzy/go-gitlab"
"go.uber.org/zap"
)
Expand Down
7 changes: 2 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module github.com/roadrunner-server/velox
module github.com/roadrunner-server/velox/v2024

go 1.22.2

require (
github.com/fatih/color v1.16.0
github.com/google/go-github/v53 v53.2.0
github.com/google/go-github/v61 v61.0.0
github.com/hashicorp/go-version v1.6.0
github.com/pkg/errors v0.9.1
github.com/spf13/cobra v1.8.0
Expand All @@ -17,8 +17,6 @@ require (
)

require (
github.com/ProtonMail/go-crypto v1.0.0 // indirect
github.com/cloudflare/circl v1.3.7 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/google/go-querystring v1.1.0 // indirect
Expand All @@ -40,7 +38,6 @@ require (
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.22.0 // indirect
golang.org/x/exp v0.0.0-20240409090435-93d18d7e34b8 // indirect
golang.org/x/sys v0.19.0 // indirect
golang.org/x/text v0.14.0 // indirect
Expand Down
Loading

0 comments on commit 051ce13

Please sign in to comment.