From 55770452a2e059044f0512fb0ca5efa2aa8627bd Mon Sep 17 00:00:00 2001 From: mljadama Date: Thu, 13 Aug 2026 15:37:01 +0000 Subject: [PATCH 01/10] add name --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index c2bec0368b7..d44885cf5ac 100644 --- a/README.md +++ b/README.md @@ -21,3 +21,5 @@ go build -o notely && ./notely *This starts the server in non-database mode.* It will serve a simple webpage at `http://localhost:8080`. You do *not* need to set up a database or any interactivity on the webpage yet. Instructions for that will come later in the course! + +Mola's version of Boot.dev's Notely app. From 28307402cef6b3fa83d17c5a6556069035dbc791 Mon Sep 17 00:00:00 2001 From: mljadama Date: Thu, 13 Aug 2026 15:54:10 +0000 Subject: [PATCH 02/10] adding new changes --- .github/workflows/ci.yaml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/ci.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 00000000000..664032071d1 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,22 @@ +name: ci + +on: + pull_request: + branches: [main] + +jobs: + tests: + name: Tests + runs-on: ubuntu-latest + + steps: + - name: Check out code + uses: actions/checkout@v6 + + - name: Set up Go + uses: actions/setup-go@v6 + with: + go-version: "1.26.0" + + - name: Force Failure + run: (exit 1) \ No newline at end of file From bb9184bbe7d52cf448847d0e6a8d8497ed5c0c8b Mon Sep 17 00:00:00 2001 From: mljadama Date: Thu, 13 Aug 2026 16:04:16 +0000 Subject: [PATCH 03/10] add CI workflow --- .github/workflows/ci.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000000..a2cf2a837ae --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,22 @@ +name: ci + +on: + pull_request: + branches: [main] + +jobs: + tests: + name: Tests + runs-on: ubuntu-latest + + steps: + - name: Check out code + uses: actions/checkout@v6 + + - name: Set up Go + uses: actions/setup-go@v6 + with: + go-version: "1.26.0" + + - name: Force Failure + run: (exit 1) From 9ed13fcd854c85b98aa30789f1f2d9034c0d2c57 Mon Sep 17 00:00:00 2001 From: mljadama Date: Thu, 13 Aug 2026 16:11:54 +0000 Subject: [PATCH 04/10] update --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 664032071d1..40bdca78318 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -19,4 +19,4 @@ jobs: go-version: "1.26.0" - name: Force Failure - run: (exit 1) \ No newline at end of file + run: go version \ No newline at end of file From f0c5aac7e274123cff9b6b8d7821b3287930b85e Mon Sep 17 00:00:00 2001 From: mljadama Date: Thu, 13 Aug 2026 16:14:23 +0000 Subject: [PATCH 05/10] update --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a2cf2a837ae..6d1b2483779 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,4 +19,4 @@ jobs: go-version: "1.26.0" - name: Force Failure - run: (exit 1) + run: go version From bc36adf23517ed1ff90586d41d7021e58874333b Mon Sep 17 00:00:00 2001 From: mljadama Date: Thu, 13 Aug 2026 16:35:13 +0000 Subject: [PATCH 06/10] run tests in CI --- .github/workflows/ci.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6d1b2483779..3f4aa573149 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,10 +13,5 @@ jobs: - name: Check out code uses: actions/checkout@v6 - - name: Set up Go - uses: actions/setup-go@v6 - with: - go-version: "1.26.0" - - - name: Force Failure - run: go version + - name: Run tests + run: go test ./... From 807cb5938b3472e53c8686a75db57ac576cd19bb Mon Sep 17 00:00:00 2001 From: mljadama Date: Thu, 13 Aug 2026 16:41:36 +0000 Subject: [PATCH 07/10] add test coverage --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3f4aa573149..92d697ac8ae 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,4 +14,4 @@ jobs: uses: actions/checkout@v6 - name: Run tests - run: go test ./... + run: go test -cover ./... From 42add51b3fdfd7fc1e288b8d36d898736680b5e5 Mon Sep 17 00:00:00 2001 From: mljadama Date: Thu, 13 Aug 2026 16:49:41 +0000 Subject: [PATCH 08/10] update readme --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index d44885cf5ac..2e9fb969659 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +https://github.com///actions/workflows//badge.svg + # learn-cicd-starter (Notely) This repo contains the starter code for the "Notely" application for the "Learn CICD" course on [Boot.dev](https://boot.dev). From 4a41c7103d28186cae1d0830a6afd4cf29215c04 Mon Sep 17 00:00:00 2001 From: mljadama Date: Thu, 13 Aug 2026 17:12:21 +0000 Subject: [PATCH 09/10] add style CI job --- .github/workflows/ci.yml | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 92d697ac8ae..d4b55bd7883 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,5 +13,26 @@ jobs: - name: Check out code uses: actions/checkout@v6 + - name: Set up Go + uses: actions/setup-go@v6 + with: + go-version: "1.26.0" + - name: Run tests - run: go test -cover ./... + run: go test -cover ./... + + style: + name: Style + runs-on: ubuntu-latest + + steps: + - name: Check out code + uses: actions/checkout@v6 + + - name: Set up Go + uses: actions/setup-go@v6 + with: + go-version: "1.26.0" + + - name: Check formatting + run: test -z "$(go fmt ./...)" From 6825405799612c59967f6194881271dbcdebcf43 Mon Sep 17 00:00:00 2001 From: mljadama Date: Thu, 13 Aug 2026 17:18:10 +0000 Subject: [PATCH 10/10] add --- internal/auth/get_api_key_test.go | 55 +++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 internal/auth/get_api_key_test.go diff --git a/internal/auth/get_api_key_test.go b/internal/auth/get_api_key_test.go new file mode 100644 index 00000000000..ff3a821dae9 --- /dev/null +++ b/internal/auth/get_api_key_test.go @@ -0,0 +1,55 @@ +package auth + +import ( + "errors" + "net/http" + "testing" +) + +func TestGetAPIKey(t *testing.T) { + tests := []struct { + name string + header string + want string + wantError error + }{ + { + name: "valid API key", + header: "ApiKey abc123", + want: "abc123", + }, + { + name: "missing authorization header", + header: "", + wantError: ErrNoAuthHeaderIncluded, + }, + { + name: "malformed authorization header", + header: "Bearer abc123", + wantError: errors.New("malformed authorization header"), + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + headers := http.Header{} + if tt.header != "" { + headers.Set("Authorization", tt.header) + } + + got, err := GetAPIKey(headers) + + if got != tt.want { + t.Errorf("GetAPIKey() got = %q, want %q", got, tt.want) + } + + if tt.wantError != nil { + if err == nil || err.Error() != tt.wantError.Error() { + t.Errorf("GetAPIKey() error = %v, want %v", err, tt.wantError) + } + } else if err != nil { + t.Errorf("GetAPIKey() unexpected error = %v", err) + } + }) + } +}