From f98499f6fc6ad767a7d9e490e46c62cde6fc52e5 Mon Sep 17 00:00:00 2001 From: Ammar Bandukwala Date: Sat, 23 Jul 2022 21:46:38 +0000 Subject: [PATCH 01/37] ci: add skip directives for long tests --- .github/workflows/coder.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/coder.yaml b/.github/workflows/coder.yaml index 822545a285bb3..b92a91fb112ba 100644 --- a/.github/workflows/coder.yaml +++ b/.github/workflows/coder.yaml @@ -68,6 +68,14 @@ jobs: run: | echo "${{ toJSON(needs.changes) }}" + pr-context: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Dump GitHub Context + run: | + echo github context '${{ toJSON(github) }}' + style-lint-golangci: name: style/lint/golangci timeout-minutes: 5 From 32618bd3d3646585b8cb9e70485f55196fcb5ee8 Mon Sep 17 00:00:00 2001 From: Ammar Bandukwala Date: Sat, 23 Jul 2022 22:02:34 +0000 Subject: [PATCH 02/37] ci: add prcontext --- .github/workflows/coder.yaml | 4 +++- .github/workflows/prcontext/README.md | 4 ++++ .github/workflows/prcontext/main.go | 27 +++++++++++++++++++++++++++ go.mod | 5 ++++- go.sum | 2 ++ 5 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/prcontext/README.md create mode 100644 .github/workflows/prcontext/main.go diff --git a/.github/workflows/coder.yaml b/.github/workflows/coder.yaml index b92a91fb112ba..c50f9de249efd 100644 --- a/.github/workflows/coder.yaml +++ b/.github/workflows/coder.yaml @@ -74,7 +74,9 @@ jobs: - uses: actions/checkout@v3 - name: Dump GitHub Context run: | - echo github context '${{ toJSON(github) }}' + go install github.com/coder/coder/.github/workflows/prcontext + pushd; .github/workflows/prcontext; go build -o /usr/bin/prcontext + '${{ toJSON(github) }}' > go run .github/workflows style-lint-golangci: name: style/lint/golangci diff --git a/.github/workflows/prcontext/README.md b/.github/workflows/prcontext/README.md new file mode 100644 index 0000000000000..c679c3446a7da --- /dev/null +++ b/.github/workflows/prcontext/README.md @@ -0,0 +1,4 @@ +# prcontext + +`prcontext` is a simple Go program that extracts CI directives from PRs for a +more efficient merge cycle. diff --git a/.github/workflows/prcontext/main.go b/.github/workflows/prcontext/main.go new file mode 100644 index 0000000000000..4ab2405bf2627 --- /dev/null +++ b/.github/workflows/prcontext/main.go @@ -0,0 +1,27 @@ +package main + +import ( + "encoding/json" + "os" + + "github.com/coder/flog" +) + +// githubContext is structured as documented here: +// https://docs.github.com/en/actions/learn-github-actions/contexts#github-context. +type githubContext struct { + EventName string `json:"event_name"` + Event struct { + PullRequest struct { + Body string `json:"body"` + } + } `json:"event"` +} + +func main() { + var c githubContext + err := json.NewDecoder(os.Stdin).Decode(&c) + if err != nil { + flog.Fatal("decode stdin: %+v", err) + } +} diff --git a/go.mod b/go.mod index c33a634b4d002..b5ae58b368414 100644 --- a/go.mod +++ b/go.mod @@ -135,7 +135,10 @@ require ( tailscale.com v1.26.2 ) -require github.com/googleapis/enterprise-certificate-proxy v0.1.0 // indirect +require ( + github.com/coder/flog v1.0.0 // indirect + github.com/googleapis/enterprise-certificate-proxy v0.1.0 // indirect +) require ( github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect diff --git a/go.sum b/go.sum index a686a4fd703ae..4e6a248e14e48 100644 --- a/go.sum +++ b/go.sum @@ -344,6 +344,8 @@ github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:z github.com/cockroachdb/datadriven v0.0.0-20200714090401-bf6692d28da5/go.mod h1:h6jFvWxBdQXxjopDMZyH2UVceIRfR84bdzbkoKrsWNo= github.com/cockroachdb/errors v1.2.4/go.mod h1:rQD95gz6FARkaKkQXUksEje/d9a6wBJoCr5oaCLELYA= github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f/go.mod h1:i/u985jwjWRlyHXQbwatDASoW0RMlZ/3i9yJHE2xLkI= +github.com/coder/flog v1.0.0 h1:gqr4jYDQWYmsvFD0RV6Vs+SAj1Kbn0HGlV7UghfxP+8= +github.com/coder/flog v1.0.0/go.mod h1:UQlQvrkJBvnRGo69Le8E24Tcl5SJleAAR7gYEHzAmdQ= github.com/coder/glog v1.0.1-0.20220322161911-7365fe7f2cd1 h1:UqBrPWSYvRI2s5RtOul20JukUEpu4ip9u7biBL+ntgk= github.com/coder/glog v1.0.1-0.20220322161911-7365fe7f2cd1/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= github.com/coder/retry v1.3.0 h1:5lAAwt/2Cm6lVmnfBY7sOMXcBOwcwJhmV5QGSELIVWY= From fe41fb3a5542307f7bb47dd4be336fd531359cfe Mon Sep 17 00:00:00 2001 From: Ammar Bandukwala Date: Sat, 23 Jul 2022 22:03:17 +0000 Subject: [PATCH 03/37] fixup! ci: add prcontext --- .github/workflows/coder.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/coder.yaml b/.github/workflows/coder.yaml index c50f9de249efd..e609fd9391e90 100644 --- a/.github/workflows/coder.yaml +++ b/.github/workflows/coder.yaml @@ -75,8 +75,7 @@ jobs: - name: Dump GitHub Context run: | go install github.com/coder/coder/.github/workflows/prcontext - pushd; .github/workflows/prcontext; go build -o /usr/bin/prcontext - '${{ toJSON(github) }}' > go run .github/workflows + echo '${{ toJSON(github) }}' | prcontext style-lint-golangci: name: style/lint/golangci From c37a58deb6666475530b670ffed9f380ddc98d7f Mon Sep 17 00:00:00 2001 From: Ammar Bandukwala Date: Sat, 23 Jul 2022 22:03:45 +0000 Subject: [PATCH 04/37] fixup! ci: add prcontext --- .github/workflows/coder.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/coder.yaml b/.github/workflows/coder.yaml index e609fd9391e90..fb525b9fd0268 100644 --- a/.github/workflows/coder.yaml +++ b/.github/workflows/coder.yaml @@ -72,6 +72,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + - uses: actions/setup-go@v3 + with: + go-version: "~1.18" - name: Dump GitHub Context run: | go install github.com/coder/coder/.github/workflows/prcontext From 2bdf01692e1fec6a360b72a21ffdb69e0aad539f Mon Sep 17 00:00:00 2001 From: Ammar Bandukwala Date: Sat, 23 Jul 2022 22:11:04 +0000 Subject: [PATCH 05/37] fixup! ci: add prcontext --- .github/workflows/coder.yaml | 5 +++-- .github/workflows/prcontext/main.go | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/coder.yaml b/.github/workflows/coder.yaml index fb525b9fd0268..777ad778d4ef5 100644 --- a/.github/workflows/coder.yaml +++ b/.github/workflows/coder.yaml @@ -76,9 +76,10 @@ jobs: with: go-version: "~1.18" - name: Dump GitHub Context + env: + GITHUB_CONTEXT: ${{ toJSON(github) }} run: | - go install github.com/coder/coder/.github/workflows/prcontext - echo '${{ toJSON(github) }}' | prcontext + go run github.com/coder/coder/.github/workflows/prcontext style-lint-golangci: name: style/lint/golangci diff --git a/.github/workflows/prcontext/main.go b/.github/workflows/prcontext/main.go index 4ab2405bf2627..6c7d949f9a97b 100644 --- a/.github/workflows/prcontext/main.go +++ b/.github/workflows/prcontext/main.go @@ -20,7 +20,7 @@ type githubContext struct { func main() { var c githubContext - err := json.NewDecoder(os.Stdin).Decode(&c) + err := json.Unmarshal([]byte(os.Getenv("GITHUB_CONTEXT")), &c) if err != nil { flog.Fatal("decode stdin: %+v", err) } From d58657b67cdd30e9cd8bae14d468cee4bed6cc4b Mon Sep 17 00:00:00 2001 From: Ammar Bandukwala Date: Sat, 23 Jul 2022 22:13:22 +0000 Subject: [PATCH 06/37] fixup! ci: add prcontext --- .github/workflows/prcontext/main.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/prcontext/main.go b/.github/workflows/prcontext/main.go index 6c7d949f9a97b..09c403dd9cf50 100644 --- a/.github/workflows/prcontext/main.go +++ b/.github/workflows/prcontext/main.go @@ -24,4 +24,9 @@ func main() { if err != nil { flog.Fatal("decode stdin: %+v", err) } + flog.Info("detected event %q", c.EventName) + if c.EventName != "pull_request" { + flog.Info("aborting since not Pull Request") + return + } } From 1b9fdc11a07839b559ad45d73a168bd64550baf9 Mon Sep 17 00:00:00 2001 From: Ammar Bandukwala Date: Sat, 23 Jul 2022 23:17:39 +0000 Subject: [PATCH 07/37] fixup! ci: add prcontext --- .github/workflows/coder.yaml | 4 ++- .github/workflows/prcontext/main.go | 4 +++ .github/workflows/prcontext/parse.go | 30 ++++++++++++++++++ .github/workflows/prcontext/parse_test.go | 37 +++++++++++++++++++++++ 4 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/prcontext/parse.go create mode 100644 .github/workflows/prcontext/parse_test.go diff --git a/.github/workflows/coder.yaml b/.github/workflows/coder.yaml index 777ad778d4ef5..c56a75a0d5515 100644 --- a/.github/workflows/coder.yaml +++ b/.github/workflows/coder.yaml @@ -70,12 +70,14 @@ jobs: pr-context: runs-on: ubuntu-latest + outputs: + skips: ${{ steps.prcontext.skips }} steps: - uses: actions/checkout@v3 - uses: actions/setup-go@v3 with: go-version: "~1.18" - - name: Dump GitHub Context + - id: prcontext env: GITHUB_CONTEXT: ${{ toJSON(github) }} run: | diff --git a/.github/workflows/prcontext/main.go b/.github/workflows/prcontext/main.go index 09c403dd9cf50..cd14681544186 100644 --- a/.github/workflows/prcontext/main.go +++ b/.github/workflows/prcontext/main.go @@ -2,7 +2,9 @@ package main import ( "encoding/json" + "fmt" "os" + "strings" "github.com/coder/flog" ) @@ -29,4 +31,6 @@ func main() { flog.Info("aborting since not Pull Request") return } + skips := parseBody(c.Event.PullRequest.Body) + _, _ = fmt.Printf("::set-output name=skips::[%s]\n", strings.Join(skips, " ")) } diff --git a/.github/workflows/prcontext/parse.go b/.github/workflows/prcontext/parse.go new file mode 100644 index 0000000000000..ccff76fdf68ef --- /dev/null +++ b/.github/workflows/prcontext/parse.go @@ -0,0 +1,30 @@ +package main + +import ( + "regexp" + "strings" + + "github.com/coder/flog" +) + +const ciSkipPrefix = "ci-skip" + +var skipDirective = regexp.MustCompile(`\[` + ciSkipPrefix + ` ([\w\/ ]+)]`) + +func parseBody(body string) (skips []string) { + matches := skipDirective.FindAllStringSubmatch(body, -1) + flog.Info("matches: %+v", matches) + + var skipMatches []string + for i := range matches { + for j := range matches[i] { + v := matches[i][j] + flog.Info("%q", v) + if !strings.Contains(v, ciSkipPrefix) { + skipMatches = append(skipMatches, strings.Split(v, " ")...) + } + } + } + + return skipMatches +} diff --git a/.github/workflows/prcontext/parse_test.go b/.github/workflows/prcontext/parse_test.go new file mode 100644 index 0000000000000..ccc4a6c40e596 --- /dev/null +++ b/.github/workflows/prcontext/parse_test.go @@ -0,0 +1,37 @@ +package main + +import ( + "reflect" + "testing" +) + +func Test_parseBody_basic(t *testing.T) { + parseBody(` +This is a test PR. + +[ci-skip postgres windows] + `) +} + +func Test_parseBody(t *testing.T) { + type args struct { + body string + } + tests := []struct { + name string + args args + wantSkips []string + }{ + {"no directive", args{"test pr 123\n\n"}, nil}, + {"single dir single skip", args{"test pr [ci-skip dog] 123\n\n"}, []string{"dog"}}, + {"double dir double skip", args{"test pr [ci-skip dog] [ci-skip cat] 123\n\n"}, []string{"dog", "cat"}}, + {"single dir double skip", args{"test pr [ci-skip dog cat] 123\n\n"}, []string{"dog", "cat"}}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if gotSkips := parseBody(tt.args.body); !reflect.DeepEqual(gotSkips, tt.wantSkips) { + t.Errorf("parseBody() = %v, want %v", gotSkips, tt.wantSkips) + } + }) + } +} From 93dcb824d5af847b836b3439aadcfc2dd41f38f4 Mon Sep 17 00:00:00 2001 From: Ammar Bandukwala Date: Sat, 23 Jul 2022 23:19:25 +0000 Subject: [PATCH 08/37] fixup! ci: add prcontext --- .github/workflows/prcontext/main.go | 1 + .github/workflows/prcontext/parse.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/prcontext/main.go b/.github/workflows/prcontext/main.go index cd14681544186..1f32d818f5d14 100644 --- a/.github/workflows/prcontext/main.go +++ b/.github/workflows/prcontext/main.go @@ -31,6 +31,7 @@ func main() { flog.Info("aborting since not Pull Request") return } + _, _, = fmt.Printf("---\n%s\n---\n", c.Event.PullRequest.Body) skips := parseBody(c.Event.PullRequest.Body) _, _ = fmt.Printf("::set-output name=skips::[%s]\n", strings.Join(skips, " ")) } diff --git a/.github/workflows/prcontext/parse.go b/.github/workflows/prcontext/parse.go index ccff76fdf68ef..5e2ac09251eca 100644 --- a/.github/workflows/prcontext/parse.go +++ b/.github/workflows/prcontext/parse.go @@ -13,7 +13,7 @@ var skipDirective = regexp.MustCompile(`\[` + ciSkipPrefix + ` ([\w\/ ]+)]`) func parseBody(body string) (skips []string) { matches := skipDirective.FindAllStringSubmatch(body, -1) - flog.Info("matches: %+v", matches) + // flog.Info("matches: %+v", matches) var skipMatches []string for i := range matches { From 73e073f4378a69a3f92e7d6399d1976a38955a8c Mon Sep 17 00:00:00 2001 From: Ammar Bandukwala Date: Sat, 23 Jul 2022 23:21:00 +0000 Subject: [PATCH 09/37] fixup! ci: add prcontext --- .github/workflows/prcontext/main.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/prcontext/main.go b/.github/workflows/prcontext/main.go index 1f32d818f5d14..085d710cd3138 100644 --- a/.github/workflows/prcontext/main.go +++ b/.github/workflows/prcontext/main.go @@ -31,7 +31,9 @@ func main() { flog.Info("aborting since not Pull Request") return } - _, _, = fmt.Printf("---\n%s\n---\n", c.Event.PullRequest.Body) + + _, _ = fmt.Printf("---\n%s\n---\n", c.Event.PullRequest.Body) + skips := parseBody(c.Event.PullRequest.Body) _, _ = fmt.Printf("::set-output name=skips::[%s]\n", strings.Join(skips, " ")) } From a38e3ebb080774a4646ae4cb0dd6f6734f14f9f3 Mon Sep 17 00:00:00 2001 From: Ammar Bandukwala Date: Sat, 23 Jul 2022 23:22:42 +0000 Subject: [PATCH 10/37] fixup! ci: add prcontext --- .github/workflows/prcontext/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/prcontext/main.go b/.github/workflows/prcontext/main.go index 085d710cd3138..f0856c4822e9f 100644 --- a/.github/workflows/prcontext/main.go +++ b/.github/workflows/prcontext/main.go @@ -16,7 +16,7 @@ type githubContext struct { Event struct { PullRequest struct { Body string `json:"body"` - } + } `json:"pull_request"` } `json:"event"` } From f2de14a9bb0b314daeb10b83001ac904e13fbc3a Mon Sep 17 00:00:00 2001 From: Ammar Bandukwala Date: Sat, 23 Jul 2022 23:28:41 +0000 Subject: [PATCH 11/37] fixup! ci: add prcontext --- .github/workflows/prcontext/main.go | 4 ++-- .github/workflows/prcontext/parse.go | 4 +--- .github/workflows/prcontext/parse_test.go | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/prcontext/main.go b/.github/workflows/prcontext/main.go index f0856c4822e9f..f9c087c477b44 100644 --- a/.github/workflows/prcontext/main.go +++ b/.github/workflows/prcontext/main.go @@ -32,8 +32,8 @@ func main() { return } - _, _ = fmt.Printf("---\n%s\n---\n", c.Event.PullRequest.Body) + _, _ = fmt.Printf("::group::{PR Body}\n%s\n::endgroup::\n", c.Event.PullRequest.Body) skips := parseBody(c.Event.PullRequest.Body) - _, _ = fmt.Printf("::set-output name=skips::[%s]\n", strings.Join(skips, " ")) + _, _ = fmt.Printf("::echo::on\n::set-output name=skips::[%s]\n", strings.Join(skips, " ")) } diff --git a/.github/workflows/prcontext/parse.go b/.github/workflows/prcontext/parse.go index 5e2ac09251eca..70536b4739026 100644 --- a/.github/workflows/prcontext/parse.go +++ b/.github/workflows/prcontext/parse.go @@ -3,8 +3,6 @@ package main import ( "regexp" "strings" - - "github.com/coder/flog" ) const ciSkipPrefix = "ci-skip" @@ -19,7 +17,7 @@ func parseBody(body string) (skips []string) { for i := range matches { for j := range matches[i] { v := matches[i][j] - flog.Info("%q", v) + // flog.Info("%q", v) if !strings.Contains(v, ciSkipPrefix) { skipMatches = append(skipMatches, strings.Split(v, " ")...) } diff --git a/.github/workflows/prcontext/parse_test.go b/.github/workflows/prcontext/parse_test.go index ccc4a6c40e596..724863ec237ff 100644 --- a/.github/workflows/prcontext/parse_test.go +++ b/.github/workflows/prcontext/parse_test.go @@ -25,7 +25,7 @@ func Test_parseBody(t *testing.T) { {"no directive", args{"test pr 123\n\n"}, nil}, {"single dir single skip", args{"test pr [ci-skip dog] 123\n\n"}, []string{"dog"}}, {"double dir double skip", args{"test pr [ci-skip dog] [ci-skip cat] 123\n\n"}, []string{"dog", "cat"}}, - {"single dir double skip", args{"test pr [ci-skip dog cat] 123\n\n"}, []string{"dog", "cat"}}, + {"single dir double skip", args{"test pr [ci-skip test/go/postgres cat] 123\n\n"}, []string{"test/go/postgres", "cat"}}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { From 8c3dfde8f454039e1eadedd46cd3629d40e49153 Mon Sep 17 00:00:00 2001 From: Ammar Bandukwala Date: Sat, 23 Jul 2022 23:33:26 +0000 Subject: [PATCH 12/37] fixup! ci: add prcontext --- .github/workflows/coder.yaml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/coder.yaml b/.github/workflows/coder.yaml index c56a75a0d5515..9d4a677b796f0 100644 --- a/.github/workflows/coder.yaml +++ b/.github/workflows/coder.yaml @@ -295,8 +295,12 @@ jobs: test-go-postgres: name: "test/go/postgres" - needs: changes - if: needs.changes.outputs.docs-only == 'false' + needs: + - changes + - prcontext + if: > + needs.changes.outputs.docs-only == 'false' && + !contains(needs.prcontext.outputs.skips, github.job) runs-on: ubuntu-latest # This timeout must be greater than the timeout set by `go test` in # `make test-postgres` to ensure we receive a trace of running From 8a1f59790bc18228d3ab8436f529d0b75857c184 Mon Sep 17 00:00:00 2001 From: Ammar Bandukwala Date: Sat, 23 Jul 2022 23:33:59 +0000 Subject: [PATCH 13/37] fixup! ci: add prcontext --- .github/workflows/coder.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/coder.yaml b/.github/workflows/coder.yaml index 9d4a677b796f0..0379c24649e3a 100644 --- a/.github/workflows/coder.yaml +++ b/.github/workflows/coder.yaml @@ -297,7 +297,7 @@ jobs: name: "test/go/postgres" needs: - changes - - prcontext + - pr-context if: > needs.changes.outputs.docs-only == 'false' && !contains(needs.prcontext.outputs.skips, github.job) From 11b0bb9ac6bd88684604904c431dc1c6fc4925bf Mon Sep 17 00:00:00 2001 From: Ammar Bandukwala Date: Sat, 23 Jul 2022 23:40:43 +0000 Subject: [PATCH 14/37] fixup! ci: add prcontext --- .github/workflows/coder.yaml | 1 + .github/workflows/prcontext/README.md | 3 +++ 2 files changed, 4 insertions(+) diff --git a/.github/workflows/coder.yaml b/.github/workflows/coder.yaml index 0379c24649e3a..1b8078c3ab34b 100644 --- a/.github/workflows/coder.yaml +++ b/.github/workflows/coder.yaml @@ -268,6 +268,7 @@ jobs: - name: Test with Mock Database shell: bash run: gotestsum --junitfile="gotests.xml" --packages="./..." -- + -parallel=8 -covermode=atomic -coverprofile="gotests.coverage" -coverpkg=./...,github.com/coder/coder/codersdk -timeout=5m -short -failfast diff --git a/.github/workflows/prcontext/README.md b/.github/workflows/prcontext/README.md index c679c3446a7da..6324641e45be3 100644 --- a/.github/workflows/prcontext/README.md +++ b/.github/workflows/prcontext/README.md @@ -2,3 +2,6 @@ `prcontext` is a simple Go program that extracts CI directives from PRs for a more efficient merge cycle. + +Since skips are only possible within PRs, the full suite will still run on +merge. From 0b9b417a62a9f63816c500b690e5141d075a3c7c Mon Sep 17 00:00:00 2001 From: Ammar Bandukwala Date: Sun, 24 Jul 2022 00:21:39 +0000 Subject: [PATCH 15/37] fixup! ci: add prcontext --- .github/workflows/coder.yaml | 18 +- gotests.xml | 1812 ++++++++++++++++++++++++++++++++++ 2 files changed, 1824 insertions(+), 6 deletions(-) create mode 100644 gotests.xml diff --git a/.github/workflows/coder.yaml b/.github/workflows/coder.yaml index 1b8078c3ab34b..cc2a9327f33c1 100644 --- a/.github/workflows/coder.yaml +++ b/.github/workflows/coder.yaml @@ -266,15 +266,21 @@ jobs: terraform_wrapper: false - name: Test with Mock Database + id: test shell: bash - run: gotestsum --junitfile="gotests.xml" --packages="./..." -- - -parallel=8 - -covermode=atomic -coverprofile="gotests.coverage" + run: | + if [ "${{ matrix.os }}" == "ubuntu-latest" ]; then + echo ::set-output name=cover::true + export COVERAGE_FLAGS=-covermode=atomic -coverprofile="gotests.coverage" -coverpkg=./...,github.com/coder/coder/codersdk - -timeout=5m -short -failfast + elif + echo ::set-output name=cover::false + fi + gotestsum --junitfile="gotests.xml" --packages="./..." -- + -parallel=8 -timeout=5m -short -failfast $COVERAGE_FLAGS - name: Upload DataDog Trace - if: always() && github.actor != 'dependabot[bot]' && !github.event.pull_request.head.repo.fork + if: steps.test.outputs.cover && github.actor != 'dependabot[bot]' && !github.event.pull_request.head.repo.fork env: DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }} DD_DATABASE: fake @@ -288,7 +294,7 @@ jobs: # that is no guarantee, see: # https://github.com/codecov/codecov-action/issues/788 continue-on-error: true - if: github.actor != 'dependabot[bot]' && !github.event.pull_request.head.repo.fork + if: steps.test.outputs.cover && github.actor != 'dependabot[bot]' && !github.event.pull_request.head.repo.fork with: token: ${{ secrets.CODECOV_TOKEN }} files: ./gotests.coverage diff --git a/gotests.xml b/gotests.xml new file mode 100644 index 0000000000000..e25e5e46463ab --- /dev/null +++ b/gotests.xml @@ -0,0 +1,1812 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From ff15370c46b04510dc60434dd26cd21e65fae97b Mon Sep 17 00:00:00 2001 From: Ammar Bandukwala Date: Sun, 24 Jul 2022 00:23:14 +0000 Subject: [PATCH 16/37] fixup! ci: add prcontext --- .github/workflows/coder.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/coder.yaml b/.github/workflows/coder.yaml index cc2a9327f33c1..7793ddf9230c1 100644 --- a/.github/workflows/coder.yaml +++ b/.github/workflows/coder.yaml @@ -269,10 +269,12 @@ jobs: id: test shell: bash run: | + # Code coverage is more computationally expensive and also + # prevents test caching, so we disable it on alternate operating + # systems. if [ "${{ matrix.os }}" == "ubuntu-latest" ]; then echo ::set-output name=cover::true - export COVERAGE_FLAGS=-covermode=atomic -coverprofile="gotests.coverage" - -coverpkg=./...,github.com/coder/coder/codersdk + export COVERAGE_FLAGS=-covermode=atomic -coverprofile="gotests.coverage" -coverpkg=./...,github.com/coder/coder/codersdk elif echo ::set-output name=cover::false fi From d6a2f7b166f69df765a919eb990d2117f5fd9bce Mon Sep 17 00:00:00 2001 From: Ammar Bandukwala Date: Sun, 24 Jul 2022 00:27:16 +0000 Subject: [PATCH 17/37] fixup! ci: add prcontext --- .github/workflows/coder.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/coder.yaml b/.github/workflows/coder.yaml index 7793ddf9230c1..89db9fec2f0cc 100644 --- a/.github/workflows/coder.yaml +++ b/.github/workflows/coder.yaml @@ -274,15 +274,15 @@ jobs: # systems. if [ "${{ matrix.os }}" == "ubuntu-latest" ]; then echo ::set-output name=cover::true - export COVERAGE_FLAGS=-covermode=atomic -coverprofile="gotests.coverage" -coverpkg=./...,github.com/coder/coder/codersdk - elif + export COVERAGE_FLAGS='-covermode=atomic -coverprofile="gotests.coverage" -coverpkg=./...,github.com/coder/coder/codersdk' + else echo ::set-output name=cover::false fi gotestsum --junitfile="gotests.xml" --packages="./..." -- -parallel=8 -timeout=5m -short -failfast $COVERAGE_FLAGS - name: Upload DataDog Trace - if: steps.test.outputs.cover && github.actor != 'dependabot[bot]' && !github.event.pull_request.head.repo.fork + if: github.actor != 'dependabot[bot]' && !github.event.pull_request.head.repo.fork env: DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }} DD_DATABASE: fake From 9a379a5c92af9a750d514c215ab9af81ef7f5967 Mon Sep 17 00:00:00 2001 From: Ammar Bandukwala Date: Sun, 24 Jul 2022 00:31:27 +0000 Subject: [PATCH 18/37] fixup! ci: add prcontext --- .github/workflows/coder.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/coder.yaml b/.github/workflows/coder.yaml index 89db9fec2f0cc..6f69d5e777ed9 100644 --- a/.github/workflows/coder.yaml +++ b/.github/workflows/coder.yaml @@ -278,8 +278,8 @@ jobs: else echo ::set-output name=cover::false fi - gotestsum --junitfile="gotests.xml" --packages="./..." -- - -parallel=8 -timeout=5m -short -failfast $COVERAGE_FLAGS + set -x + gotestsum --junitfile="gotests.xml" --packages="./..." -- -parallel=8 -timeout=5m -short -failfast $COVERAGE_FLAGS - name: Upload DataDog Trace if: github.actor != 'dependabot[bot]' && !github.event.pull_request.head.repo.fork From 31d4390333d3dd4c7e9e3eeeb7f5cafd02de97d6 Mon Sep 17 00:00:00 2001 From: Ammar Bandukwala Date: Sun, 24 Jul 2022 00:43:13 +0000 Subject: [PATCH 19/37] Optimize style/gen with go cache --- .github/workflows/coder.yaml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.github/workflows/coder.yaml b/.github/workflows/coder.yaml index 6f69d5e777ed9..d45fe9874c571 100644 --- a/.github/workflows/coder.yaml +++ b/.github/workflows/coder.yaml @@ -172,6 +172,25 @@ jobs: - uses: actions/setup-go@v3 with: go-version: "~1.18" + + - name: Echo Go Cache Paths + id: go-cache-paths + run: | + echo "::set-output name=go-build::$(go env GOCACHE)" + echo "::set-output name=go-mod::$(go env GOMODCACHE)" + + - name: Go Build Cache + uses: actions/cache@v3 + with: + path: ${{ steps.go-cache-paths.outputs.go-build }} + key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }} + + - name: Go Mod Cache + uses: actions/cache@v3 + with: + path: ${{ steps.go-cache-paths.outputs.go-mod }} + key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }} + - run: | curl -sSL https://github.com/kyleconroy/sqlc/releases/download/v1.13.0/sqlc_1.13.0_linux_amd64.tar.gz | sudo tar -C /usr/bin -xz sqlc From 9d76dd4b799d76e1261907fbb81597f458d12572 Mon Sep 17 00:00:00 2001 From: Ammar Bandukwala Date: Sun, 24 Jul 2022 00:53:41 +0000 Subject: [PATCH 20/37] fixup! Optimize style/gen with go cache --- .github/workflows/coder.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/coder.yaml b/.github/workflows/coder.yaml index d45fe9874c571..ded872a0d97a6 100644 --- a/.github/workflows/coder.yaml +++ b/.github/workflows/coder.yaml @@ -183,13 +183,13 @@ jobs: uses: actions/cache@v3 with: path: ${{ steps.go-cache-paths.outputs.go-build }} - key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }} + key: ${{ github.job }}-go-build-${{ hashFiles('**/go.sum', '**/**.go') }} - name: Go Mod Cache uses: actions/cache@v3 with: path: ${{ steps.go-cache-paths.outputs.go-mod }} - key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }} + key: ${{ github.job }}-go-mod-${{ hashFiles('**/go.sum') }} - run: | curl -sSL https://github.com/kyleconroy/sqlc/releases/download/v1.13.0/sqlc_1.13.0_linux_amd64.tar.gz | sudo tar -C /usr/bin -xz sqlc @@ -263,7 +263,7 @@ jobs: uses: actions/cache@v3 with: path: ${{ steps.go-cache-paths.outputs.go-build }} - key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }} + key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.**', '**.go') }} - name: Go Mod Cache uses: actions/cache@v3 @@ -352,7 +352,7 @@ jobs: uses: actions/cache@v3 with: path: ${{ steps.go-cache-paths.outputs.go-build }} - key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }} + key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum', '**/**.go') }} - name: Go Mod Cache uses: actions/cache@v3 From ebd99371e8f81ae4e95fa15951fd1536fc4bb4f0 Mon Sep 17 00:00:00 2001 From: Ammar Bandukwala Date: Sun, 24 Jul 2022 01:01:43 +0000 Subject: [PATCH 21/37] fixup! Optimize style/gen with go cache --- .github/workflows/coder.yaml | 2 +- gotests.xml | 1812 ---------------------------------- 2 files changed, 1 insertion(+), 1813 deletions(-) delete mode 100644 gotests.xml diff --git a/.github/workflows/coder.yaml b/.github/workflows/coder.yaml index ded872a0d97a6..fb1cebc37e1cd 100644 --- a/.github/workflows/coder.yaml +++ b/.github/workflows/coder.yaml @@ -565,7 +565,7 @@ jobs: test-e2e: name: "test/e2e/${{ matrix.os }}" needs: changes - if: needs.changes.outputs.docs-only == 'false' + if: needs.changes.outputs.docs-only == 'false' && !contains(needs.prcontext.outputs.skips, github.job) runs-on: ${{ matrix.os }} timeout-minutes: 20 strategy: diff --git a/gotests.xml b/gotests.xml deleted file mode 100644 index e25e5e46463ab..0000000000000 --- a/gotests.xml +++ /dev/null @@ -1,1812 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file From 9ddf43a3cd5e51f5360bdc8409b681a55d2e5024 Mon Sep 17 00:00:00 2001 From: Ammar Bandukwala Date: Sun, 24 Jul 2022 01:17:50 +0000 Subject: [PATCH 22/37] fixup! Optimize style/gen with go cache --- .github/workflows/coder.yaml | 12 +++++++----- .github/workflows/prcontext/README.md | 4 ++-- .github/workflows/prcontext/parse.go | 6 ++++-- .github/workflows/prcontext/parse_test.go | 1 + 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/.github/workflows/coder.yaml b/.github/workflows/coder.yaml index fb1cebc37e1cd..e8bbb4371bbd5 100644 --- a/.github/workflows/coder.yaml +++ b/.github/workflows/coder.yaml @@ -71,13 +71,13 @@ jobs: pr-context: runs-on: ubuntu-latest outputs: - skips: ${{ steps.prcontext.skips }} + skips: ${{ steps.pr-context.skips }} steps: - uses: actions/checkout@v3 - uses: actions/setup-go@v3 with: go-version: "~1.18" - - id: prcontext + - id: pr-context env: GITHUB_CONTEXT: ${{ toJSON(github) }} run: | @@ -328,7 +328,7 @@ jobs: - pr-context if: > needs.changes.outputs.docs-only == 'false' && - !contains(needs.prcontext.outputs.skips, github.job) + contains(needs.pr-context.outputs.skips, github.job) == 'false' runs-on: ubuntu-latest # This timeout must be greater than the timeout set by `go test` in # `make test-postgres` to ensure we receive a trace of running @@ -564,8 +564,10 @@ jobs: test-e2e: name: "test/e2e/${{ matrix.os }}" - needs: changes - if: needs.changes.outputs.docs-only == 'false' && !contains(needs.prcontext.outputs.skips, github.job) + needs: + - changes + - pr-context + if: needs.changes.outputs.docs-only == 'false' && contains(needs.pr-context.outputs.skips, github.job) == 'false' runs-on: ${{ matrix.os }} timeout-minutes: 20 strategy: diff --git a/.github/workflows/prcontext/README.md b/.github/workflows/prcontext/README.md index 6324641e45be3..f3be624d1978e 100644 --- a/.github/workflows/prcontext/README.md +++ b/.github/workflows/prcontext/README.md @@ -3,5 +3,5 @@ `prcontext` is a simple Go program that extracts CI directives from PRs for a more efficient merge cycle. -Since skips are only possible within PRs, the full suite will still run on -merge. +Right now it only supports the `[ci-skip [job ...]]` directive. Since skips are +only possible within PRs, the full suite will still run on merge. diff --git a/.github/workflows/prcontext/parse.go b/.github/workflows/prcontext/parse.go index 70536b4739026..b17e0fdf00f6f 100644 --- a/.github/workflows/prcontext/parse.go +++ b/.github/workflows/prcontext/parse.go @@ -3,15 +3,17 @@ package main import ( "regexp" "strings" + + "github.com/coder/flog" ) const ciSkipPrefix = "ci-skip" -var skipDirective = regexp.MustCompile(`\[` + ciSkipPrefix + ` ([\w\/ ]+)]`) +var skipDirective = regexp.MustCompile(`\[` + ciSkipPrefix + ` ([\w-\/ ]+)]`) func parseBody(body string) (skips []string) { matches := skipDirective.FindAllStringSubmatch(body, -1) - // flog.Info("matches: %+v", matches) + flog.Info("matches: %+v", matches) var skipMatches []string for i := range matches { diff --git a/.github/workflows/prcontext/parse_test.go b/.github/workflows/prcontext/parse_test.go index 724863ec237ff..3ef63163a4948 100644 --- a/.github/workflows/prcontext/parse_test.go +++ b/.github/workflows/prcontext/parse_test.go @@ -26,6 +26,7 @@ func Test_parseBody(t *testing.T) { {"single dir single skip", args{"test pr [ci-skip dog] 123\n\n"}, []string{"dog"}}, {"double dir double skip", args{"test pr [ci-skip dog] [ci-skip cat] 123\n\n"}, []string{"dog", "cat"}}, {"single dir double skip", args{"test pr [ci-skip test/go/postgres cat] 123\n\n"}, []string{"test/go/postgres", "cat"}}, + {"confuse", args{"ci ci [ci-skip] dog [ci-skip test/go/postgres test/e2e/ubuntu-latest] 123\n\n"}, []string{"test/go/postgres", "test/e2e/ubuntu-latest"}}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { From 13b75c692ae81ace3a3b6aebe93d18f86c5db571 Mon Sep 17 00:00:00 2001 From: Ammar Bandukwala Date: Sun, 24 Jul 2022 01:24:05 +0000 Subject: [PATCH 23/37] fixup! Optimize style/gen with go cache --- .github/workflows/prcontext/parse.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/prcontext/parse.go b/.github/workflows/prcontext/parse.go index b17e0fdf00f6f..4d4155772c32f 100644 --- a/.github/workflows/prcontext/parse.go +++ b/.github/workflows/prcontext/parse.go @@ -3,8 +3,6 @@ package main import ( "regexp" "strings" - - "github.com/coder/flog" ) const ciSkipPrefix = "ci-skip" @@ -13,7 +11,7 @@ var skipDirective = regexp.MustCompile(`\[` + ciSkipPrefix + ` ([\w-\/ ]+)]`) func parseBody(body string) (skips []string) { matches := skipDirective.FindAllStringSubmatch(body, -1) - flog.Info("matches: %+v", matches) + // flog.Info("matches: %+v", matches) var skipMatches []string for i := range matches { From 003b15843cedb3e1359153732a293d4d06f72be5 Mon Sep 17 00:00:00 2001 From: Ammar Bandukwala Date: Sun, 24 Jul 2022 01:25:26 +0000 Subject: [PATCH 24/37] fixup! Optimize style/gen with go cache --- .github/workflows/coder.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/coder.yaml b/.github/workflows/coder.yaml index e8bbb4371bbd5..c5ed4cc444d6e 100644 --- a/.github/workflows/coder.yaml +++ b/.github/workflows/coder.yaml @@ -71,7 +71,7 @@ jobs: pr-context: runs-on: ubuntu-latest outputs: - skips: ${{ steps.pr-context.skips }} + skips: ${{ steps.pr-context.outputs.skips }} steps: - uses: actions/checkout@v3 - uses: actions/setup-go@v3 From 96a76e645a8139e31199a29d5fcddd6fc10a270c Mon Sep 17 00:00:00 2001 From: Ammar Bandukwala Date: Sun, 24 Jul 2022 01:27:32 +0000 Subject: [PATCH 25/37] fixup! Optimize style/gen with go cache --- .github/workflows/coder.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/coder.yaml b/.github/workflows/coder.yaml index c5ed4cc444d6e..8e655d230ee72 100644 --- a/.github/workflows/coder.yaml +++ b/.github/workflows/coder.yaml @@ -567,7 +567,7 @@ jobs: needs: - changes - pr-context - if: needs.changes.outputs.docs-only == 'false' && contains(needs.pr-context.outputs.skips, github.job) == 'false' + if: needs.changes.outputs.docs-only == 'false' && !contains(needs.pr-context.outputs.skips, github.job) runs-on: ${{ matrix.os }} timeout-minutes: 20 strategy: From d361dd28b9b636e0cf2f61dd970a90b0eb566127 Mon Sep 17 00:00:00 2001 From: Ammar Bandukwala Date: Sun, 24 Jul 2022 01:31:57 +0000 Subject: [PATCH 26/37] fixup! Optimize style/gen with go cache --- .github/workflows/coder.yaml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/coder.yaml b/.github/workflows/coder.yaml index 8e655d230ee72..3e6a9199d99a7 100644 --- a/.github/workflows/coder.yaml +++ b/.github/workflows/coder.yaml @@ -60,13 +60,15 @@ jobs: echo "${{ toJSON(steps.filter )}}" # Debug step - show-changes: - needs: changes + debug-inputs: + needs: + - changes + - pr-context runs-on: ubuntu-latest steps: - id: log run: | - echo "${{ toJSON(needs.changes) }}" + echo "${{ toJSON(needs) }}" pr-context: runs-on: ubuntu-latest @@ -567,7 +569,7 @@ jobs: needs: - changes - pr-context - if: needs.changes.outputs.docs-only == 'false' && !contains(needs.pr-context.outputs.skips, github.job) + if: needs.changes.outputs.docs-only == 'false' && contains(needs.pr-context.outputs.skips, github.job) == 'false' runs-on: ${{ matrix.os }} timeout-minutes: 20 strategy: From be3b574eb7bca276fd1721d7e5b1bd6bf121506f Mon Sep 17 00:00:00 2001 From: Ammar Bandukwala Date: Sun, 24 Jul 2022 01:35:39 +0000 Subject: [PATCH 27/37] fixup! Optimize style/gen with go cache --- .github/workflows/coder.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/coder.yaml b/.github/workflows/coder.yaml index 3e6a9199d99a7..e6995fa4438c1 100644 --- a/.github/workflows/coder.yaml +++ b/.github/workflows/coder.yaml @@ -69,6 +69,7 @@ jobs: - id: log run: | echo "${{ toJSON(needs) }}" + echo "${{ contains(needs.pr-context.outputs.skips, github.job) }} pr-context: runs-on: ubuntu-latest @@ -569,7 +570,7 @@ jobs: needs: - changes - pr-context - if: needs.changes.outputs.docs-only == 'false' && contains(needs.pr-context.outputs.skips, github.job) == 'false' + if: needs.changes.outputs.docs-only == 'false' && !contains(needs.pr-context.outputs.skips, github.job) runs-on: ${{ matrix.os }} timeout-minutes: 20 strategy: From d3290230d437f58767078b20862eceaf1ecb3cb9 Mon Sep 17 00:00:00 2001 From: Ammar Bandukwala Date: Sun, 24 Jul 2022 01:37:00 +0000 Subject: [PATCH 28/37] fixup! Optimize style/gen with go cache --- .github/workflows/coder.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/coder.yaml b/.github/workflows/coder.yaml index e6995fa4438c1..174c553f96e5a 100644 --- a/.github/workflows/coder.yaml +++ b/.github/workflows/coder.yaml @@ -69,7 +69,7 @@ jobs: - id: log run: | echo "${{ toJSON(needs) }}" - echo "${{ contains(needs.pr-context.outputs.skips, github.job) }} + echo "${{ contains(needs.pr-context.outputs.skips, github.job) }} " pr-context: runs-on: ubuntu-latest From cbea04d0df66a94f9d0a2a858ae42c9914a54eff Mon Sep 17 00:00:00 2001 From: Ammar Bandukwala Date: Sun, 24 Jul 2022 01:39:11 +0000 Subject: [PATCH 29/37] fixup! Optimize style/gen with go cache --- .github/workflows/coder.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/coder.yaml b/.github/workflows/coder.yaml index 174c553f96e5a..f0d2b958c6c5e 100644 --- a/.github/workflows/coder.yaml +++ b/.github/workflows/coder.yaml @@ -69,7 +69,7 @@ jobs: - id: log run: | echo "${{ toJSON(needs) }}" - echo "${{ contains(needs.pr-context.outputs.skips, github.job) }} " + echo "${{ contains(needs.pr-context.outputs.skips, "postgres") }} " pr-context: runs-on: ubuntu-latest From 9e3c2f7f4bca1e481e7cdf0dfe3da4ddd0612433 Mon Sep 17 00:00:00 2001 From: Ammar Bandukwala Date: Sun, 24 Jul 2022 01:39:59 +0000 Subject: [PATCH 30/37] fixup! Optimize style/gen with go cache --- .github/workflows/coder.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/coder.yaml b/.github/workflows/coder.yaml index f0d2b958c6c5e..5f3cbb6e24ffb 100644 --- a/.github/workflows/coder.yaml +++ b/.github/workflows/coder.yaml @@ -570,7 +570,7 @@ jobs: needs: - changes - pr-context - if: needs.changes.outputs.docs-only == 'false' && !contains(needs.pr-context.outputs.skips, github.job) + if: needs.changes.outputs.docs-only == 'false' && !contains(needs.pr-context.outputs.skips, "test/e2e") runs-on: ${{ matrix.os }} timeout-minutes: 20 strategy: From f3e3a79b952de4025b43a12915ef92a4d01fbc97 Mon Sep 17 00:00:00 2001 From: Ammar Bandukwala Date: Sun, 24 Jul 2022 01:40:34 +0000 Subject: [PATCH 31/37] fixup! Optimize style/gen with go cache --- .github/workflows/coder.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/coder.yaml b/.github/workflows/coder.yaml index 5f3cbb6e24ffb..d0d9c9a8edddd 100644 --- a/.github/workflows/coder.yaml +++ b/.github/workflows/coder.yaml @@ -69,7 +69,7 @@ jobs: - id: log run: | echo "${{ toJSON(needs) }}" - echo "${{ contains(needs.pr-context.outputs.skips, "postgres") }} " + echo "${{ contains(needs.pr-context.outputs.skips, 'postgres') }} " pr-context: runs-on: ubuntu-latest From 0846d261f37d9b8cb94f2c93736f23a5259ab4df Mon Sep 17 00:00:00 2001 From: Ammar Bandukwala Date: Sun, 24 Jul 2022 01:43:48 +0000 Subject: [PATCH 32/37] fixup! Optimize style/gen with go cache --- .github/workflows/coder.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/coder.yaml b/.github/workflows/coder.yaml index d0d9c9a8edddd..5c50730bab403 100644 --- a/.github/workflows/coder.yaml +++ b/.github/workflows/coder.yaml @@ -570,7 +570,7 @@ jobs: needs: - changes - pr-context - if: needs.changes.outputs.docs-only == 'false' && !contains(needs.pr-context.outputs.skips, "test/e2e") + if: needs.changes.outputs.docs-only == 'false' && !contains(needs.pr-context.outputs.skips, 'test/e2e') runs-on: ${{ matrix.os }} timeout-minutes: 20 strategy: From a44d023aedb507aaa8684d5f8b77b00926cc3f03 Mon Sep 17 00:00:00 2001 From: Ammar Bandukwala Date: Sun, 24 Jul 2022 01:54:26 +0000 Subject: [PATCH 33/37] Enable caching in webpack --- .github/workflows/coder.yaml | 2 +- site/out/GITKEEP | 0 site/out/bin/GITKEEP | 0 site/webpack.common.ts | 4 ++++ 4 files changed, 5 insertions(+), 1 deletion(-) delete mode 100644 site/out/GITKEEP delete mode 100644 site/out/bin/GITKEEP diff --git a/.github/workflows/coder.yaml b/.github/workflows/coder.yaml index 5c50730bab403..2dccdfea6e115 100644 --- a/.github/workflows/coder.yaml +++ b/.github/workflows/coder.yaml @@ -587,7 +587,7 @@ jobs: path: | **/node_modules .eslintcache - key: js-${{ runner.os }}-test-${{ hashFiles('**/yarn.lock') }} + key: js-${{ runner.os }}-e2e-${{ hashFiles('**/yarn.lock') }} restore-keys: | js-${{ runner.os }}- diff --git a/site/out/GITKEEP b/site/out/GITKEEP deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/site/out/bin/GITKEEP b/site/out/bin/GITKEEP deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/site/webpack.common.ts b/site/webpack.common.ts index 9fcd7a7ba2c00..ad7a758cca6c4 100644 --- a/site/webpack.common.ts +++ b/site/webpack.common.ts @@ -93,6 +93,10 @@ export const createCommonWebpackConfig = (options?: { skipTypecheck: boolean }): ], }, + cache: { + type: "filesystem", + }, + // resolve extend/modify how modules are resolved. // // REMARK: Do not add aliases here, unless they cannot be defined in a From 5609487b9189a7896393eb1ef0406ca51fb670d7 Mon Sep 17 00:00:00 2001 From: Ammar Bandukwala Date: Sun, 24 Jul 2022 02:07:49 +0000 Subject: [PATCH 34/37] fixup! Enable caching in webpack --- .github/workflows/coder.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/coder.yaml b/.github/workflows/coder.yaml index 2dccdfea6e115..33a29a4002372 100644 --- a/.github/workflows/coder.yaml +++ b/.github/workflows/coder.yaml @@ -588,8 +588,6 @@ jobs: **/node_modules .eslintcache key: js-${{ runner.os }}-e2e-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - js-${{ runner.os }}- # Go is required for uploading the test results to datadog - uses: actions/setup-go@v3 From 7e0578118768ddb20160ee815b7cf795b6786f38 Mon Sep 17 00:00:00 2001 From: Ammar Bandukwala Date: Sun, 24 Jul 2022 02:10:11 +0000 Subject: [PATCH 35/37] fixup! Enable caching in webpack --- .github/workflows/coder.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/coder.yaml b/.github/workflows/coder.yaml index 33a29a4002372..187381e005304 100644 --- a/.github/workflows/coder.yaml +++ b/.github/workflows/coder.yaml @@ -623,6 +623,7 @@ jobs: - name: Build run: | + yarn install make -B site/out/index.html - run: yarn playwright:install From 526fea9c96768e5f750b70bfaaf7f8ab6f721fb5 Mon Sep 17 00:00:00 2001 From: Ammar Bandukwala Date: Sun, 24 Jul 2022 02:13:58 +0000 Subject: [PATCH 36/37] fixup! Enable caching in webpack --- .github/workflows/coder.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/coder.yaml b/.github/workflows/coder.yaml index 187381e005304..7afe95b2c892e 100644 --- a/.github/workflows/coder.yaml +++ b/.github/workflows/coder.yaml @@ -623,7 +623,7 @@ jobs: - name: Build run: | - yarn install + sudo npm install -g prettier make -B site/out/index.html - run: yarn playwright:install From 3fe2eaadfcea0d4aee56b92b16e2739240fd14e4 Mon Sep 17 00:00:00 2001 From: Ammar Bandukwala Date: Sun, 24 Jul 2022 02:21:05 +0000 Subject: [PATCH 37/37] fixup! Enable caching in webpack --- site/out/GITKEEP | 0 site/out/bin/GITKEEP | 0 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 site/out/GITKEEP create mode 100644 site/out/bin/GITKEEP diff --git a/site/out/GITKEEP b/site/out/GITKEEP new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/site/out/bin/GITKEEP b/site/out/bin/GITKEEP new file mode 100644 index 0000000000000..e69de29bb2d1d