From a1a3ab388a1437c50a8cc15bc45219ad83bd6a06 Mon Sep 17 00:00:00 2001 From: Christian Gregg Date: Fri, 5 Apr 2024 12:22:53 +0100 Subject: [PATCH] Relax `Procfile` processes definition regex It's okay from processes to include `-` + `_` characters. --- .github/workflows/acceptance.yml | 1 + .github/workflows/build.yml | 2 +- processfile/procfile.go | 2 +- processfile/procfile_test.go | 12 +++++++----- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/acceptance.yml b/.github/workflows/acceptance.yml index 7fbabc4c..3687b2d1 100644 --- a/.github/workflows/acceptance.yml +++ b/.github/workflows/acceptance.yml @@ -14,6 +14,7 @@ jobs: test: if: ${{ github.event_name == 'push' || github.event.label.name == 'run-acceptance-tests' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }} name: Acceptance + container: heroku/heroku:20-build runs-on: ubuntu-latest env: SLUGCMPLR_ACC: "true" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4cd8441b..38da3480 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,5 +29,5 @@ jobs: - uses: actions/checkout@v3 - uses: golangci/golangci-lint-action@v3.4.0 with: - version: v1.50 + version: v1.57 diff --git a/processfile/procfile.go b/processfile/procfile.go index 5a6ceb1f..2d62977a 100644 --- a/processfile/procfile.go +++ b/processfile/procfile.go @@ -10,7 +10,7 @@ import ( // Procfile contains the definition of a Procfile. type Procfile map[string]string -var regex = regexp.MustCompile(`^(?P[a-zA-Z0-9]+): (?P.*)$`) +var regex = regexp.MustCompile(`^(?P[a-zA-Z0-9_-]+): (?P.*)$`) // New creates a new Procfile in-memory. func New() Procfile { diff --git a/processfile/procfile_test.go b/processfile/procfile_test.go index bd6ed462..7cefa94f 100644 --- a/processfile/procfile_test.go +++ b/processfile/procfile_test.go @@ -86,19 +86,21 @@ func Test_Read(t *testing.T) { valid := `web: bin/server worker: bundle exec sidekiq -c config/sidekiq.yml -cron: bin/scheduler` +cron: bin/scheduler +my_process: echo "hello"` procf, err := processfile.Read(strings.NewReader(valid)) if err != nil { t.Fatalf("unexpected error when reading procfile: %v", err) } - Contain(t, []string{"web", "worker", "cron"}, procf.Processes()) + Contain(t, []string{"web", "worker", "cron", "my_process"}, procf.Processes()) expected := map[string]string{ - "web": "bin/server", - "worker": "bundle exec sidekiq -c config/sidekiq.yml", - "cron": "bin/scheduler", + "web": "bin/server", + "worker": "bundle exec sidekiq -c config/sidekiq.yml", + "cron": "bin/scheduler", + "my_process": `echo "hello"`, } for proc, cmd := range expected {